I came across a couple of articles today talking about software maintainability. This one, from Greg Jorgensen, is fun to read. Greg is specialized in dealing with unmaintainable legacy software, and he lists everything developers should do to keep him in business. This other one, from Matt DuVall, is about the myth of maintainability and talks about all these design errors made in the name of maintainability.
I couldn’t agree more with these two articles. Developers spend way too much time debating how to make a clean software design. That should be a good thing, but they often forget that the best designs are the simplest ones, the ones that will seem so obvious to the next developer that he won’t see any reason why things should have been different (I know, that never happens, but you get the picture). When talking about maintainability, we’re usually trying to project ourselves in the future, to think about how the code will evolve, about the features that will be added. Except that we’re already struggling to define what features are important now, so please let’s just forget about the ones which may be required a couple of years from now. Our software may not even live this long.
Do not misunderstand me, that doesn’t mean we should be careless about the code. But maybe we should :
- design based on what we know and need now, not based on what may be coming in a few months. Anything you do to make the code more “maintainable”, “clean” should have immediate benefits.
- postpone everything that is not required now and that won’t be significantly more expensive to do six months from now. You believe that you should decouple this class by defining an interface because you may have another implementation ? Unless this new implementation is coming in your next sprint/iteration, forget about it.
What we want to avoid is code that makes developers proud of having used every single design pattern and abstracted every single class, but which is totally incomprehensible and incredibly costly to maintain by any new developer.