ga('send', 'pageview');
Categories
Mjukvaruhantverk

How To Honor Your Legacy (Code)

More often than not, people express strong aversion to legacy code. But if we fail to recognize the value of the legacy code and how it came to be, we clearly do not have the perspective it takes to make it any better.

If you are feeling sorry for yourself for being stuck with someone else’s tired, old legacy code, it is time to change your attitude. Without that legacy system, the business would most likely not be where it is today; solving problems, making money and paying you to evolve it. You should be so lucky to achieve something that turns out to be that essential, perhaps even the foundation of a successful business.

As for the quality of it, do not judge them too hard. Yes, it might be messy and hard to read, but each person who touched it did the best they could given their knowledge. Surely they could have done a better job, just like yourself in everything you ever did and will do. But let us assume they did their best and made conscious decisions. How else can we expect anyone to trust us to deliver any better today, and cut us the same slack about our mistakes later on?

Do Not Mess It Up This Time

Once you understand the value of the legacy code, and admit that it might be shaped by unfortunate rather than incompetent decisions, you are more likely to be up for the challenge of dealing with it. Enjoy the fact that you have been given the opportunity to evolve it. This is your chance to turn it into something a little more future-proof. Make sure you have the knowledge and commitment to succeed and cross your fingers that in a few years your system is still carrying its own weight, and that the next bunch of developers will read your code and go “this is incredibly well-written. Making changes is a breeze and this timeless design enables me to migrate it to [to-be-invented platform or paradigm] with minimal effort.”

The real challenge of Dealing with Legacy Code is not how to make it out alive (understand it, test it, change it, modernize it), the challenge is to evolve it in a direction that will make it easier to deal with later on. It is not a battle against the previous generation, it is a battle for the next generation. Do not take for granted that your code will be any more useful in the future simply by feeling modern today.

Your guiding star is the domain knowledge. The essence of the legacy system, the value worth hanging on to. Behind that untested mess of what appears to be a bottomless pit of obscure algorithms and outdated frameworks, the legacy code tells an important story. Your mission is to extract that knowledge and do everything you can to protect it from the decay that happens to software over time.

The Future Is Relative

With the amount of business critical software that runs today that was built in a time when clouds were simply weather related, we are bound to face this challenge many times over in the near future. Living in modern times does not make us any more capable, but we might have a better idea of just how little we know about the future of a system and the technology around it. When thinking future-proof, do not even try to predict the future. Instead, imagine the time when the software was built and think of yourself as the future. Look back and learn from the legacy you inherited which aspects are truly valuable and which are disposable. What do you want your legacy to be?