What to do when you inherit codebase

2025-01-05

inherited codebase

(Image generated using ChatGPT)

In my 20+ years in IT industry, what has been constant is seeing software engineers and teams struggle with legacy or inherited codebase. I completely understand it is not easy when you have to handle legacy or inherited codebase.

 

This is what I hear from these teams all the time:

This is what I hear from clients:

 

Inheriting codebase is like moving into an old house

Working on a legacy / inherited software project is like moving into an old, unfamiliar house. The first thing to do is take a tour of the house to understand its layout—how many rooms there are, what they’re used for, and its overall structure. Similarly, you start by understanding what the software does and who uses it. Next, you make sure the utilities—like water, electricity, and gas—are connected and working, just like setting up the software on your machine and ensuring all its dependencies are in place. You might find old manuals, blueprints, or notes left by the previous owners, which can give you insights into why certain rooms were designed the way they are; in software, this corresponds to reading any available documentation or commit histories. Then, you test the appliances, like turning on lights and faucets, to see what works and what doesn’t—this is akin to running the application to observe its behavior.

As you explore the house further, you open cupboards, closets, and drawers, uncovering hidden or rarely used spaces, much like navigating the software’s code structure and identifying its key components. You focus on high-traffic areas, such as the kitchen, bathroom, or living room, because they’re used the most; in software, you prioritize critical features that are frequently used or prone to issues. Over time, you start repairing and renovating—fixing a leaky faucet here or replacing an old light fixture there—rather than trying to rebuild the entire house at once, which mirrors the approach of improving the codebase incrementally. Along the way, you talk to neighbors who know the house’s history, much like consulting senior developers or team members familiar with the software.

 

What you should do?

  1. Understand the Big Picture
  2. Set Up the Environment
  3. Explore Documentation
  4. Explore Tests
  5. Run the Application
  6. Understand the Code Structure
  7. Focus on Key Areas
  8. Refactor in Small Steps
  9. Learn From the Team
  10. Document What You Learn
  11. Tools and Resources

 

Understand the Big Picture

Zoom out and take a look at the system from 10,000 feet high.

Set Up the Environment

Take the plunge and download the code. You will become comfortable with it as you play with it locally on your machine.

Explore Documentation

Look for whatever documentation is available, even if it is outdated. If documentation is missing or outdated, note this for later improvement.

Explore Tests

Look for whatever tests as available. If none found then, note this for later improvement.

Run the Application

Best way to learn is to run the application and go through it. Do this for different personas of the system.

Understand the Code Structure

This is one of the most important aspect of handling legacy or inherited codebase. You should spend most of your time here.

Focus on Key Areas

Refactor in Small Steps

Learn From the Team

Document What You Learn

Tools and Resources

Make use of all the tools that are available and can help aid in your learning.

 

I hope these above steps will help you transition from a beginner in legacy or inherited codebase to an effective contributor of the codebase.