Taro Logo
13

How to make the most working in a messy codebase?

Profile picture
Junior Software Engineer at Microsoft2 years ago

Some of my work involves coding in an old AngularJS codebase that has a lot of issues. Most files are 5-6k lines long, many of the functions are on v3() while v1 and v2 are left in there creating technical debt. We've already moved on to a rewrite of the application in React, leaving the AngularJS code a mess that no-one cares about.

How should I approach work that is assigned to me in this codebase? Get it done as fast as possible so I can get back to my "real meaningful work" in the React codebase, probably adding on more technical debt in the process? Take my time and try to make the most even if the code is worse and I might be learning anti-patterns? The AngularJS codebase will be deprecated and migrated away from in a year anyways so developers don't really care about refactoring or improving the code quality. I've been trying my best to essentially avoid work in the AngularJS codebase, but unfortunately I can't ignore it since 200 million+ users rely on it and oftentimes on-call issues crop up in it.

461
1

Discussion

(1 comment)
  • 14
    Profile picture
    Tech Lead @ Robinhood, Meta, Course Hero, PayPal
    2 years ago

    Get it done as fast as possible so I can get back to my "real meaningful work" in the React codebase, probably adding on more technical debt in the process?

    Honestly, I would probably do this given the high possibility of migration (it's throwaway code at this point). However, I would figure out how set-in-stone this migration is (talk to your manager/tech lead). I have seen so many scenarios (especially in giant tech companies like Microsoft) where everyone says they're going to finally fully deprecate/migrate off something and it continues surviving for like 5 years.

    If there's a decent chance this legacy codebase still stick around longer (>1 year), I would try doing minor clean-ups here and there where you can. Just naturally incorporating this polish as you're doing feature work/bug fixes makes it a very minimal drain of your time (you were already digging into the codebase anyways), and I've done this a lot myself and encouraged all my mentees to do this. This behavior is also generally rewarded on good teams, and I've seen it be a huge selling point getting junior engineers promoted to mid-level. Some ideas on "quick fixes" that generally take <15 minutes:

    • Splitting up a giant file into several smaller ones
    • Renaming variables/methods with terrible names
    • Moving duplicate code into common utility methods

    Zooming out, aligning on where this codebase truly stands seems like an important thing for your team to do. At the end of the day, this codebase does serve a ton of users and a year is a long time - Any improvement will have some impact. The main thing to figure out is how clear the plan to fully move off of it is. There's 2 options here:

    1. Everyone just kind of assumed the plan was there (but it's not) - In this case, flesh out the plan!
    2. The plan's there and crystal clear - Awesome, everyone can go back to safely deprioritizing the health of this codebase.

    If #1 is the case, you'll get good credit for bringing it up as well. You'll be surprised at how much impact you can get, especially in Big Tech, just pointing at some giant vague, messy thing and saying, "Wait, do we actually know what we're doing here?"

    I also recommend these resources:

Microsoft is an American technology corporation which produces computer software, consumer electronics, and personal computers. It developed the Windows line of operating systems, the Microsoft Office suite, and the Internet Explorer and Edge web browsers. Microsoft is often credited for ushering in the modern PC era.
Microsoft42 questions