What if the codebase is a mess?

I was recently asked: “What if you start a new job and their codebase is a mess?”

We’ve all been there. Here are some of the tactics I’ve used.

  • Understand the nature of the mess. Bad design? Insufficient/no tests? Lots of bugs? Inconsistent style? Outdated dependencies? Getting more precise than “it’s a mess” can help you focus your efforts, feel less overwhelmed, and help others to see what you’re seeing.
  • Let go of small things. An absence of automated tests is a much bigger problem than bad variable names or inconsistent formatting. Pick your battles.
  • Figure out what leverage you have. An IC who is primarily expected to complete tickets doesn’t have the same levers to pull as a senior engineer who is also expected to be a technical leader. As an IC you’ll want to build alliances with more senior engineers and engineering managers. As a senior engineer, figure out how to sell the engineering organization on code improvement efforts.
  • Write tests. No matter what your role, the quality of the codebase can be raised by improving quality and quantity of tests. Every bug you fix, every feature you write, include tests.
  • Review code with an eye on quality. Don’t rubber-stamp. Ask people where their tests are. Ask them, “What if someone passes a null to this function?” Etc.
  • Share your thoughts and listen. Talk to your team lead, your manager, your senior peers — tell them the problems you see, ask them if they agree, ask them what strategies for improvement might be practical, given the culture of the organization and the constraints imposed by the business. Ask if you can make tickets for improvement work.
  • Make a long-term plan. Identify goals that will improve things, even if you don’t have the power to enact them yourself yet. Keep alert for opportunities to put them in motion.
  • Make your own code as good as it can be. This almost goes without saying, but is important. Walk your talk. Show people what you think good code is. And, with every merged PR, know that you’re making things a little better.

Comments


Share: