4 ms·
In my programs there's usually a core insight or mental model that makes the code simple and straightforward to understand. What does someone need to have in t
by samsquire 3y ago
In my programs there's usually a core insight or mental model that makes the code simple and straightforward to understand.
What does someone need to have in their mind to understand this program?
Then time happens and then the code is adapted and refactored and more features are added, then the original gem of mental model is hidden by hundreds of files and the algorithm is split into 10s of files for the little bit of wisdom that makes the whole program understandable to be occluded.
This is why I like full code listing examples in documentation so much. A small self contained example - with import statements and instructions on how to build it if necessary and dependencies mentioned, I can get started extending the program to do something that I want.
Strangely, I find leetcode solutions or algorithms easier to understand than big enterprise systems or codebases where people do things the right way, because the core algorithm is right there and you cannot miss any detail.
I've enjoyed using OpenGrok a code indexer and viewer to turn any codebase into a wiki.
When I come to a new codebase, I have no clue how people have split up the code into many files.
The DWM codebase is fairly straightforward to read because it's all in one file.
https://dwm.suckless.org/ https://dwm.suckless.org/
I want to read about your code rather than the code itself if I can help it, I prefer reading documentation or deep dives or tutorials into code than a large github repository with hundreds of files.
I really liked the trend for a while in web frameworks where the code was side by side the documentation.