Architecture Decision Records: 3 keys to success
Software architecture is an art of decision making. As the project grows over time, we need to correct and change our past choices. However, their consequences can be still seen many months later. Architecture Decision Records (ADR-s) help us recording and managing technical decisions. In recent years, I introduced ADR-s in two projects, and watched how other teams use them. In this article, I would like to show 3 key points for a successful adoption of ADR-s in your project, based on my personal experiences.
What is ADR?
Without going too deep into why we might need ADR-s, let’s just remind what this idea is about. A single architecture decision record basically notes down a single, important technical decision. It must include at least the following information:
- title, number and date: help us in managing records
- context: what happened that we need to make a decision?
- decision: the actual decision
- consequences: what this decision gives us (both positive and negative)
- alternatives: alternative options that were rejected
In addition to this, we must have a single place to store all ADR-s. It must be well-known and accessible to everyone in the project. We should also create a table of contents: a sortable list of all ADR-s that shows at least their number, date, and title. The ADR repository basically serves us as a decision log history, where we can look at any point in time. It allows us seeing all decisions made at different stages of the project, including the obsolete/withdrawn ones.
1st key: immutability
The key difference between an ADR and a technical documentation is that ADR-s are immutable. Once you create an ADR, you do not change it anymore. It’s like a commit in Git history. If you make a new decision that invalidates your previous choices, you simply write a new ADR, and just mark the previous one as “obsolete”.
In one of the projects, I saw that developers and architects frequently changed existing ADR-s. I asked them about this and one of the architects replied: “oh, we keep all ADR-s in Git anyway so if we want to look at the past state, we can just jump back to a previous commit”. Technically speaking, he was right. But also technically speaking, there are plenty of tools that record the history of changes. Should we call all documents created in them “decision records”? The ADR-s in that project did not differ much from a regular documentation, just they had worse navigation and structure of information.
Why immutability matters
The reason why immutability matters is that you don’t have to use any version control tool to jump to some old decision. You use ADR-s to quickly find all past decisions that affect you today. For example, you are debugging some code and you found some strange piece of code made by your teammate 2 years ago. A quick glimpse at the list of ADR-s with the magic Ctrl+F shortcut is often enough to find everything you need to know. Or maybe, the link to the ADR is in the user story description? When writing any document (even new ADR-s) you can easily link the older ADR-s without worrying than in the future, the link will become dead.
Getting used to immutability takes time. When the team uses ADR-s for the first time, developers often feel uncomfortable with it, and may feel that “making this change in this ADR is just right”. Pay attention to this and keep reminding them why immutability matters.
2nd key: context, decision, consequences
When I introduced architecture decision records in a greenfield project, I encouraged everyone in the team to write them. We were making many spikes, and we agreed to capture their outcomes in ADR-s. It was a good exercise for everyone, however we quickly ran into an unexpected issue. In the beginning of this article I listed the 4 main parts of every ADR: context, decision, consequences and alternatives. In theory, they are simple to understand. It turned out that in the first ADR-s, there were all sorts of mistakes: consequences landed in decision, decision in context, context in consequences, etc. Peer reviews were very useful here. We openly discussed the best location for each piece of information. As a result, we got to the common understanding over time.
Remember that you write ADR-s to the future you. Therefore, it not only matters what you record. It is also important how you do it. It is normal that at the beginning, developers might get confused how to document their decisions. Expressing our thoughts in a clean way is also an art, and ADR-s are a good way to improve our skills here.
By doing this exercise, your team learns to discover, name and understand context and consequences. It learns how to distinguish them from the actual decision, and how they all affect each other. This leads in turn to making better decisions. It starts paying off very quickly, so pay attention to this while introducing ADR-s to a new project. I strongly recommend doing peer reviews of ADR-s, especially with people who write them for the first time.
3rd key: editing tools
The last key thing in introducing architecture decision records is picking up the right editing tools for writing them. It may sound like a cosmetic issue, but tooling usability affects how much time we need to spend on writing ADR-s. This translates directly to the satisfaction of developers (or their frustration), and the success of the adoption. Pay attention to:
- formatting: it should be very easy to format the text. Visual editors are the best here.
- peer-review: other developers should be able to review it and leave comments.
- diagrams: in architecture decision records, you usually draw, not write code. Make sure you can easily create diagrams and add them to the ADR.
For me, a typical ADR is usually between 1 and 2 pages long, and it takes 15-30 minutes to write it. I consider it as a reasonable time, especially if I spend it on actual writing, not working with the tool. Over the last 2 years I used 3 different tools for writing ADR-s:
- spreadsheets: good for retroactively adding ADR-s for an ongoing project, but unfriendly in other aspects: peer reviewing, formatting, diagrams.
- Git + Markdown: reviews through normal pull requests. Formatting is acceptable, but we don’t see the results immediately, and adding and updating diagrams is challenging.
- online word processor: very easy to use. Modern word processors (Word Online, Google Docs) have collaboration features and can be easily integrated with diagramming tools. However we might want to keep just the list of ADR-s in a separate tool.
A wiki can be also a good choice, but some companies don’t offer any for employees or there are restrictions in using it (as in my case, this is why I don’t list it here). Currently I’m using the combination of online word processor and just the list of ADR-s stored on wiki and I’m happy with it.
The 3 key points shown above address the main 3 aspects of a successful adoption of architecture decision records:
- what makes ADR a true record, so that you don’t end up with creating a technical documentation with poor organization,
- how to write them, so that you will still understand them 2 years from now,
- where to write them, so that developers like it.
Note that ADR-s are not the only technique that I use to document the project. I also maintain a regular technical documentation, but thanks to ADR-s, it is much shorter, and thus easier to keep up-to-date.