I have had the opportunity to join a team where I had to get into an existing codebase. It can be difficult and stressful sometimes regardless of how much experience or expertise you have.
You might want to get up to speed in a very short time and start implementing features but without a solid understanding of how the application works, it will be very difficult to make any reasonable progress. My goal in this writeup is to outline and discuss some tricks that can help you get familiar with a new codebase without wasting time and also help you maintain a codebase such that a new developer will be able to pick it up.
1. Use the App as an End-User
I realized having worked on some applications that the easiest way to get familiar with an existing system is not to start with the code. I take out to run the app in production and test the whole functionality of the app from the ground up. Spending quality time understanding the business and use case before diving into the application helps me have the right frame of mind before diving into the code. This gives me an overview by answering the question of what the application functionalities are and answering the important questions of what the app does. This will help you on what to look out for when you get into the codebase as you start working on new features.
2. Understand the Architecture the system was built upon.
The underlying structure that every engineer will build an application on is defined as an application architecture. This forms the foundation for the tool and technique that defines the design and functionality of the app at a high level. Every time I get into a new system, I ask questions about the architectural patterns of the system such as MVC, MVVM, MVP or whichever was used in the application. I try to familiarize myself with the app architecture by studying how a simple feature was implemented using the underlying architecture from data endpoint down to user interaction.
3. Study the code, documentation and Ask Questions
I spend some quality time reading the code documentation that comes with the codebase. This provides insight on code organization, technologies used, folder structure, the external framework used and how to move from modules to modules. Study documents and references can give deep insight which will, in turn, help you see areas that need refactoring and improvements in the codebase.
The reason for spending time reading documents is to also have you ask relevant questions per time and not to bore your team with irrelevant questions.
4. Fix bugs and debug code
Many times, you might not understand the complete code base within the first few months depending on the size of the codebase. Rather than trying to understand how every features works, you can start by having a simple task of fixing a bug or issue even before diving deeper into the codebase.
This method not only helps you understand the system incrementally but helps you to start contributing early enough.
For parts of the codebase that look difficult to grasp, I spend some time breaking it up into methods until it is easy to understand. Refactoring can be of great help in understanding different modules in the codebase without fear of wasting time.
I will advise that you can write some part of the codebase that you have a grasp of, especially in cases where there is a persistent bug that seems to be recurring.
Advice From senior Engineers
From experience, it takes time to learn the different components of a codebase, especially ones that are large and complex. Learning comes from working on different features or components, reading documentation, and asking lots of questions.
I agree with picking one bug to fix and just focusing on fixing that. Without this focus, I got overwhelmed by the sheer amount of things to learn (back when I was in the same situation, just joined a new company).
Get a 10,000-foot overview of the codebase from your mentor: what products the projects or solutions correspond to, any external dependencies on 3rd party libs or apps, a high-level dependency tree, what projects are most relevant to you at this time. Your mentor can hopefully point you in the right direction.
Final Note
These techniques can be used by trying to study a feature on the exciting app and making some minor changes a step at a time.
Being a developer can be challenging considering how much of things you need to master, that is why it is of great need to maintain a clean and well-documented codebase so that it can be easy for another developer to transit smoothly into the project.
I use these tips and it helps me a lot. I hope you found this writeup useful and will help you in diving into an existing new codebase easier.
“I’m not a great programmer; I’m just a good programmer with great habits.” — Kent Beck
Reference
https://amberwilson.co.uk/blog/how-to-approach-a-new-codebase
Top comments (0)