Testing and archicture, for the sake of testing and architecture

  • Post author:
  • Post category:Uncategorized

I don’t always agree with Joel Spolsky, but in this case I think he’s making an excellent point. A lot of developers go too far with unit tests, and even with OO design. Joel is NOT saying that unit tests and OO are a waste of time, but that developers often take them way too far. We write a lot of extra tests and code, for the sake of maintainability, when many of the tests or OO parts will never be used. I love this part of Joel’s argument: “it seems to me like a lot of the Object Oriented Design principles you’re hearing lately from people like Robert Martin and Kent Beck and so forth have gone off the deep end into architecture for architecture’s sake. It doesn’t seem like you could actually get any code written if you’re spending all your time writing 8,000,000 unit tests, and every single dinky little class that you need to split a URL into four parts becomes an engineering project worthy of making a bridge, where you spend six months defining 1000 little interfaces. They’ve just gone off the deep end, and I don’t think these people write very much code if they’re coming up with these principles, to be honest, it doesn’t even make sense.”That said, both Joel and Jeff make the point that there ARE cases where “going off the deep end” makes sense, but it depends on your intended goal. And I would argue that MOST software projects do not NEED to take unit testing and OO this far. Unless you are building a heart monitoring system, or a compiler, you don’t need to worry about covering every single potential edge case. Maybe you don’t need to worry about the person that is accessing your site from the Lynx web browser, on February 29th at midnight.