Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

Programmers expect their code to live long and prosper

Phil Johnson | Aug. 21, 2015
A new survey of developers finds that they have a long life expectancy for their work but still can’t agree on what constitutes “legacy” code.

A drawing of the Live long and prosper hand gesture

For those of us who don’t build software, it seems that code is constantly changing. Think of all the times you’ve had to update the OS or applications on your mobile phone or laptop. However, a new survey of software developers finds that the people who write all that code expect it to be used for a good long while.

The survey was recently carried out by Karoline Klever, a developer in Norway currently working as a consultant for Epinova. Almost 300 developers took her online poll about the life expectancy of software code. Klever recently shared some of the survey results on her blog, and subsequently answered a couple of questions that I asked her via email.

Code life expectancy is long

Among her findings were that developers expect their code (both past and present) to be used for many years. 62% of respondents believed that code they wrote 10 years ago was still in use in a production environment (20% weren’t even writing code that long ago), while 63% expected that code they were currently writing would still be in production use in a decade.

Developers quick to rewrite rather than fix legacy code

Interestingly, though, the majority of respondents also admitted to being to rewriting rather than fixing legacy code. 65% said they would rather rewrite a piece of existing code than debug and fix it, while 61% said they had at some point advised rewriting a piece of code simply because it would be easier than fixing. As Klever pointed out, these two set of findings (expecting your code to live long while being quick to rewrite legacy code) are somewhat contradictory. “If that is the case,” she told me, “doesn't it increase the chances of someone else rewriting your code before it reaches its 10 year anniversary?”

Little agreement on what "legacy" code is

The biggest surprise of the survey to Klever, was that developers don’t agree on what defines “legacy” code. When asked “In your opinion, what makes code ‘legacy’?” the top responses were:

  1. It’s legacy if it’s written in an old language, or uses old libraries and frameworks (chosen by 180 respondents)
  2. It’s legacy if it lacks unit tests (115)
  3. It’s legacy if everyone who wrote it are no longer on the project (102)
  4. All code is legacy after X number of years (77)
  5. It’s legacy as soon as it’s in production (57)
  6. It’s legacy if someone other than I wrote it (13)

These mixed results, actually, have been seen before. For example, when the question came up on StackExchange a few years ago, answers were again all over the map. with the most popular answer being (essentially) that legacy code is “Any code that has been delivered.”

 

1  2  Next Page 

Sign up for Computerworld eNewsletters.