Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 5 of 6 · Concept · 15 min · revision 1

Deciding what to document and for whom

Choose what goes into an architecture document by starting from its readers and their questions, keep it lean with a few arc42 sections, write by hand only what code and tools cannot produce, and trace quality goals to the design so reviewers can follow them.

Contentsand lesson path

What you will learn

  • Assemble a lean architecture document (for example arc42 sections) kept as code next to the system it describes.

01. Why it matters

Every page of documentation has two costs: the time to write it, and the time to keep it true for as long as it exists. A page that nobody reads still has the second cost, and a page that has gone stale is worse than no page, because people act on it. The arc42 FAQ puts it bluntly: do not fill in everything; document what your stakeholders need, and ask them what that is.

So the useful question is not "which template sections do we have?" but "who will read this, and what do they need to decide or do?". This lesson gives you a way to answer that question and to keep the answer small enough to maintain.

02. Start from readers and their questions

An international standard for architecture descriptions, ISO/IEC/IEEE 42010:2022, gives this idea precise words. A stakeholder is anyone with an interest in the system. A concern is a matter that is important to a stakeholder, such as cost, security or how to deploy. A viewpoint is a set of conventions for building one kind of view, and it frames particular concerns. A view applies a viewpoint to your system. In this skill, the C4 diagram types roughly play the role of viewpoints. Note what the standard does not do: it says what an architecture description should identify and how the parts relate, but it does not prescribe a method, a notation, a tool or a file format. It is not a design method, and "compliant" documentation can use C4, UML or plain prose.

In practice, list the readers and their questions before you write anything. For the ride-booking system it might look like this:

  • New developers: what are the parts, and where does my change go? The container view, the component view of the Booking API, and the runtime view of a ride request.
  • On-call engineers: what runs where, and what breaks when a part fails? The deployment views, plus links to runbooks and dashboards.
  • Security reviewers: where does personal data live, and where does it cross trust boundaries? The context view, the data stores in the container view and the payment flow. The skill Threat Modeling adds data-flow diagrams for this.
  • Product owners: what does the system depend on, and what are its quality goals? The context view and the goals section.

Two things fall out of the list. First, a handful of views serves everyone, because the same container view answers several questions. Second, a question that no part answers is a gap you have found before a reader hit it.

03. A lean arc42: twelve drawers, most of them small

arc42 is a free template that sorts architecture information into twelve sections: introduction and goals, constraints, context and scope, solution strategy, building block view, runtime view, deployment view, crosscutting concepts, architectural decisions, quality requirements, risks and technical debt, and a glossary. Treat it as a set of drawers that tells everyone where a kind of information goes, not as a form to complete.

The arc42 FAQ says there is no general minimum, but suggests always covering a few things: three to five central quality requirements written as scenarios, the context with its external interfaces, a short solution strategy with the most important decisions, the first level of the building block view, and the most important crosscutting concepts. C4 fits into those drawers directly. The context diagram goes in context and scope, and the container and component diagrams are levels 1 and 2 of the building block view. Dynamic views belong in the runtime view, and deployment views in the deployment view. The lab in lesson 4 put its C4 views into these drawers (sections 3, 5, 6 and 7) and added the goals and one decision record. A real document would also add a short solution strategy and its key crosscutting concepts, and would write the quality goals as full scenarios.

05. Trace quality goals to the design

Reviewers often ask "how does this design meet goal X?". The answer is a trace: from the goal to the elements that carry it, the decision that explains it, and the test or monitor that checks it. (The lesson From fast and secure to testable scenarios shows how to write goals that can be checked.) If the goals live in a small file next to the model, a script can report broken traces, just as check_docs.py reports drift. Run this in the ride-docs folder from the lab, after ./check-docs.sh has produced build/workspace.json.

TOML · docs/architecture/quality.toml
# Quality goals from section 1, traced to the model, decisions and checks.

[[goal]]
id = "Q1"
text = "A rider sees a fare quote within 2 s for 95% of requests."
elements = ["Booking API", "Fare quoter", "Maps client"]
decisions = ["1"]
checks = ["load test: quote p95 under 2 s at 300 req/s, nightly"]

[[goal]]
id = "Q2"
text = "No trip is charged twice, even when a request is retried."
elements = ["Payment client", "Trip database"]
decisions = []
checks = ["test_capture_is_idempotent"]

[[goal]]
id = "Q3"
text = "A new developer runs the whole system locally in one hour."
elements = ["Developer laptop"]
decisions = []
checks = []
Python 3.12 · tools/trace_check.py
"""Report quality goals whose trace to the model, a decision or a check is broken."""
import json
import sys
import tomllib
from pathlib import Path


def model_index(workspace: dict) -> tuple[set[str], set[str]]:
    names, decisions = set(), set()
    stack = list(workspace["model"].get("people", []))
    stack += workspace["model"].get("softwareSystems", [])
    while stack:
        element = stack.pop()
        names.add(element["name"])
        stack += element.get("containers", []) + element.get("components", [])
        for decision in element.get("documentation", {}).get("decisions", []):
            decisions.add(decision["id"])
    return names, decisions


def main(workspace_json: str, goals_toml: str) -> int:
    workspace = json.loads(Path(workspace_json).read_text(encoding="utf-8"))
    goals = tomllib.loads(Path(goals_toml).read_text(encoding="utf-8"))["goal"]
    names, decisions = model_index(workspace)
    gaps = 0
    for goal in goals:
        problems = [f"'{e}' is not in the model" for e in goal["elements"]
                    if e not in names]
        problems += [f"decision {d} does not exist" for d in goal["decisions"]
                     if d not in decisions]
        if not goal["decisions"]:
            problems.append("no decision explains how it is met")
        if not goal["checks"]:
            problems.append("nothing checks it")
        if problems:
            gaps += 1
            for problem in problems:
                print(f"{goal['id']} GAP: {problem}")
        else:
            print(f"{goal['id']} ok")
    print(f"{len(goals) - gaps} of {len(goals)} goals fully traced")
    return 1 if gaps else 0


if __name__ == "__main__":
    sys.exit(main(sys.argv[1], sys.argv[2]))
Terminal
python tools/trace_check.py build/workspace.json docs/architecture/quality.toml
Expected output (exit code 1)
Q1 ok
Q2 GAP: no decision explains how it is met
Q3 GAP: 'Developer laptop' is not in the model
Q3 GAP: no decision explains how it is met
Q3 GAP: nothing checks it
1 of 3 goals fully traced

Only Q1 is fully traced. Q2, "no trip is charged twice", has a test but no decision. Somebody must decide how retries stay safe, for example with an idempotency key sent to the payment provider, and that decision deserves a record. Q3 names "Developer laptop", which is not in the model. Either add a development deployment environment to the model, or admit that nobody has designed for this goal yet. Nothing checks it either, and an unchecked goal is a wish.

The script took a few minutes to write, and it turns a reviewer's question into a list of concrete gaps. That is what a lean document is for: a small amount of hand-written text that tells you where to look, with the tools proving the rest.

06. Check your understanding

Practice check · 3 questions

Choosing what to document

Decide where information belongs and what makes it useful.

Q1. A new developer asks why ride matching runs in a separate dispatch worker instead of inside the Booking API. Where should the answer live so that it stays easy to find and true?
Q2. Quality goal Q1 says a rider sees a fare quote within 2 seconds for 95% of requests. Which record lets a reviewer follow how the design meets it?
Q3. A colleague says your architecture document cannot conform to ISO/IEC/IEEE 42010 because it uses C4 and Mermaid instead of UML. Which statement about the standard is accurate?
Practice only: not graded, not saved, not evidence.

07. Apply it

Write a one-page documentation plan for the system you modelled in the lab, and keep it in the repository next to the model:

  1. List three to five reader groups and the two most important questions of each.
  2. For each question, name the section or view that answers it, or mark it as a gap.
  3. Mark each part as written by hand, generated or linked, and give each hand-written part an owner.
  4. Add a quality.toml for your top three quality goals and run trace_check.py on it. Close at least one gap it reports.

08. Review prompt

Without looking back: explain stakeholder, concern, viewpoint and view in one sentence each, and say what ISO/IEC/IEEE 42010 does not prescribe. Name the parts of an arc42 document that the arc42 FAQ suggests covering first, and where each C4 diagram fits. Then give one example each of information you would write by hand, generate and link.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

6 questions · about 5 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check