A beginners guide to diving into a codebase
Tags: beginners, codenewbie
Published: 2020-05-18 14:59:05

I wanted to write this guide because I was recently assigned to work on a feature on a codebase that had no documentation and no developers who had experience with the codebase (The developers that worked on the application are no longer at the company). This was a very daunting task for me as I am still a junior developer, but working on this project taught me a lot about diving into codebases and getting comfortable when you might not fully understand what is happening so I wanted to highlight what I learned, and some strategies that help me get up to speed. 

This guide is geared toward other newbies who will eventually have to dive into projects and need to quickly get a basic understanding of application they will be working on. Please also note that the recommendations provided below are strategies that work for me, and are not hard and fast rules to live by.

## 1. Read the README
This one probably seems fairly obvious to a lot of developers, but I still believe that it is worth mentioning. The README file is a file that lives at the top level of a project and it highlights the basic features of the application, project dependancies, basic usage, and installation.

Each time I dive into a new project, I begin by reading the README so that I can better understand the project, and more importantly, so that I can install it and get it working locally, which bring me to my next step.

## 2. Install the project locally
This is something that you will have to do eventually so that you are able to get set up with your local development environment. The README document should include steps on how to locally install/build/deploy the application. 

At times this can prove to be more challenging than copy and pasting a few CLI commands from the README file. You might find yourself with unexpected errors, dependencies issues, or maybe you are frustrated that it's just not working. Though I do encourage asking questions, there are somethings you can do before you turn to your lead. 

1. Review the error(s) to see if it provides a helpful message.
2. Review the README documentation to see if your error is highlighted in a "common issues" section.
3. Ensure that you have and perquisites already installed and working (Maybe you are working on a frontend application that requires the backend server to be running).
4. Ensure that your application versions are correct. (Maybe you are using an incorrect version of mySQL, Java, etc..)
5. Do some good ol' fashion googling and see if other people encountered similar issues based on the error message.

If you did encounter many issues while trying to get the application set up, take note of the items you had trouble with, and how you solved them. Maybe you can bring up these items with the team to include in the documentation so that the next person who attempts to install the application does not have the same issues you did.

## 3. Speak the language
When you first jump into a new codebase it can seem very daunting because you might not undetstand the syntax or conventions right away, but this is all stuff that comes with time so take a deep breath and jump in! When I dive into the codebase I like to do some simple checks to ensure I understand the very basics. I ask myself some of the following questions:

1. What language is this written in? (Maybe I can check the file extensions)
2. What framework is application using? (Is this React?)
3. What is the file structure like?


## 4. The fun part 🎉🎉🎉
At this point you have successfully got the application up and running and now you are ready to start poking around. This part is important for me because this lets me know that I can start making changes in my local environment and see them with my own eyes. I like to start by making a new branch and then I will change some basic things to make sure I understand some of the simple stuff.

If you are working on a frontend application, you can do things like: 
1. Change the text of a button.
2. Log some output when the button is being clicked (`Hello World` maybe?)
3. Change the styles of the button. (Make it Huge!!)

Doing these simple things will help you reinforce the idea that you can work on this larger application. These are all some simple things that I like do when working on a new project I have not touched before. I would love to hear what other strategies you might have when jumping into a new code base!