How does one quickly understand a large code base and start contributing to it?

Mattias Petter Johansson
Fun Fun Function
Published in
2 min readNov 2, 2014

--

I’ve been in this situation many times in my career now and I’ve gotten pretty methodical about it. I’m actually doing this right now, today, getting familiar with the codebase of the Android Spotify client.

My method is very simple, but works reliably:

  1. Find a mentor
    Find a programmer already familiar with the code base, and ask them if they are willing to be interrupted a lot during the coming weeks to help answer your silly questions. If this is for an open source project, you might ask one of the maintainers politely if you can IM them questions. If it’s corporate software, it’s good if you can also arrange so that the project lead is aware of your relationship, so that they can of the pressure on your mentor, giving them bandwidth to help you.
  2. Get an overview
    Ask your mentor to give you a high-level overview of the system, it’s design philosophy, and style. If it uses third-party frameworks and libraries, try to compile a list of them — it really helps to study documentation and guides of these in isolation before exposing yourself to them entangled in a big system. It is also helpful if your mentor can explain how and why the system came to be, and what was before it, if anything.
  3. Find a mission
    Ask your mentor to assign you a task in the code base (fix a bug, add something) that they think would be managable by a beginner.
  4. Adhere to the don’t-get-stuck rule
    Sit down and try to fix the task on your own, and ask your “mentor” when (not if) you get stuck for more than 15–20 minutes. Always try (hard) on your own for a little while, but only for a little while. In my experience, you can figure most things out on your own in 15 minutes, but if you pass that, you most likely won’t figure it out in hours and hours. Don’t gloss over this paragraph — asking for help is suprisingly hard! When you get stuck, you have a tendency to try to stick to it and fix it yourself. I have a really hard time making myself do this, so I use a timer to keep myself accountable, such as BreakTime (http://breaktimeapp.com/).
  5. Code review
    When you have a fix, submit your code for review to by your mentor. They will point out changes that you can make to re-use parts of the code base instead of writing your own, and how to make your changes fit holistically with the project.
  6. Repeat
    Go to step 2.

That’s it. This process will get you familiar with a code base very quickly.

--

--

Mattias Petter Johansson
Fun Fun Function

Creator of Fun Fun Function, a YouTube show about programming.