12.18.19

Working on an Existing Codebase

By Colin Zweers

Starting a new project can be overwhelming. This is especially true if you’re coming in without the benefit of background knowledge on the project and have a lot to catch up on. As we all know, requirements expand through a project’s lifecycle and while there are multiple aspects to being put on a project, let’s focus on working with the codebase.

Ready for some helpful, hands-on advice?

How to Prepare Your Project

All projects should have documentation explaining the purpose and implementation of the application, to include any features that have been added to mitigate risk. Before jumping head first into the code, take the time to thoroughly examine the documentation. This will allow you to understand the reasoning behind the changes or additions you are tasked with implementing.

A useful exercise to help you prepare for working with the code is to sketch out the architecture at a high-level. You can do this by referring to the documentation and the codebase to help you construct the diagrams. Because it will help you understand the different pieces involved, this is especially useful for the application as a whole and applies to individual features you might be working on as well. Learning how the various components communicate and interact with each other will make your job much easier.

How to Begin

Now that you have a clear vision of what you’re working on and are familiar with all of the pieces involved, it is time to start working with the code.

I find it’s best to start small. Make a change and test/debug it right away to confirm the change had the desired effect. There is nothing worse than adding a lengthy chunk of functionality only to find that you had a logic error a few lines in that causes the whole addition to be rethought. Personally, I like to print the item I am working on to the console as a quick and dirty way to ensure my changes are working as expected.

Working with the Code

Sometimes you find yourself deep in the belly of the beast working on a functionality that’s pulling data from all different parts of the application. It’s easy to get lost trying to see which data is being referenced and what’s sending it. At times like this, it’s best to take a step back, track where the data is coming from, what (if any) changes have been made to it, and figure out how you can manipulate it.

Tools to Help

Most modern integrated development environments (IDEs) have debugging tools that help you with developing and testing your code. Go to Definition allows you to quickly jump to the implementation of a method where you are shown how the data is manipulated. This comes in handy when you’re debugging and need to see what changes might have been made to the data you’re working with. One of my favorite tools is the Quick Info tool, it enables you to see what parameters a method is expecting when you hover your mouse over the method call and is a lot quicker then tracking down the method definition.

Working with Your Team

A huge benefit of being on a project is having teammates to help you through obstacles. When you start a new project, ask a teammate if they can go through the codebase and fill you in on any aspects they think you might have difficulty with. Having a supporting and helpful team is a huge benefit, so take full advantage and ask a lot of questions.

When you’re assigned to work on an existing project, there’s usually a learning curve and the process can be stressful. The only way to truly be comfortable and know the ins and outs of a project is to spend time working on it. If you take the steps to prepare, use the proper tools, and work with your team, working on an existing codebase will be smoother in no time.

CATEGORIES |
Team