Friday, October 23, 2015

Your definition of "legacy" impacts how quick you are to rewrite code

If you were to tell your colleague that a piece of code was legacy, would he or she understand what you were saying? Most likely, yes. What if you asked the same colleague to define the term legacy for you? You might receive any answer in return as there is no single, agreed upon definition of what legacy code is.

Those who have read "Working effectively with legacy code" by Michael C. Feathers (an excellent book all developers should read) are likely to argue that legacy code is code without unit tests, This, however, eliminates the possibility of code with unit tests being legacy and I can swear I've seen legacy code with satisfactory test coverage. In my recent developer survey, the definition of legacy was something I wanted to investigate so I asked the question "In you opinion, what makes code legacy?" with the following results:

The survey also contained a couple of questions regarding rewriting of code and going through the results, a question formed itself in my mind: Is there a connection between a developers definition of "legacy" and how quick they are to rewrite code? More specifically, how do developers agree with the statement "I have advised that a piece of code should be rewritten simply because rewriting it would be easier than having to figure out how the original code worked" depending on their definition of legacy?

Of those who define legacy code to be code lacking unit tests, 62.6% have advised that a piece of code should be rewritten simply because rewriting it would be easier than having to figure out how the original code worked. 

Of those who define code to be legacy as soon as it's in production, 73.7% have advised that a piece of code should be rewritten simply because rewriting it would be easier than having to figure out how the original code worked. 

Of those who define code to be legacy if someone other than themselves wrote it, 92.3% have advised that a piece of code should be rewritten simply because rewriting it would be easier than having to figure out how the original code worked. 


So your definition of "legacy" actually impacts how quick you are to rewrite code!

If you want to dive into the results of the survey yourself, you can find them here. If you're interested in hearing more on this subject, you can watch my talk "What is the acytual life expectancy of your code?" from Leetspeak earlier this month.

No comments:

Post a Comment