Maintainable code: everybody wants it, very few modernization customers get it. But rigorously defining what is maintainable code is somewhat difficult. However, there are some good guidelines to go by:

1. Maintainable code for web business systems does NOT have the same structure as your legacy mainframe programs. In Natural and COBOL and MAPPER, for example, it is possible to mix the business logic in with the presentation or view (the screens and reports). That’s not how we write programs for the web, and forcing the Java or .NET developers to forget most of the best practices they learned in school and follow the unstructured ramblings of a 30-year-old programming hegira is NOT what we mean by maintainable. Maintainable code is properly structured down to the class level — it’s not just a matter of throwing a bunch of spaghetti into the “spaghetti layer” and calling the result maintainable.

2. Several maintainable coding languages have meaningful comments — not just duplicating what was in the legacy system because that is only useful if you also duplicated the structure of the legacy application. Otherwise, the comments would be in the wrong place, wouldn’t they? The comments should tell the programmer about the Java or .NET programming choices that were made and why they were made.

3. Several maintainable coding languages use modern frameworks like Struts 2 and Hibernate and the facilities of Visual Studio 2010. It may not use the absolute latest versions, but it should not use versions that are obsolete or are on the verge of becoming so. Vendors who have translators that were written 8 or 10 years ago often don’t keep their output up to date, so what you get is code that looks like it was written 8 or 10 years ago. Can you say “Web Forms” and “legacy Java?” We knew you could.

4. Maintainable code today is object oriented. It has a good design that follows the Microsoft MVC recommendations and the Sun Blueprints. It is not enough to throw everything into one big procedural class and say the code is object oriented — it’s not.

5. The maintainable code includes all the code you need to build your system from scratch, with no vendor hold-backs. You should not have to go back to your vendor when the operating system changes, or when you have a performance problem in your application.

Those are the “Top 5″ things you should look for in a maintainable code. It’s also good to run code quality checkers from companies like CAST and to ensure that you do not have routines with unacceptably high cyclomatic complexity. But at the end of the day, the knowledgeable customer will know maintainable code when he or she sees it. If you’d like to see how very maintainable your new code can be, talk to us!


Image Source: openmatt