I happened to be catching up with an ex-colleague tonight over MSN who told me how small things during his learning of Agile were gradually making sense. During a moment about complexity, he said the following:
“A overly complicated piece of OO code can be just as bad a long piece of procedural VB.”
This got me thinking about the principle that any tool, methodology, fancy design pattern, can be overused or used incorrectly, creating a bigger mess than what it intended to resolve. This needs an analogy. Cooking!
A software principal, such as the Single-Responsibility-Principle (SRP), is like the sugar in a cake recipe. No sugar, and it’s not tasty, too much, and it’s sickly, and people most likely won’t eat it. Just the right amount, and you have a great tasting cake.
Any tool or principle that comes a long in software development is never a golden bullet. It’s the wisdom of the developer to know when and how any tool or principle is applied. Never buy in to a buzzword or “the cool design pattern” that pops up on your favourite software forum.
There are of course naturally occurring problems in all areas of software development. Like division by zero errors, or null reference exceptions. We solve these problems with defensive coding and exception handling. We should also equip ourselves with a set of design patterns that we know we’ll need in 99.9% of all software projects. These guard us from the more subtle growing issues that creep up in large growing projects.
Driving without a seat belt is irresponsible. The time you’ll need it on, it will save your life. Drive software development without a set of patterns and practices, and you’re asking for trouble – code that’s so hideous, no one will touch it, or maintenance of a project that becomes exponentially higher each time you work with it.
Do yourself a favour and learn the SOLID principles along with the importance of unit testing/TDD in software development. These help form your foundational principles that should be at the front of your thinking when writing code and designing software.