A Simple, Effective Design Question

13 Jul, 2007

Everything changes. Even frameworks like J2EE and Spring go out of style. Your code, on the other hand, is intended to last for years. How can you design your code to survive these changes?

I have a simple and effective approach to this problem. For everything--absolutely everthing--I design, I ask myself the following question:

When, not if, I decide to change this design decision--and I surely will--how hard will it be?

This question applies to decisions about which frameworks and libraries to use as well as internal design decisions. ("When, not if, I decide to use a different framework--and I surely will--how hard will it be?")

Asking this question focuses my decisions on long-term results rather than short-term savings. It's saved me from some nasty problems, the best of which was avoiding Enterprise Java Beans back in 2000. At the time, EJBs were massively popular--the "right way" to build enterprise applications. Now people are struggling with their aftermath: when they decided to change their design decisions, it was really hard.

This question lies at the center of my design philosophy. It's saved my butt. Give it a try--it might save yours, too.