HACKER Q&A
📣 praneetbrar

How do you approach a new codebase?


When you need to contribute to a large unfamiliar codebase, what’s your process for building understanding quickly?

I’m interested in practical workflows that experienced engineers use.


  👤 runningmike Accepted Answer ✓
Assuming you have a c or cpp project: compile and build it first , run the tests if any.. and run cscope or equivalent on code you want to change first.

👤 davismwfl
I attack it pretty much the same regardless of language or project. Generally, I start with the product, see how it works, find the 3-4 most common workflows and get a handle on them.

Then I like to check out the database (or algorithms & data structures if no db) and see how data is stored and manipulated, usually tells you a lot about choices that have been made.

Then open the project(s) and trace those 3-4 workflows once I understand it from the top level workflows. Part of this is also of course, getting the project(s) loaded and building locally as needed also reviewing tests, CI/CD, dependencies etc.

Lately, I've used Claude Code to help me with this, have it build a function map or class map and have it breakdown key insights about the code and trace those few workflows for me that I then validate. My process is pretty much the same just Claude does a lot of the initial lifting. I'll also dump the entire DDL for most databases (if they are more then a few tables) and send it to Claude and use that as a way to look for patterns/issues etc. For older monolith apps I've had to break the DDL into chunks sometimes just because some of these older apps have a very large number of tables/indexes/constraints etc that have been added over the years. Same thing works for json stores too fwiw.