Documenting architecture decisions, the Reverb way
Ever make a decision in your codebase and then come back 6 months later and have no recollection of why the code is the way it is? I certainly have.
Enter the ADR — the Architecture Decision Record. For this idea, we traveled back in time to 2011 to find this blog post from Relevance,inc. I really loved the idea of storing decision docs right in the codebase, as we all know that there are lies, damned lies, and documentation and thought that keeping things like this in the code base might help prevent documentation drift.
Here are some of the key takeaways to make architecture decision docs really useful:
- Store ADR docs right in your codebase. We put ours in doc/architecture. Use markdown so they read nicely on github.
- Document decisions, not the state of things. Decisions inherently don’t need to be kept up to date. We say why we did something, and 6 months from now, our system might look different, but we now have a record of what we used to think and why we thought it.
- Include a TLDR section at the top that explains the decision in a few concise sections.
- Include a More Details section that gives more depth to the explanation.
- Include a Tags section in your ADR doc. These should be things like class names, function names, business concepts, etc. That way when you’re in your code and you’re grepping for a particular thing, you’ll “stumble upon” the doc.
- If appropriate, link to the ADR in code comments in the area where the ADR applies. If you link to the full path like “doc/architecture/ADR5-timezones.md” then vim’s ‘gf’ shortcut can jump you right to the doc from the code.Bonus: blog it publicly. We have blogged one of our ADRs about timezones and we’ll have another one on Grape coming out soon.
Stay tuned,
Yan Pritzker, CTO
@skwp