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 flow of a 30-year-old program 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. Maintainable program source code has 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, Angular, Vue, Python or .NET programming choices that were made and why they were made. It’s good to carry comments containing business information forward, but that’s nowhere nearly enough for maintainability.
3. Most maintainable coding approaches use modern frameworks like Spring Boot and the facilities of recent programmer tools like Visual Studio or IntelliJ IDEA. The code 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. Just having a “Class” means nothing; it is the proper organization of the code, and following accepted design guidelines, that is important.
5. Maintainable code includes all the source code you need to build your system from scratch, with no vendor hold-backs. You should receive ALL of the code, including the source code to any secret APIs. 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, or when open source frameworks like Log4j are updated.
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