Skip to content

Engineering habits · Part 10 of 10

Learning a new codebase quickly

Run it, follow one request, read tests and history and make a small change early. A step-by-step approach for joining an unfamiliar project.

· 2 min read

engineeringlearning

Nobody reads a codebase top to bottom. You build a map by exploring with a goal, and the fastest way is to start from behaviour you can observe.

Get it running

Follow the README, run the application and the tests. Every obstacle you hit is also a gap in the documentation, which you can fix later as your first contribution. A working local setup lets you experiment, and experiments teach faster than reading.

Follow one thing end to end

Pick a single user action, such as "sign up" or "place an order", and trace it from the entry point to the database and back: the route, the controller or handler, the services it calls, the queries it makes, the response. One complete path gives you the vocabulary and the layers of the system.

Read the tests. Tests are executable examples of intended behaviour. A good test file tells you what a module is for and what edge cases matter. Run a test with a debugger or print statements to watch real data flow.

Use history.

shell
git log --oneline -- path/to/file    # how did this file evolve?
git blame path/to/file               # who changed this line, and in which commit?
git log -S "functionName" --oneline  # when was this name introduced or removed?

Commit messages and linked pull requests often explain the why that the code cannot.

Map the architecture. Sketch the main components and how they talk to each other: services, databases, queues, external APIs. Check the result with someone who knows the system. A single page diagram is a huge head start for the next newcomer too.

Make a small change early

Fix a minor bug or improve a message, and take it all the way through review and deployment. You learn the workflow, meet the conventions and build confidence.

Ask good questions

Before asking, say what you tried and what you expected. A specific question such as "this function returns null for inactive users, is that intended?" is quick to answer and shows respect for the other person's time.

Takeaway

Run it, trace one flow, read the tests and the history, draw a map and ship something small. Understanding follows activity.

A knowledge article, drafted with AI assistance and checked with automated tests. It is general background, not a description of my own experience or of any client's work.

Comments

Leave a comment

No account or email needed. Comments appear after review. A one-way hash of your IP address is kept for 30 days to fight spam, then erased.