Developing Less Code

The principles we have just described and the techniques that follow lead to smaller codebases and should be applied right from the start of a project. Keeping a codebase small is much easier than reducing the size of an existing codebase. And while legacy code presents a more difficult problem, it can also benefit from some of the techniques employed to minimize code. As with automated testing, you can reduce the size of a legacy codebase incrementally, applying the principles as the legacy code is changed for other reasons.

Several techniques exist for implementing the “less code” principles. Prioritizing requirements, developing in short iterations, developing only for the current iteration, avoiding unnecessary complexity, and reuse can all help to eliminate unnecessary code. Coding standards, best practices, design patterns, and refactoring can all help to make code more efficient.

Prioritize Requirements

A rule of thumb that is often applied to customer requirements is the “80/20” rule (mentioned earlier in Chapter 2). The 80/20 rule states that:

80% of the useful functionality of a software application is described by 20% of the requirements.

By implementing the most significant 20% of the requirements, a development team can implement 80% of the functionality required by the customer. Prioritizing requirements makes it clear which features constitute that 20% and allows developers to concentrate on those features.

Requirements are often written to include ...

Get The Art of Lean Software Development 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.