Chapter 12. Next Steps

At this point, you know a lot more about what maintainable code is, why it is important, and how to apply the 10 guidelines in this book. But writing maintainable code is not something you learn from a book. You learn it by doing it! Therefore, here we will discuss simple advice on practicing the 10 guidelines for achieving maintainable software.

Turning the Guidelines into Practice

Ensuring that your code is easy to maintain depends on two behaviors in your daily routine: discipline and setting priorities. Discipline helps you to constantly keep improving your coding techniques, up to a point where any new code you write will already be maintainable. As for priorities, some of the presented guidelines can seem to contradict each other. It takes consideration on your side about which guideline has the most impact on the actual maintainability of your system. Be sure to take some time to deliberate and ask your team for their opinion.

Lower-Level (Unit) Guidelines Take Precedence Over Higher-Level (Component) Guidelines

Keep in mind that the aggregated higher-level guidelines are effects of the application applying the lower-level principles. For example, when units of code are long and duplicated throughout the system (see Chapters 2 and 4), the codebase will likely be large as well (see Chapter 9). This is because one of the causes of having a large codebase is that long units are being duplicated.

Therefore, when there is a conflict between two guidelines, ...

Get Building Maintainable Software, Java Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.