Prev Source
Next Source

A Philosophy of Software Design

The most common mistake made by students was to divide their code into a large number of shallow classes, which led to information leakage between the classes.

When deciding whether to combine or separate, the goal is to reduce the complexity of the system as a whole and improve its modularity. It might appear that the best way to achieve this goal is to divide the system into a large number of small components:

However, the act of subdividing creates additional complexity that was not present before subdivision: Some complexity comes just from the number of components: the more components, the harder to keep track of them all and the harder to find a desired component within the large collection. Subdivision usually results in more interfaces, and every new interface adds complexity.

Subdivision can result in additional code to manage the components. For example, a piece of code that used a single object before subdivision might now have to manage multiple objects.


Date
November 30, 2023