January 2009 Blog Posts

To the loneliest VanderHeyden

Apparently Simon is already pining for home and is worried that I'm yet to mention his new blog A Gamer's Odyssey. I have these things to say: You haven't taken any kind of gaming system with you. I challenge your gaming credentials. A single post on an alleged game for the iPhone does not a gaming blog make. You should be referring to yourself as Oddity if you're on an Odyssey. You haven't even left Australia yet. Get a move on. ...

posted @ Friday, January 30, 2009 5:45 PM | Feedback (2)

Unit Tests should not rely on external resources

The project I'm on recently had a broken build due to a failing unit test. This is relatively unremarkable except the unit test in question would pass consistently on the developers machine but fail on others including our build server. This unit test relied on an external resource (an LDAP server) that was not visible to some of our development machines but was to others. This behaviour meant the test was of negative value as a failure could be attributed either to a legitimate bug or simple unavailability of the external resource. In general it would not be worth tracking...

posted @ Thursday, January 29, 2009 10:52 AM | Feedback (2)

Falling for Brian H. Madsen's desperate pleas for link love

Bwian wishes people to know of his "Linked .Net Users Group - Deepen your Debugging: Tips and Tricks for the Visual Studio 2008 Debugger" virtual event thingy. He'll get all sulky if no one virtually attends. Which could be amusing so there's no downside.

posted @ Wednesday, January 28, 2009 3:40 PM | Feedback (1)

Weirdness due to deferred execution with Enumerable extension methods

My previous post discussing using use of Enumerable.Select to map collections fails to cover some potentially unexpected behaviour you may encounter in practice. I noticed this when unit testing some code recently where my tests were failing due to violated expectations. The tests in question mock the mapper and set expectations as to how it will be called. The test was failing because the mapper was being invoked more than expected. This is due to the deferred execution behaviour that Enumerable.Select and other such methods exhibit. This effectively means that the majority of the select logic is not executed...

posted @ Sunday, January 18, 2009 8:40 AM | Feedback (0)

Sophisticated vs. Complex

Modern programming languages provide many advanced features that many developers will not be familiar with. Often this is because the features are not applicable to a problem domain or the developer uses an alternate approach to problems addressed by the feature. This is rarely a criticism, there are no prizes in production code for how many advanced features you're taking advantage of. Use of advanced features should be governed by whether they make the code more maintainable, extensible, flexible, testable and correct. If you are not getting these benefits then you are unlikely to be using them legitimately and should...

posted @ Friday, January 16, 2009 12:47 AM | Feedback (0)

Small Code Improvements Part 3: Using Enumerable.Select to map collections

The Enumerable.Select method is used in LINQ to perform query magic. It may also be used in scenarios where you wish to transform a collection. The most common use to which I put this is in mapping between domain and message objects. The system I'm currently working with maintains a clear distinction between the wire format and the domain. This requires that there be a mapping between the formats. This is performed by a series of mapper classes that handle mapping between different message and domain types. This is composable, for instance an address mapper may be injected into...

posted @ Thursday, January 15, 2009 11:31 PM | Feedback (0)