How To Understand A Big Codebase?

How To Understand A Big Codebase?


4 min read

Play this article

Open source is taking over the world! You want to start contributing as well but get stuck because of one hurdle. The dreaded CODEBASE ๐Ÿ˜ฑ. Yes, it's a nightmare when you feel like you need to go through hundreds of files and folders just to make a small contribution. But I will break some myths here regarding it and I hope with this article you never have to fear a big codebase ever again.

But first, let's create a scenario:

  1. You are familiar with the project's goal.

  2. You have used it yourself.

  3. You know the tech stack used in the project, at least partially.

  4. You got assigned an issue to work with.

  5. You want to raise a PR soon so you start looking into the codebase...

Let's take the LinkFree project by EddieHubCommunity as an example.

1๏ธโƒฃ You don't have to understand each line of code โ›”

If you're looking to contribute to a project, it's common to feel overwhelmed by the codebase. However, you don't need to understand every single line of code to make meaningful contributions.

Focusing solely on the code relevant to the issue you're trying to solve will save you time and energy. Trying to understand everything can be demotivating and may deter you from contributing altogether.

Additionally, it's important to keep in mind that there may be other technologies at play in the project that you're not familiar with, making it even more challenging to understand every line of code.

2๏ธโƒฃ Look at the codebase from a broader aspect ๐ŸŒฒ

Understanding the structure of a project is crucial, even if you are not familiar with every line of code. A broad overview of the project's architecture can help you comprehend how its components are connected and functioning in unison. With this understanding, you can make changes to the codebase wisely and promptly fix errors while anticipating how other areas of the application will be affected.

In the below example for the LinkFree project, you can see that the source code is well-structured and thus helps us to understand which file is in which directory so that while making any code changes we can find the source easily. It creates a clear picture of the project's architecture in our heads.

3๏ธโƒฃ Don't ignore the docs ๐Ÿ“„

If you're looking to gain valuable insights into a project's structure and key functionalities without having to do everything yourself, then reading the documentation can be incredibly useful. This approach is widely followed by many people. By taking the time to carefully read through the project's documentation, you can gain a deeper understanding of its inner workings and potentially save yourself a lot of time and effort. So, whether you're a seasoned developer or just starting, be sure not to overlook the importance of properly reviewing project documentation.

4๏ธโƒฃ Ask, don't assume โ‰

If you're grappling with complex coding issues and feel clueless about how everything works, don't hesitate to seek help from the maintainers or fellow contributors. Not only does it save time, but it also enhances your understanding of the code. It's best to avoid making assumptions and reaching conclusions on your own, as this can lead to significant problems. Reaching out to experienced individuals can not only help you solve the issue at hand, but it can also give you valuable insights into how to tackle similar problems in the future. Therefore, asking for assistance when needed is a wise and beneficial move.

5๏ธโƒฃ Think less, do more! ๐Ÿ‘ฉโ€๐Ÿ’ป

To gain a deeper understanding of a complex codebase, it is crucial to play around with the code as much as possible. Breaking the code and analyzing the impact of each line on the application is the best way to learn. Through this hands-on approach, you can gradually become more familiar with the system and make valuable contributions to the project. Start experimenting today and enhance your knowledge of software development. This is truly the best way to understand a big codebase.

Now keeping all the above points in mind you can start looking into the codebase with much more confidence and can find the source of errors in the code with much ease.

I hope with this article your unreasonable fear of the codebase went away since there is nothing to worry about. You can start contributing today to your favourite project and embark on your open-source journey. Happy coding :) ๐Ÿ’—