Monday, August 07, 2006

Maintainable Software

In looking at some code today, I was reminded of Billy Hollis’s 2005 Grok Talk. If you haven’t seen it (or want to see it again) it can be found on Google Videos here.

I think the real point is that building maintainable systems is more important then just cranking out reams of code. Software spends most of its life in the maintenance phase and not in the creation phase. This is a very important lesson for developers to learn. Although it is not easy to do, there must be a conscious effort to build maintainable software.

Some things that I have found:
- Inheritance can be very useful when you are trying to create things quickly, however inheritance can be very difficult to maintain. Form inheritance is one of those things that can make development very fast, however will ultimately make it very difficult for someone else to maintain. I am talking about the case where you have a base form that tries to do some logic and then you inherit off of it and try to extend it in a way to add or change the logic.
- Another thing to think about is how many classes you have to touch in order to add a new field. You should try to keep the number of classes as low as possible. Try to separate your objects so that they don’t rely heavily on each other. Adding a new field is one of the most common ways software is grown.
- Something else that should be obvious is that less code is better and the more straight-forward your code is, the easier it will be to maintain. Of course that is easier said then done. But none the less, it is something to strive for.