Description
Should be describing certain architectural decisions and giving a graphical overview.
One of the lessons I’ve learned is that the biggest difference between an occasional contributor and a core developer lies in the knowledge about the physical architecture of the project. Roughly, it takes 2x more time to write a patch if you are unfamiliar with the project, but it takes 10x more time to figure out where you should change the code. This difference might be hard to perceive if you’ve been working with the project for a while.
I find the ARCHITECTURE file to be a low-effort high-leverage way to bridge this gap. As the name suggests, this file should describe the high-level architecture of the project. Keep it short: every recurring contributor will have to read it. Additionally, the shorter it is, the less likely it will be invalidated by some future change. This is the main rule of thumb for ARCHITECTURE — only specify things that are unlikely to frequently change. Don’t try to keep it synchronized with code. Instead, revisit it a couple of times a year.
- bird’s eye overview of the problem being solved
- specify a more-or-less detailed codemap
- answers:
where’s the thing that does X?
- answers:
what does the thing that I am looking at do?
- A codemap is a map of a country, not an atlas of maps of its states.
- Use this as a chance to reflect on the project structure.
- Are the things you want to put near each other in the codemap adjacent when you run tree .?
- answers:
- describe coarse-grained modules and how they relate to each other
- avoid going into details of how each module works, pull this into separate documents or (better) inline documentation.
- Do name important files, modules, and types.
- Do not directly link them (links go stale).
- Instead, encourage the reader to use symbol search to find the mentioned entities by name. This doesn’t require maintenance and will help to discover related, similarly named things.
- Explicitly call-out architectural invariants. Often, important invariants are expressed as an absence of something, and it’s pretty hard to divine that from reading the code.
- Point out boundaries between layers and systems as well. A boundary implicitly contains information about the implementation of the system behind it. It even constrains all possible implementations.
- After finishing the codemap, add a separate section on cross-cutting concerns.
https://matklad.github.io/2021/02/06/ARCHITECTURE.md.html
Examples:
Metadata
Metadata
Assignees
Labels
Type
Projects
Status