C4

Table of Contents

1. Preface

Models are a fine way to illustrate complex structures like software architecture. With UML being as cumbersome as it is, many resort to having no unversal standard at all. C4 seems to be a leaner alternative, which doesn't impose much, but rather provides a philosophy for building such models. Something like this is quite nice to learn for bettering your grasp on common concepts.

2. Philosophy

2.1. Layers

Systems consist of four independent layers.

2.1.1. Context

A composition of containers, responsible for providing entry points into the system and orchestrating containers.

2.1.2. Container

Single deployable entity. As the name suggests, it contains - as in it's composed from non-deployable entities, capable of performing work in tandem. E.g. database, server or an application.

2.1.3. Component

A composition of atoms - a whole larger, than the sum of its parts. Arranges atoms into reusable clusters, united by goal and design. E.g. a library or a front-end.

2.1.4. Code

An atom, minimal unit of representation. E.g. a function, class or a hardware unit.

2.2. Layer relations

These relations seem to be the main focus of C4. Couple notes.

  • Layers are independent.

3. Tooling

Reference. Tooling is wide, including modelling tools, diagramming tools and DSLs. Most promising one appears to be structurizr DSL.

Also a whiteboard - modelers best friend.

4. Examples

Keep your head up. Rev: 0.1.20240131.b741ea0.