Be Meticulous about composition

Manage boundaries. Build well.

Composition refers to the way in which something is put together. Composition is a key element in many of the things humans create. Whether it be a musical piece, a painting, a garden, or a building, the way we assemble the core components — the composition of them — has a significant impact on the overall experience.

Software composition is about constructing complex systems by piecing together smaller, distinct components into modules and piecing modules together into systems.


Software Entity Diagram showing simple composition

A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system.

- John Gall (Gall’s Law)

Each of these smaller, distinct components should exhibit a set of characteristics. They should be small, have a single evident purpose that they consistently do well, operate as independently as possible, adhere to agreed idioms (standards and conventions), promote intentional observability (the ability to monitor what the software is doing), and represent the problem domain for which they are intended.

For an excellent, more in-depth read on these characteristics, I recommend Dan North’s article on CUPID. Dan has had a tremendous influence on the way I think about software over the years.

Doc’s Substack is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.

When our components — functions, methods, procedures, routines — exhibit the desired characteristics, they are better able to be assembled into larger modules — classes, libraries, functional compositions — with low risk and high reliability.

Modules should exhibit the same characteristics as components. They should additionally collect together closely related concepts (known as cohesion) and be structured in such a way that they have as few dependencies as possible on other modules (known as coupling). We want high cohesion and low coupling.

This approach to development allows us to ultimately create systems from well composed modules and components, creating systems that are relatively independent, observable, reliable, and malleable.

We will cover more on composition, including tools, techniques, and principles in future articles.


Who do you know that would benefit from reading this? Share it with them now.

And if you want early access to these articles, come on over to https://docondev.substack.com/ where I’ll be publishing articles a month or two ahead of other platforms.