8 Techniques Which Help Me to (Really) Read Others' Code

Rebecca Tan
Level Up Coding
Published in
5 min readAug 6, 2020

--

It can be hard to navigate through lines of code and keep your sanity.

Photo by ThisisEngineering On Unsplash

There are many cases where you need to read others' code — maybe you are new to a job and you are handed over a codebase to digest before you get started. Maybe you are supposed to debug a component that was not developed by yourself. Maybe you are to add on a new feature to the current implementation.

You attempt to understand the code but you feel overwhelmed and intimidated.

Who’s to blame you because you are stepping into the mindspace of someone else?

But we all got to begin somewhere, and I’d like to share with you the techniques which helped me to digest someone else’s code.

1. Start With The Results

If this code is meant to be for a Frontend search component with a complex filtering system, start by truly understanding how the component works first from the user interface. Try different permutations to play around with the component — see how it reacts.

If this code is meant to be for a Backend API which returns different result formats for different parameters, start by finding valid parameters of different types and see how the API response differs with each input.

Note down the things that you want to find out regarding the implementation, having played around with it.

It may be a list of items, but focus on one thing at a time, don’t sidetrack — what’s the first thing you would like to examine?

The first thing you would like to examine the frontend could be the current behaviour where the first filter bar influences the next filter bar which influences the following filter bar.

The first thing you would like to examine on the backend could be the current behaviour where if I put items of this category, it returns me the nested subcategory but others, a flat subcategory.

Whatever the first thing you would like to examine is, you should be hungry to find out how it’s achieved.

2. Dive Into The Right Files With The Objective In Mind

--

--