Thursday, January 29, 2015

Wednesday, January 28, 2015

Why readonly in C#?

Make summary form following post:

1. Improve readability: tell how to not use in other way.
2. Nothing to do with performance
3. Immutable data structures in threading

Monday, January 26, 2015

What is real purpose of Enable Visual Studio Hosting Process?

According to MSDN:
"The Visual Studio hosting process improves debugger performance and enables new debugger features, such as partial-trust debugging and design-time expression evaluation"

In real world:
Sometimes, vshost.exe always running, and you can't even kill it from Task Manager. (After killed it, it restores automatically, need to quit Visual Studio)

Need to disable this feature/bug by following steps:
Properties of project =>
"Debug" tab =>
uncheck "Enable the Visual Studio hosting process"

How to solve in C++ upgraded project for error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)?

Remove /Zl from Configuration Properties -> C/C++ -> All Options -> Additional Options

Friday, January 23, 2015

TDD is about Development not Design

TDD is about Development not Design

In initial design stage, need to hide unrelated detail as much as possible, cover high level scenario only.

Test Driven Design forces thinking on low level details. In this way, it is very easy to lose focus.

Try a new project to see if TDD stands for Test Driven Development, or Test Driven Design

Thursday, January 22, 2015

Why I Don't Teach SOLID

"The main culprit is SOLID's focus on dependencies. "
"These all lead developers to create interfaces everywhere.  They litter the codebase with interfaces like IFooer, IDoer, IMooer, and IPooer.  Navigating it becomes a nightmare. "

Personal experience:
I ever worked on a similar project:  this project has two functions: a wrapper for Icewarp API to create/update email accounts.
3k line of codes, near 10 layers of interface. Indeed, it is "SOLID" :)

Tuesday, January 20, 2015

TDD Is About Design, Not Testing

"Writing tests after writing code is a corruption of TDD"
"The act of writing a unit test is more an act of design than of verification."

TDD is a way to design software? or a way to verify/refine design? or both?

Thursday, January 15, 2015

How to solve problem: Installed Windows service by installutil not showing up in MMC services windows

Although installutil tells you everything is fine, the new service will not show up in MMC services windows.
Solution: use sc
sc create servicename binPath= servicebin.exe

Wednesday, January 14, 2015

Readonly vs const in C#

A const field can only be initialized at the declaration of the field.
A readonly field can be initialized either at the declaration or in a constructor

Tuesday, January 13, 2015

What is "Architectural Spike"?

An architectural spike is a thin slice of the entire application built for the purpose of determining and testing a potential architecture.

Definition from:

Friday, January 9, 2015

The most difficult part of TDD: You have to write tests first before coding/design/implementation

"Have to actually think what you expect from a piece of code BEFORE you write it! Madness! Instead of just writing code, you have to think before you code! And if you can't formulate properly an expectation, HOW do you write the code in the first place?!"

CQRS, Command Query Responsibility Segregation FAQ

CQRS by Martin Fowler

Introducing the Command Query Responsibility Segregation Pattern from MSDN

C# code exmaple: LIntroduction to CQRS