25 Good Things About Legacy Code

time to read 7 min | 1250 words

Maintaining legacy code is such a daunting task for many developers that I decided to highlight some of its upsides for a change. Here they are, in no particular order:

 

  1. Every piece of code is a surprise, and should be treated uniquely.
  2. Track how and when your predecessor learned new tricks of the trade. And then applied them everywhere.
  3. No more being shackled to a corporate coding standard, invent your own, or, better yet, just pick and choose based on what you ate this morning and the state of the moon. Let your inner hacker out.
  4. Delight in the opportunity to humble yourself staring for hours on a convoluted piece of code.
  5. Feel the joy of learning a business rule from six scattered files and misleading comments. Doesn’t the sense of accomplishment feel great?
  6. You thought that you needed a couple of years in university and a degree to learn how to do the business? Now you get the chance to learn it, and you get paid to do so. All you need to do is to look at the code; it will tell you everything you need (although sometimes in a foreign language, with a strong accent, using four letter words).
  7. This one I can guarantee, you will learn every trick in that area of computing; including some that the greybeards have forgotten.
  8. Pit your mind against the mind of the previous coder; it’s a struggle of will in the fight for understanding and achieving Zen.
  9. You’ll have the chance to view first hand the discovering of unknown, new and exciting design patterns.
  10. You’ll get to bask in the presence of old and venerable practices, such as the Scattered Responsibility, the Code Reuse Via Copy/Paste, the Write Your Own, etc.
  11. You get to program like a real programmer. Transactions, why do you need them? Real programmers write their own transaction systems on top of a database, and then they don’t use it because they handle it all in the business layer.
  12. You get to see the anti discrimination campaign that your predecessor has left. It’s an unfair treatment to code based on its task, and that has got to be covered by some law or something. Let’s take the poor mistreated database code out of the bowels of the application and put it right next to the UI, so it would feel better about itself.
  13. Watch how old problems are solved in new and exciting ways.
  14. You’ll get a sense of awe at the magnitude of the code when you’ll check the count of lines per method.
  15. Feel that warm feeling of a job well done; tracking a piece of code for hours, then discovering that it’s a dead branch.
  16. Express the need to assert yourself by making a change in multiply locations, several times.
  17. Truly understand the intricacies of the tools that you are working with.
  18. You learn to do tricks with numbers, like seeing 5323 and knowing deep in your bones that this is the count of vacation hours per employee per month report.
  19. You know the conversion matrix of types by heart, since your predecessor kindly thought it was a challenging adventure and use different types (float, decimal, string) for the same data in different places.
  20. You get to develop truly enterprise system, where redundancy is ever deeper than the one in the space shuttle. There is never just one way to do something in the code base. And your predecessor made sure to use one of the options randomly, just for the case where you may break one of the implementation by mistake and the whole application won’t go down.
  21. You truly stand on the shoulders of giants. Like most geniuses, your predecessor knew to ignore the advice of the so-called “leading figures” in the field and carved his way through fire and ice to get to the goal, stopping at nothing at the way.
  22. Enjoy your work as your read all those internal jokes that were put to the code. Sometimes it’s in the form of a comment, but occasionally you’ll get the truly inspired code that read like a good joke.
  23. Admire the loyalty to the vendor of choice on the part of your predecessor, who did anything humanly possible to ensure that the system will remain on the vendor’s systems for all time.
  24. Bask in the glory of your predecessor, who had the foresight to think about the Convention over Configuration decades before it was out in force. Okay, so it’s more of a guideline than a convention, but hey, it was a long time ago.
  25. Be on alert at all times, searching for the next surprise gift that your predecessor left you, often hidden in three separate files, named similarly.