logoalt Hacker News

jeremyscanvic • yesterday at 10:52 PM • 1 reply • view on HN

Would you mind sharing some of the insights you gained on reading code? It could be useful for the more junior of us!


Replies

skydhash • today at 12:21 AM

Not GP, but the main thing is that there is always some conceptual model being a good codebase. Meaning there’s the problem, then a given set of data structures and algorithms that forms a solution for that model.

It’s often hidden behind the syntax and implementation because of the layers of abstraction. A single operation (semantic wise) may be scattered over many statements, and some definition may be important in several subconcepts. It helps to be familiar with various technical concepts as possible. basic data structures like lists and trees, more advanced concepts like scheduling and concurrency, as well as platform concepts like files, process, networking,…

Why? Because they are implementation details that distract from the main conceptual model. It’s like how OpenBSD handle device discovery and configuration. Once you know that it’s a tree, you just need to remember how you build a tree and then most of the code are obvious. You can then discern the traversal stuff from the actual device configuration easily and know how to focus your reading.