How to get familiar with new codebase quickly!
Whether you are starting a new job or making an open-source contribution, one question that you might always ask yourself is How do I understand this new codebase? How do I get started? Where I should start making changes? So today, let's find that out together!
Understanding the documentation
Almost every codebase whether it's from an organization or an open-source, has some kind of documentation (if not the best) about their codebase. Going through this documentation will give you at least the basic idea about how to set up the project locally, what is the structure of the project, information about whom and how to reach out if you run into any issues, useful links, etc. Understanding the documentation will clear some of your thoughts regarding the project (if not all). In most cases, the documentation is just a simple markdown file or some external text-based, static site. So it's easy to read and understand.
Setting up the project locally
This is a mandatory thing that you'll do (or should do if not). You can simply clone the project locally using version control like Git or just download the code from wherever it's hosted. This will help you to be able to go through the code easily by using any code editor/IDE of your choice. You can also refer to the project documentation to know how to run and build the project locally on your system.
Learning the tech stack
This is an important step to succeed with any codebase, Once you get to know about the project's stack you can start reading online/books about the technologies included. Most of the time referring to the official documentation of the library will give you the idea from very basic to complex APIs. You can also look for Video Tutorials on the internet or enroll in a course (free/paid). This will make you more familiar with and confident about understanding the technologies and their underlying APIs.
Experimenting with the tech stack
Most of the time the project is going to contain multiple core or third-party libraries and there may be a complex integration between them. Hence, sometimes it might feel overwhelming to you to understand it in the first place. To understand how different libraries are working and overlapping with each other, you can create a separate project locally that will include all these technologies and try to build something simple with it. As an example, Let's say the project is using React, TypeScript, Redux/Redux-Toolkit, and maybe Axios for data fetching and styled-components for styling. Now, you can spin a react app locally, install all these external libraries, and build a simple app, Maybe a to-do list app 😀. This will not just make you familiar with the APIs that these libraries provide but also help you understand the integration between these to get the most out of their integration.
Digging through the entry points
After setting up the project locally and getting some amount of knowledge regarding the project's stack, you can finally start navigating through the code. The best or rather recommended way would be finding an entry point for the project. Let's say the project is built in React, so now you can start by understanding the root file and start understanding the root structure of the application. After this, you can go through the router setup, Authentication/Authorization setup, stylings, and so on. You can also start reading the code of the core components of the applications. This will show you how the whole application is tied together (well, I hope so! 🤞).
Picking up the First Task ASAP!
This is the most important step of this whole process and guess what my personal favourite as well 🤗. Now that you understand most of the stuff (again I'm hoping for this 😅), You can now finally start picking up some basic tasks of the project. The task can be, making some changes in the stylings changing some static content, or maybe fixing some simple bugs. Picking the tasks will help you to understand the codebase a little more and this will also boost your confidence as a developer. Here, I wanted to clarify that most of the time you might not feel ready to pick your first task and, it's normal in my opinion. Even I've faced this but as it's being said you never get 100% ready for anything so just pick up any smaller task and try to get it resolved ASAP! This will make you a bit more familiar with the project if not at all.
Asking for Help
This is a crucial step in this whole process. While doing the above things sometimes you might get some questions like why this thing is this way and not that and vice-versa. To get answers to your questions, In the case of an open-source project, you can join the official discussion forums, like Discord, Slack, GitHub discussions, etc., and get answers to your questions directly from the maintainers or other contributors. This will also build your teamwork and communication skills in the long term, so win-win situation here! In the case of working with an organization, you can always ask your colleagues and clear your thoughts.
Keeping notes
During this process of learning, you can also maintain your own notes that you can refer to later. You can also share them with others to get them reviewed and corrected if needed. You can also share it with other newbies just to make their life easier!
That's a wrap for today, I hope this will help you to make your experience with the new codebase a little bit easier and joyful!