Visualising software architecture with the C4 model - Simon Brown, Agile on the Beach 2019

Share

Summary

Simon Brown introduces the C4 model for visualizing software architecture, emphasizing clear communication over complex notation. He discusses the problems with current diagramming practices and proposes a structured approach using four levels of abstraction: Context, Containers, Components, and Code. The talk highlights the importance of providing sufficient detail through text and consistent notation for effective communication to diverse audiences.

Highlights

The Problem with Current Software Architecture Diagrams
00:00:00

Simon Brown discusses the common issues with software architecture diagrams, noting that many people avoid UML due to its complexity and perceived irrelevance in agile environments. He points out that free-form whiteboard drawings often lack clarity and consistency, leading to ineffective communication. Examples of confusing and uninformative diagrams are shown, illustrating the failure to convey meaningful architectural information.

The Need for a More Engineering-Like Approach
00:04:31

Brown argues for a more structured, engineering-like approach to diagramming, contrasting it with the 'artistic' approach often taken. He emphasizes that clear communication is crucial for team velocity and shared understanding, especially for diverse audiences beyond just developers. He advises thinking like a developer, not an architect, to create diagrams that reflect reality and are easily understood by those implementing the code.

Abstractions Over Notation: The Map Analogy
00:06:54

The speaker stresses that the abstractions (the 'things' being diagrammed) are more important than the specific notation. He uses a map analogy: different maps may use different symbols but convey the same fundamental information if a key is provided. This leads to the idea of clear abstractions as the foundation, with notation being secondary but supported by a legend.

Introducing the C4 Model Levels
00:07:59

Brown introduces the C4 model, standing for Context, Containers, Components, and Code, which provides four levels of abstraction for describing software architecture. He clarifies the definition of 'container' (an application or data store that needs to be deployed) and 'component' (a grouping of code within a container). The C4 model offers a hierarchy for understanding a system at different levels of detail, similar to zooming in and out on a map.

Level 1: System Context Diagram
00:11:31

The first level is the System Context diagram, which shows the system under development, its users, and other interacting systems. An example of an internet banking system is used, illustrating how to depict the banking system, its users, a mainframe banking system, and an email system. This diagram provides a high-level overview suitable for a wide range of audiences.

Level 2: Container Diagram
00:13:40

The second level is the Container diagram, which zooms into the system to show deployable applications and data stores (containers), their technologies, and how they interact at runtime. The internet banking example is expanded to include a web application, a single-page application, a mobile app, an API application, and a database, demonstrating inter-process communication.

Level 3: Component Diagram
00:16:47

The third level is the Component diagram, which delves inside a container to show its internal structure, specifically the components (groupings of code) and their interactions. For the internet banking system's API application, components like a sign-in controller, security component, accounts summary controller, and mainframe banking system façade are depicted, aligning with the actual code structure.

Level 4: Code Diagram (and why to avoid it)
00:19:16

The final level is the Code diagram, which shows the internal structure of a component (e.g., classes and interfaces). Brown strongly advises against manually creating Level 4 diagrams, as they are often not worth the effort and can usually be generated automatically by IDEs, stating that 99% of situations don't require drawing them manually.

Notation Tips: Titles, Layout, Acronyms, and Textual Detail
00:20:17

Brown provides practical tips for effective notation: always title diagrams clearly with type and scope, use sticky notes for iterative layout, maintain visual consistency across diagram levels, and be cautious with acronyms (focus on domain-specific ones). He emphasizes adding sufficient descriptive text within boxes to make diagrams self-explanatory, contrasting this with vague, unlabeled boxes that require verbal explanation.

Notation Tips: Lines, Direction, and Clarity
00:24:54

For lines (relationships), unidirectional arrows are preferred, with a clear description of the interaction (e.g., 'calls', 'depends on'). While most relationships are bidirectional, it's better to summarize the intent in one arrow to avoid clutter, unless the two directions have fundamentally different natures. Explicitly stating what the arrow represents (e.g., 'makes API calls using') dramatically improves clarity.

Notation Tips: Keys, Colors, and Icons
00:28:22

Every set of diagrams should include a consistent key or legend to explain shapes, colors, line styles, and icons. This ensures that even seemingly obvious visual cues are understood by all. Brown advises using shape and color to complement, not solely convey, information. Icons can add an extra layer of information, but the diagram should still make sense if colors and icons are removed, relying on the textual descriptions for fundamental understanding. The goal is for diagrams to be self-standing, reducing the need for constant verbal explanation.

Tooling Recommendations
00:33:40

Brown recommends avoiding general-purpose diagramming tools like Visio, OmniGraffle, and Gliffy, as they lack software architecture-specific knowledge. Instead, he suggests tools like C4-PlantUML, which use text-based definitions to automatically generate diagrams, or his own dedicated C4 model tooling. The key takeaway for tooling is to prioritize abstractions first, then notation, ensuring everyone understands the four levels of the C4 model.

Recently Summarized Articles

Loading...