Design · lesson 9 of 10
Ideas in this lesson
ADesign documentcontext, goals, non-goals, the design, alternatives
BADRone decision, its context, its consequences
CDesign reviewothers read it before code is written

Writing decisions down

Last updated

Six months from now, someone will ask why Pila uses text messages instead of an app. If the answer is only in the heads of the people at that meeting, the team will argue it all over again, or worse, undo it without knowing why it was made. In this lesson you'll write a short design document and an architecture decision record, the one-page note that keeps a decision and its reasons together.

By the end of this lesson you can

  • Say what a design document contains, including goals, non-goals and alternatives
  • Write an architecture decision record with its context and consequences
  • Explain why the reasons for a decision matter as much as the decision

The design document

Before building something significant, many teams write a short design document and ask others to read it. A common shape:

What a design document contains
SectionAnswers
ContextWhat problem, for whom, and what exists today
GoalsWhat this design must achieve, with the requirements it meets
Non-goalsWhat it deliberately won’t do, so nobody assumes it will
The designThe diagrams (lesson 4.4), the data (4.5), the API (4.6), and how they meet the goals
Alternatives consideredOther designs, and why not them
Risks and open questionsWhat could go wrong, and what isn’t decided yet

Then a design review: people who didn't write it read it, ask questions and look for holes, before code exists and while changes are cheap. Jun reads for "can I run this?", Rina for "can I test this?", Ate Cora for "is this what we need?".

One decision, one page

A design document describes a design at one moment. Decisions keep being made after it's written, and each needs its reasons kept with it. In 2011 Michael Nygard proposed the architecture decision record (ADR): one short file per significant decision, kept with the code, never edited after it's accepted. If a decision changes, a new ADR supersedes the old one, so the history stays.

Nygard's ADR has five parts: a title, a status (proposed, accepted, superseded), the context (the forces at play), the decision ("We will…"), and the consequences, good and bad. Many teams add the alternatives considered. The architecture standard, ISO/IEC/IEEE 42010, likewise expects an architecture description to record its decisions and their rationale.

Six months later, with and without

  1. March In a long meeting, the team chooses texts over an app. Everyone agrees. Nobody writes down why.
  2. September A new developer joins. “Why don’t we have an app? Everyone has smartphones.”
  3. September Nobody remembers the numbers from the morning at the centre. Two people think it was about cost; one thinks it was the deadline.
  4. October Kap. Ernesto hears there’s talk of an app, and asks for one by December.
  5. October Two weeks of meetings re-argue March. Rina goes back to the centre to count phones again.

Without a decision record: The decision survived, but its reasons left with the people. The team spent two weeks arguing what it had already settled.

Switch to the other side to compare.

Write an ADR: SMS or an app?

Write ADR-001 for Pila. The checks look for the parts Nygard asks for; compare each with the team's version.

ADR-001Kept in this browser only
  • Says the decision in the title (not yet)
  • Gives a status (not yet)
  • Mentions the patients’ phones (not yet)
  • Mentions a cost or a budget (not yet)
  • At least two facts, on separate lines or sentences (not yet)
  • Starts with “We will” (not yet)
  • At least two alternatives (not yet)
  • Names something that gets harder or costs more (not yet)
  • Names something to watch or revisit (not yet)
Write each part until its checks pass.

Keep ADRs short enough to read in five minutes, in the repository (often docs/adr/0001-sms-not-app.md), and written when the decision is made, not reconstructed months later.

Spot the trap: no alternatives

Spot the trapMarco

Marco’s design document for the priority lane describes his design in detail. Under “Alternatives considered” he’s written: “None; this is the obvious way.”

What happens if…

Check what you learned

What happens to an ADR when the decision changes?
Why does an ADR’s “consequences” section include the bad consequences?
What is a design document’s “non-goals” section for?

Sources

Every claim on this page comes from these sources: the standard, the founding text of a method, a study, or the official record of a project, from the body that publishes it. Industry reports are labelled as such.

All sources for Simple Software Development