5 Tips to Easily Get Familiarize With Any Codebase
No more stress or anxiety on your first day at work, code reviews and open source contributions!
Whether you are starting a new job or contributing to an open source project, there are times when you will need to quickly ramp up and get familiar with a large code base. In this article, let's discuss some tips to get started with becoming familiar with any code base easily.
1. Understand the Business
Before even jumping into the codebase, I recommend understanding the 'macros' aka the business behind the product you're going to be responsible for. No need to understand every single intricacies about the company, but at least information around these few points:
- Understand the value the company is giving to its customers
- Know what software are currently in development (and which one you're likely to be working on)
- Know the business context of the app, the purpose it serves for the company
- Understand what the end product is supposed to do for the company or customers
This will allow you to get a bigger picture of your role as the engineer and better grasp of the areas you would need to focus on when starting this new job.
2. Dive into Docs
Another tip is to read the docs provided by the development team. Learn what technologies are being used and how the code is organized. This can help you get familiar with navigating around the codebase quicker.
Also, if there are any, read internal docs or guides, search through shared folders or "getting started" slides written by the team.
Read and find conversations in the repository or team communication channels that could help you get a rough idea on where to get started. Of course, feel free to communicate to team members, ask them any questions on the codebase.
The goal is to get a clearer picture of the architecture and process flow of the software.
3. Focus on 1 thing at a time
Once you learned and understand the overall architecture, flow and goal of the software, it is time to focus on the details. To prevent getting overwhelmed and lost in the mountain of code, I recommend focusing on a just 1 part of the codebase first, understand it, then move on to the next one.
To do this, you can start by dissecting and looking at some core components and classes that makes up the app such as its API endpoints, authentication, database functions, etc.
Alternatively, start with a feature or an aspect of the software you would like to explore. For example, you want to find out how the login process works for the app, then you need to start getting familiar with where you can find the code for this feature.
Once you figured out the 'where', you can start trying to understand the code itself for this particular feature. Trace any entry points of the feature, such as an API endpoint or a function, then see where it leads to.
By tracing the overall flow of the 1 feature at a time, you are slowly painting a detailed picture of not only how the feature itself work, but also how it connects with other components of the software. Gradually, you can move on to other features or components to fill in the puzzle. The codebase will no longer be a huge unknown black box anymore.
4. Look at Tests and Functions
It gets confusing and overwhelming to browse each file and read each line of code without any specific direction or order.
Sometimes, I find that looking at the tests is a quick way to browse the code because it tells you what the code is expected to do, and not in an overwhelming manner. In addition to reading tests, you can also try running and testing with them if that is easier for you.
Automation tests can be a good start to figure out the expected process of the software's functionalities. From there, unit and integration tests are helpful to further explore the codebase and help discover some functions you would like to read more about.
And naturally, you will start reading about the functions, understanding what they do and how it works, its role in the overall software, how it connects to other components, etc. Eventually, you will collect all the information you need to understand and navigate the codebase.
If the previous tip or this one is not your cup of tea, let's move on to tip 5.
5. Find a bug or issue
Instead of trying to understand every code, it is sometimes easier to start with a task in mind. For example, try to work on a bug or an issue first before exploring the codebase deeper.
This will get you comfortable working on at least a small part of the app and as you discover and find more issues to work on, you will naturally be familiarizing yourself with a new area of the code. This natural approach is not only effective in understanding codebases easily, but also make you feel like you are already contributing from day 1.
Gradually, aim to explore and play around with the different components of the codebase. It is almost like a divide and conquer strategy, and a lot of developers use this method to get familiar with a large codebase without too much pressure.
And So...
That's it folks! Here are some of the tips I have to help you get started familiarizing yourself with any codebase. I hope it is helpful in some way. If it is, do leave a like and share this article.
I'm sure any developers, especially ones with more experience, have their own know-hows as well. So feel free to suggest more in the comments below. Thanks so much for reading! Cheers!