The Hasan Dispatch logo

The Hasan Dispatch

Archives
Log in
Subscribe
April 21, 2021

How I Learned to Read Other People's Code

Writing code is half the job. Reading code is the other half, and it's the half that senior engineers spend more time on. Here's how I got better at it.

#Career #Code Reading #Skills

The Skill Nobody Teaches

Most developer education focuses on writing code — tutorials, courses, and books all teach you how to build something from scratch. But the majority of a professional developer's time is spent reading code that someone else wrote, and that skill is almost never taught explicitly. You're expected to pick it up by doing it, which works eventually but is slow and frustrating, especially in the first few years when every unfamiliar codebase feels impenetrable. I spent my first two years feeling like I was bad at reading code, and it took a specific methodology — which I developed partially through trial and error and partially from watching senior engineers — to start doing it effectively.

The methodology is simple to describe and hard to practice: start at the entry point, follow the data flow, and don't try to understand everything at once. The entry point — main.tsx, App.jsx, index.ts, whatever the application uses — is where the structure becomes visible, because it's where all the top-level pieces are wired together. From there, follow the data: where does it originate, what transformations happen to it, where does it end up. Data flow is the skeleton of any application, and once you understand how data moves through it, every component's purpose becomes clearer because you can see what data it consumes and what it produces.

The Method

I keep a running document of open questions — things I encounter that I don't yet understand, rather than stopping to resolve every single one in the moment. This is the most important part of the method, because the temptation when reading unfamiliar code is to go down a rabbit hole every time you encounter something you don't understand, and that approach means you never build a coherent picture of the whole. By deferring the questions and continuing to read, you often find that later code answers earlier questions — a pattern that seemed inexplicable in isolation makes sense once you see how it's used three files later. After about a week of working in a new codebase, most of the open questions have answered themselves, and the ones that remain are genuinely worth interrupting a teammate to ask about.

The goal isn't to reach a state of knowing everything about the codebase before making a change. That's impossible in any codebase large enough to be worth working on, and the attempt leads to analysis paralysis. The goal is to reach a state of knowing enough about the relevant area to make a safe, well-reasoned change without introducing a regression somewhere you didn't think to check. That level of understanding is achievable in days, not weeks, if you read strategically rather than exhaustively, and it's the level of understanding that lets you contribute productively rather than just reading indefinitely.

What Changed

Before I developed this method, every new codebase felt like a wall of text I had to memorize before I could do anything. After, a new codebase felt like a map I could navigate — I didn't know every street, but I knew the major landmarks and could find my way to any specific area. That shift in feeling — from overwhelm to navigability — is the practical payoff of learning to read code well, and it's the skill that, more than any specific technology, has defined my growth from junior to senior. Senior engineers aren't senior because they know more syntax; they're senior because they can enter an unfamiliar codebase and become productive in it quickly, and that ability is almost entirely a function of reading skills.

The other thing that changed is that I started enjoying reading code. That sounds unlikely if you're currently in the "wall of text" phase, but good code — code written by someone who thought clearly about the problem — is genuinely pleasurable to read, the same way a well-written essay is. You see the decisions the author made, the trade-offs they considered, the elegance of the solution they arrived at. Reading good code is one of the best ways to become a better writer of code, because it exposes you to patterns and approaches you wouldn't have thought of yourself, and it builds a library of mental models you can draw from when you face similar problems.

Don't miss what's next. Subscribe to The Hasan Dispatch:
Share this email:
Share on LinkedIn
GitHub
🙃
LinkedIn
Powered by Buttondown, the easiest way to start and grow your newsletter.