Radio Silence
16 Apr 2008Sorry for the radio silence, I'm currently in the moving process between Canada and New Zealand which you can imagine is fairly hectic, I plan to have one more post up before I get on the jet plane.
Sorry for the radio silence, I'm currently in the moving process between Canada and New Zealand which you can imagine is fairly hectic, I plan to have one more post up before I get on the jet plane.
So the opportunity to write this post came up a little quicker than anticipated.
I've started playing with Resharper 4.0 and one of the first things I noticed was that it recommends using var for local variables, there's a great post at "Varification – Using Implicitly Typed Locals" about their perspective on it. It's interesting reading and given me a lot to think about. The second note that it "induces" better named variables is interesting, it instantly remind me of the debate about TypeMock, and how that other mocking frameworks "induce" better designs.
Lately I've been seeing a lot of blog examples using the var keyword from C# 3.5 in places where the type name is well known. A good example of this would be at "Comparing Moq to Rhino Mocks" by Phil Haack. In my opinion it makes the code less readable, possibly not from the person in the IDE, but has someone reading a code sample on a blog it removes some of the explicitness around the types being used.
I've found the specification pattern a nice way to wrap up a piece of business rule to be reused through out the application, for instance in our e-commerce product our promotion entity builds a specification based of it's values. We can then use this specification to determine whether an order is valid for the promotion or even filter lists of orders using FindAll method on List and so on. Tim McCarthy has a great article on building Composite Specifications at "[A Composite Specification Pattern Implementation in .NET 2.0</a>".