In the first days on an unfamiliar codebase, I don't read code at random. Here is the order I work in.
1. I walk through it, I don't read it. I start from a feature I can run, and follow it end to end: the route, the controller, the model, the query, the render. One full walk-through teaches more than ten files skimmed.
2. I look for where the code hurts, in the history. The most-changed files are often the ones the team avoids touching. That's where a lot of business rules, and bugs, live:
git log --format=format: --name-only | grep -v '^$' | sort | uniq -c | sort -rn | head -20 3. I look at what protects the application. The tests that still pass, how it's deployed, a reliable test environment, error monitoring. You only fix well what you can see.
4. My first contribution is small. A small pull request validates everything else: that I understood the conventions, that I can run the tests, that deployment goes through. Larger topics come after.
5. I don't rewrite what I don't understand yet. A strange line often has a reason that isn't in the code anymore, but in someone's head. I ask before deleting.
Then I move in small batches: each change goes out as a tested, reviewed, deployed pull request. The application keeps improving without ever ceasing to be shippable.
Amine Affif, full-stack developer in Paris. amineaffif.com
