Friday 30 January 2009

Static methods and classes are always evil

So, I'm looking for a new gig and I take a call from an agency that represents a prestigious .Net development team that's paying well and using all the latest toys. Fantastic! The agent reckons I'm suited to the role and sends me a copy of the "perfume test". It's a technical test with an interesting twist. The constraints are rather few and far between and the test description is really just a description of a business problem. "Write your own solution to the problem and make sure you use good design practice." I'm told that I have 48 hours to write my solution but I finish in 4 and send it back. It's a complete TDD solution with all the required unit tests and even goes the extra mile with a few extra bells and whistles to spruce it up. I was feeling pretty confident and gave them a couple days to respond.

No news... I call them and am told "Your solution was great but you made use of a static class, we don't like that. It's hard to test. You're out of the running."

Uh oh. Well, if ever anyone wanted a good reason why you should never use static classes, the definitive answer is: It makes you unemployable. Q.E.D.