|
| 1 | +logseq-entity:: [[Logseq/Entity/concept]] |
| 2 | +tags:: [[Diataxis/Concept]] |
| 3 | +alias:: [[C4 Model]] |
| 4 | +created-by:: [[Person/Simon Brown]] |
| 5 | +see-also:: [[Structurizr]], [[diagrams]], [[D2]], [[Diagram/Mermaid]] |
| 6 | + |
| 7 | +- # **[C4 model](https://c4model.com/)** |
| 8 | + - ## Official High Level Overview |
| 9 | + - The C4 model is an easy to learn, developer friendly approach to software architecture diagramming: |
| 10 | + - Hierarchical abstractions |
| 11 | + - [[C4/Abstraction]] |
| 12 | + - [[C4/Abstraction/1 - Software System]] |
| 13 | + - [[C4/Abstraction/2 - Container]] |
| 14 | + - [[C4/Abstraction/3 - Component]] |
| 15 | + - [[C4/Abstraction/4 - Code]] |
| 16 | + - Hierarchical diagrams (core) |
| 17 | + - [[C4/Diagram]] |
| 18 | + - [[C4/Diagram/1 - System context]] |
| 19 | + - [[C4/Diagram/2 - Containers]] |
| 20 | + - [[C4/Diagram/3 - Components]] |
| 21 | + - [[C4/Diagram/4 - Code]] |
| 22 | + - Supporting diagrams |
| 23 | + - [[C4/Diagram/System landscape]] |
| 24 | + - [[C4/Diagram/Dynamic]] |
| 25 | + - [[C4/Diagram/Deployment]] |
| 26 | + - [Notation independent](https://c4model.com/diagrams/notation). |
| 27 | + - [Tooling independent](https://c4model.com/tooling). |
| 28 | + - ## Context |
| 29 | + - Fits **team communication**, **onboarding**, **alignment with non-developers**, and **architecture-as-code** workflows (e.g. **[[Structurizr]]** DSL) where the same model drives **multiple consistent views**. |
| 30 | + - Sits alongside other diagram idioms: **[[Diagram/Mermaid]]**, **[[D2]]**, **[[diagrams]]** (Python), **PlantUML**, etc.—C4 answers **what to show at which scope**, not which renderer to use. |
| 31 | + - Complements **ADRs**, **threat modeling**, and **API catalogs**: C4 is primarily **structural** and **decomposition-oriented**, not a full security or runtime-behavior notation by itself. |
| 32 | + - ## Key principles |
| 33 | + - **1. Context** — The system as a **box** among **users** and **external systems**; answers *what does this software do for whom* and *what does it talk to*. |
| 34 | + - **2. Containers** — **Deployable/runnable things** (apps, databases, file stores, browsers, server processes) and **how they communicate**; answers *what are the major pieces that ship or run*. |
| 35 | + - **3. Components** — **Logical building blocks inside a single container** (services, modules, facades) and their relationships; answers *how is this container structured internally*. |
| 36 | + - **4. Code** — **Classes, interfaces, files, or modules** (UML-style detail is optional here); answers *how is a component implemented*—often **skipped** or **generated** when auto-layout or IDE views suffice. |
| 37 | + - **Notation discipline** — Prefer **simple shapes** (person, software system, container, component), **clear relationships** (sync/async, protocols where useful), and **explicit scope** so diagrams stay readable. |
| 38 | + - ## Mechanism |
| 39 | + - **Zooming in** adds detail **inside** a boundary drawn at the previous level: a **system** in context becomes a **container diagram**; a **container** becomes a **component diagram**. |
| 40 | + - **Supplementary views** (deployment, dynamic sequences) are **add-ons** when needed; the **core** model stays **structural** and **static** at each level. |
| 41 | + - **Tooling** can **validate** that elements exist at the right level and that **relationships** are consistent across views—this is where **architecture-as-code** shines. |
| 42 | + - ## Examples |
| 43 | + - **[[Structurizr]]** — DSL and exports aligned with C4 views (context, container, component, deployment, etc.). |
| 44 | + - **Diagrams-as-code** in [[Mermaid]] or [[PlantUML]] often **imitate** C4 levels even when not using a C4-specific toolchain—same **separation of concerns**, lighter enforcement. |
| 45 | + - ## Misconceptions |
| 46 | + - “C4 **is** four mandatory diagrams for every system” — **Overstated**; the levels are **lenses**. Teams routinely **omit** code-level C4 or **collapse** steps when the audience does not need them. |
| 47 | + - “C4 replaces **UML**” — **Misleading**; C4 **overlaps** some deployment/component ideas but aims at **communication defaults**, not full **behavioral** or **formal** modeling. |
| 48 | + - “If it’s not C4, it’s wrong” — **False**; many good architecture descriptions use **other** abstractions (DDD bounded contexts, data flows, threat surfaces). C4 is one **structured** option. |
0 commit comments