Sunday, October 7, 2007

Clever Kills

Clever Kills. I heard this aphorism for the first time this week and it immediately struck a cord. I have found that one of the first casualties to clever or novel approaches is maintainability. There are two nails in this board that I often hammer on.

The first is that complexity for complexity sake is evil. Complexity increases development time and reduces the clarity and maintainability of a project. It is important to evaluate the ROI (Return on Investment) on complexity in your code and design. An investment in complexity must yield returns in other areas (scalability, redundancy, configurability, deployability, etc) that are also a constraint of your application or environment.

Notice that I said that what you get in return should be a constraint of your application or environment. Designs should be as simple as possible given your constraints; no simpler and no more complex. Even if you expect that at some point the application will have functionality added to it, a simple application can be easily refactored in the future to handle future demands. Requirements change and the further in the future the needs are, the less clearly they are seen. A small single form application for 3 users probably shouldn't use n-tier architecture (even though there are lots of benefits to n-tier architecture) unless such an approch is standard or otherwise required in your environment.

This brings me to my second point; standard approaches are standard for a reason. They're typically clear and concise or, if they aren't, then at least they are well documented and widely discussed. Because of this -- and this is the best part about standard approaches -- anyone can maintain them. If you loose maintainability in a critical application (and when they're not working they're all critical, aren't they?) then it would take a huge trade off in another area to offset that loss.

If there is a standard way that meets the requirements then use it. Standard approaches have stood the test of time. Odds are your clever solution will fail somewhere down the line due to things you couldn't (or just didn't) foresee.