5 ways to work with your Legacy-Code

kim kulling
LegacyCode
4 min readFeb 25, 2020

--

If you are working as a professional software-developer you will have to deal with a lot of code. Normally this code was not written by you, it was written by someone else. Even if you wrote the code some months ago: reading you old code can be the same as reading code from a different person. And mostly you have to work with old code likefix bugs or improve some older feature. And it can be a painful experience for you.

When I started my career as a professional software developer in 2003 my first task was to improve a legacy model-editor: approximately 120.000 lines of FORTRAN-77 code with an OpenGL-renderer written in C/C++. The C++ part was more c-code with 3 god-classes. Believe me, I was able to find all the code-smells you have ever heard of :

  • Long functions: 10.000 lines and more
  • Not self-explanatory variable-names: What the hell, why have they called the variables I, I1, II, II1 or IIQ1?
  • Deep nested loops
  • Many compiler warnings: I counted more than 1000
  • Hard to read code: For example an old construct from the good old FORTRAN-days called ENTRY, which are low-cost calls into long functions. They were faster and much harder to read.
  • Global common blocks: this is an old FOTRAN-construct to define a set of global variables

--

--

kim kulling
LegacyCode

I am working as a System-Architect and Cyber-Security Engineer. I am the Asset-Importer-Lib Lead programmer. My Linketree https://linktr.ee/kimkulling