Don’t take any wooden nickels, part 2

Improvement, Techniques

Microsoft Patterns and Practices is an extreme case of my theory about consultants. These guys appear to have never shipped anything that will be used by real users. That wasn’t always true. Early versions of the Data Access Block were quite useful. But then they started building examples that showed every possible facet and feature they could think of. And people started using these examples as guidance. Probably because P&P told them to.

The problem was, these things were too complicated for any real use and too complicated for a mere mortal (or even one of those rockstars. or was it ninjas?) to be able to extract just the little bits that could help them. And so people just started using these things whole hog, even if they only really needed 10% of the functionality. And don’t get me started on how big consulting firms (like the Big 6, or however many are left these days) love to use them as a basis for their lowest bidder projects that overrun schedule and budget…

What’s even worse is that typically these things do not follow sound software development principles. To them, OO is a typo where someone forgot to include the "W" (WOO!). People use these things as guidance to learn from. There’s an idea that there is nothing worse than to lead an innocent to sin. I’m not calling them evil or anything, but this guidance isn’t doing anybody who’s learning how to code in .Net any favors.

And of course, most sample code has this problem. In the sample code accompanying an article or a presentation, sometimes it is necessary to leave out the parameter checking and error handling code so that your point is clear. Its not the greatest thing, but its usually worth the tradeoff. It might be nice if maybe we started including the "well written" version in our sample code downloads.

The problem is, P&P ships these things as guidance. They implicitly say – if you write your code like this, everything will be great. And that’s probably true for version one but the omissions and issues of version one tend to live a long time. Not following good OO and development practices makes it hard to maintain and improve the application and that’s no fun.

Don’t take any one source as the guide for how you build software. Microsoft has provided a lot of very good tools and some very good guidance about how best to use those tools. But that guidance does not apply to every situation and some of it really doesn’t apply to any. Make sure you look at all sample code (or even open source project code) with open eyes. The author probably has a viable solution to a problem and it might even be your problem. But don’t assume it is the best solution for your needs.