Why? I don't understand; twenty-thirty years ago, I was taught to provide visual high level schematics and structural documentation. The latter may be difficult, but surely some schematics with notes on intent cannot be too onerous to draw.
I suspect they aren’t used often because most programming is carpentry rather than engineering. Which isn’t intended as a slight… my life would be much less pleasant without furniture.
But there are also many projects which do. Sometimes you need to search a bit for it. Actually I would expect that most big projects have such documentation somewhere in some form.
- WebKit: https://github.com/WebKit/WebKit/blob/main/Introduction.md
- Chrome/Chromium: https://www.chromium.org/developers/how-tos/getting-around-t...
- PyTorch: https://github.com/pytorch/pytorch/blob/main/CONTRIBUTING.md...
- RETURNN (my own): https://returnn.readthedocs.io/en/latest/getting_started/tec...
- Mold: https://github.com/rui314/mold/blob/main/docs/design.md
And then for some popular projects you will also find some independent overviews:
- Quake: https://fabiensanglard.net/quake3/ (and many more on https://fabiensanglard.net/)
- Linux: https://tldp.org/LDP/khg/HyperNews/get/tour/tour.html
- CPython: https://realpython.com/cpython-source-code-guide/
- LLVM: https://blog.regehr.org/archives/1453
One problem is of course that those documents can be outdated and don't go into much details. But they still will give you important insights and should be a good starting point.
I don't find the kind of schematics you're asking for to be useful at all. When I do come across them, I see them as busy-work that people had to make to justify starting some project, or because it's a required artifact. But I never think "oh good, here's a useful thing".
Those are honestly my unconscious thoughts on these sorts of things. But I do realize, if I think about it consciously for a moment, that some people must find this sort of thing useful.
But it's just different strokes for different folks! What I want is a description of the goals of a piece of software - what should I expect to be able to do with this? - and an entry-point, and prose documentation on what each component of the code is and why it exists. But a visual birds eye view of what is connected to what is just not how I go about understanding things.
If you do have such a mess, you can't really get a good visual overview (it's approaching a complete graph), and you also can't get prose documentation of code components because there are no clear responsibilities.
I think people prefer different things because they prefer different things.
I think larger open-source projects are more likely to include schematics since they onboard more contributors. Niche projects, or projects with only a few core contributors, are less likely to spend time documenting high-level schematics.
On a tangential note, I also wish I had a better understanding of which files are hand-crafted and important to grok and which are just boilerplate that was autogenerated by a script or copy+pasted from some doc. There are a lot of files that are intimidating to look at, but if I talked to the developer who implemented it they might say "Oh you don't need to worry about that, you just need to include that as config for package X".
I'm in the middle of a huge legacy codebase and I keep asking two questions:
HOW was this working? WAS this working?
And as for the third opinion of "the documentation becomes out of date when the code changes", I would prefer slightly incorrect comments to decipher code rather than no comments to decipher code. Doubly so because I can compare the comments to historical revisions.
The intention of the code is much more resilient than the details, so comments should generally focus on the why.
(It’s also important to document the code that isn’t there: algorithms that were rejected due to performance, “obvious” enhancements that don’t actually achieve the intended effect, etc.)
Yes, I can tell what you're doing here, but is that what you're SUPPOSED to be doing?
But heck, I'm old and I've been reading other people's code for decades.