Chapter 9. Keep Your Codebase Small

Program complexity grows until it exceeds the capability of the programmer who must maintain it.

7th Law of Computer Programming

Guideline:

  • Keep your codebase as small as feasible.

  • Do this by avoiding codebase growth and actively reducing system size.

  • This improves maintainability because having a small product, project, and team is a success factor.

A codebase is a collection of source code that is stored in one repository, can be compiled and deployed independently, and is maintained by one team. A system has at least one codebase. Larger systems sometimes have more than one codebase. A typical example is packaged software. There may be a codebase for the standard functionality, and there are different, independently maintained codebases for customer- or market-specific plugins.

Given two systems with the same functionality, in which one has a small codebase and the other has a large codebase, you surely would prefer the small system. In a small system it is easier to search through, analyze, and understand code. If you modify something, it is easier to tell whether the change has effects elsewhere in the system. This ease of maintenance leads to fewer mistakes and lower costs. That much is obvious.

Motivation

Software development and maintenance become increasingly hard with growing system size. Building larger systems requires larger teams and longer-lasting projects, which bring additional overhead and risks of (project) failure. ...

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.