Tip 7Improve Legacy Code
White Belt[​​White Belt] Maintaining and improving legacy code is a day-one reality.

Your job would (seemingly) be a lot easier if you could simply take all the crappy old code floating around, trash it, and start over. But that’s not going to happen, so what do you do about it?

The typical Godzilla legacy code base looks something like this:

  • Functions spanning thousands of lines, with a near-infinite number of possible code paths.

  • Classes or modules with dependencies on twenty (or more) other classes.

  • A comment somewhere reads, “Don’t touch this or everything will break!”

  • Another comment reads, “Ask Bob before changing ...

Get New Programmer's Survival Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.