Zum Hauptinhalt springen

Software Engineering, geprüft · Teil 9 von 13

Age: how software actually rots

19. November 2026·10 Min. Lesezeit
20 Behauptungen geprüft

Every project has a last day. The launch went well, the team moves on, and the system is "handed over to maintenance". The phrase suggests a quiet retirement: a bug fix here, a patch there, someone keeping the lights on.

Then someone quotes the number. Maintenance, say the textbooks, consumes 60–90% of a system's total cost, so the project that just finished was the small part. Follow the number back and it leads to a 1978 survey by Lientz, Swanson and Tompkins, and to a sentence that begins "Rough estimates" ~70 %. The same survey found something the number left behind: most of what the maintainers were doing wasn't fixing anything.

This part is about software's long second life. The question is plain: how does software actually age, and what can be done about it?

Where does 60–90% come from?

Lientz and his colleagues surveyed application software maintenance in the late 1970s. Their main conclusion was cautious, and it has held: "maintenance and enhancement do consume much of the total resources of systems and programming groups". The figures came with a warning label: "Rough estimates of the total systems and programming resources consumed range as high as 75-80 percent in each category." As high as. Rough estimates. The range that circulates today is both wider and more confident than its source. Maintenance does take most of the effort in a typical IT group. The percentage was an estimate, not a measurement.

The more useful finding is what "maintenance" meant. The biggest management problem the survey found wasn't bugs: "user demands for enhancements and extension constitute the most important management problem area" ~70 %. Studies of change histories since then have found plenty of work that adds features or restructures code rather than correcting faults; one found "a relatively large amount of perfective changes". The exact split depends heavily on who classifies the changes, and how.

So the famous number mostly measures something else: the software continuing to be useful. A high maintenance share may simply mean people want more from the system. Calling that work maintenance puts it in the cost column. Calling it development would put it in the plan.

Lehman's laws, checked

Manny Lehman wrote the problem into laws. Programs in real use face constant pressure to change, and in 1980 he argued that this results in "a process of never ending maintenance activity". Two of his laws make predictions you can check: software that stays in use keeps changing and growing, and as it evolves, its complexity increases.

The first has held wherever it has been tested. A review of the evidence by Israel Herraiz and colleagues found that continuous change and continuing growth "have been validated by all the studies", and fourteen years of the Linux kernel show obvious growth ~85 %. It is closer to an observation than a law.

The second hasn't held. Data from open-source projects shows that later changes don't get harder to make, which is what rising complexity would predict. In Linux, the average complexity of a function fell over time, though mostly because many small functions were added ~30 %. Lehman's wording carries an escape clause: complexity increases unless work is done to reduce it. Without the clause, the law says decay is inevitable. With it, decay is what happens when nobody looks after the code.

Code rots where it's touched

If software rots, where does it rot? The evidence points away from the code's age and towards its history.

In 2000, Todd Graves and colleagues studied the change history of a large telecom system. The number of times a module had been changed predicted its faults better than its length did, and their best model weighted large, recent changes most ~85 %. It has been replicated across industrial and open-source systems since: how often and how messily code changes beats size and complexity metrics. Most of these studies are correlational, and the margin varies.

The flip side: a module a year older than an otherwise similar one had roughly a third fewer faults ~70 %. It is one well-designed study, and the effect comes from recent changes, not age itself. Old code is safer because it has stopped being touched. A rewrite turns the safest code you own back into new code.

A change history is a record of people: who touched the code, how often, in what hurry. Code metrics see the text; process metrics see the work around it. That the record of the work predicts faults better than the text is one more sign that software's problems start with how people work on it.

Debt, as reported by the people paying it

Ward Cunningham's metaphor of technical debt has become the standard way to talk about ageing code. What does it cost? Terese Besker and colleagues had 43 developers log their wasted time, again and again, in a longitudinal survey. On average they reported losing 23% of their development time to technical debt, and a replication by the same authors with a second dataset found the same figure ~70 %. It is self-reported and unaudited, and plausible. The larger figure often quoted beside it, "up to 42%", comes from an industry report.

Where does it come from? In a survey of 1,831 engineers and architects at three large organisations, Neil Ernst and colleagues found that "architectural decisions are the most important source of technical debt" ~70 %. Not messy code, the usual suspect. That is practitioners' perception, not a measurement, though case studies that trace bug-prone files to architectural flaws point the same way.

The most-quoted numbers on what bad code costs are vendor data. Adam Tornhill and colleagues, from the company behind the CodeScene analysis tool, studied 30,737 files in 39 of its customers' codebases. Low-quality code, by the tool's own measure, had 15 times more defects, and issues in it took 124% longer to resolve ~70 %. The authors concede their customers may not be representative, and ask themselves: "Does low quality code lead to additional defects or is the code quality low because of the many defects?" The direction is credible. The multiples are not constants.

If architecture is where the debt lives, the tempting fix is a new one, usually microservices. Practitioners migrate largely for maintainability; in one survey, they expected "the reduced maintenance effort in the long run" to make up for a slow return ~50 %. The evidence is surveys and grey literature, and it records the pains too: a review of practitioners' reports found them "mainly due to the intrinsic complexity of microservice-based applications". The clearest gain was in development, because "different microservices can be independently developed by different developers". That is a gain in how people work together, not in the code. Part 4 has the rest of that story.

The smells were there all along

The usual story: code starts clean, shortcuts pile up under pressure, and it begins to smell. Smells make code harder to change, so developers spot them and refactor, which is safe because refactoring doesn't change behaviour. Each step has been checked.

One holds. Classes with smells do change more often and have more faults than clean ones, in 54 releases of four systems and again in 395 releases of 30 projects, and size alone doesn't explain it ~85 %. But the authors of the larger study concluded that the smell "is not necessarily the direct cause of the class fault-proneness, but rather a co-occurring phenomenon".

The rest don't. Smells don't creep in: Michele Tufano and colleagues mined half a million commits in 200 projects and found most smells were there from the moment the code was written. "Our findings mostly contradict common wisdom," they wrote ~30 %.

Nor do smells obviously raise the cost of changes. In the one study that timed professionals on real maintenance tasks, Dag Sjøberg and colleagues found that "None of the 12 investigated smells was significantly associated with increased effort after we adjusted for file size and the number of changes" ~30 %. Smelly classes change more often; each change doesn't cost more. Their advice: a focus on reducing code size and on work practices that limit the number of changes "may be more beneficial than refactoring code smells".

Developers don't refactor where the metrics point, either. Gabriele Bavota and colleagues followed the refactorings in three Java projects. Most targeted code that quality metrics didn't flag; 42% touched smelly code, and only 7% actually removed the smell ~30 %.

And refactoring isn't safe by default. Of 15,008 refactorings in three Java systems, some kinds were unlikely to do harm, but those involving class hierarchies, such as pulling a method up into a superclass, "tend to induce faults very frequently" ~30 %. Developers at Microsoft see refactoring as involving "substantial cost and risks". For once the engineers' belief and the measurement agree; it's the textbook that's out of step.

Copies

"Don't repeat yourself" is taught as law. Cory Kapser and Michael Godfrey looked at the clones in Apache and Gnumeric and asked why each one existed. As many as 71% could be considered to have a positive effect on maintainability, and cloning turned out to be "often used in a variety of ways as a principled engineering tool" ~30 %.

The danger is narrower. Elmar Juergens and colleagues examined five systems. About half the clones contained inconsistencies, and "about every second to third unintentional change to a clone leads to a fault" ~70 %. One study, but a careful one. The bug isn't the copy. It's the change that reaches one copy and misses the other.

Other people's code

Much of an application is code its team didn't write, and it ages too. Raula Gaikovina Kula and colleagues studied 4,600 GitHub projects: 81.5% kept their outdated dependencies, and 69% of the developers they interviewed said they were unaware of their vulnerable ones ~85 %. In npm, lack of maintenance leaves many packages depending on vulnerable code "even years after a vulnerability has become public".

Updating isn't free either. Semantic versioning promises that minor and patch releases won't break things. In more than 100,000 Maven releases, Steven Raemaekers and colleagues found that 35.7% of minor releases and 23.8% of patch releases contained at least one breaking change, nearly as many as in major releases ~15 %.

The trust runs wider than the version number. Installing an average npm package means implicitly trusting 79 third-party packages and 39 maintainers, and 20 maintainer accounts can reach more than half of the ecosystem ~85 %. That measures exposure, not attacks. But an ageing system depends on strangers keeping their accounts safe and their code maintained. Software is people talking, including people you have never spoken to.

What doesn't work

  • Waiting for complexity to win. Lehman's law of increasing complexity fails in much of the open-source data, where later changes didn't get harder ~30 %.
  • Planning a clean-up for when the smells creep in. Most smells arrive with the first commit ~30 %.
  • Refactoring smells to save effort. Once size and number of changes are accounted for, smells didn't raise maintenance effort ~30 %.
  • Treating refactoring as risk-free. Some kinds, especially around class hierarchies, induce faults often ~30 %.
  • Trusting the version number. A third of minor releases broke something ~15 %.

Try this

  • Call enhancement by its name. Budget the years after launch as development, because most of the work is likely to be new features, not repairs.
  • Let the history pick your targets. Look for the files that change most and attract the most fixes. Code that hasn't changed in years is among your safest; rewrite it only for a reason.
  • Treat a refactoring as a change. Review and test it like any other, especially when it moves code around a class hierarchy.
  • Fix all the copies. Before closing a bug in duplicated code, find the other copies and decide whether they need the same fix.
  • Update dependencies on a schedule, with tests. Small, regular upgrades with a test run behind them, whatever the version number promises.

20 Behauptungen geprüft

Die Belege hinter diesem Artikel

Jede Behauptung oben, bewertet nach der Chance, dass sie der Forschung standhält. Öffne eine für die Quellen und ihren genauen Wortlaut.

  1. Bavota, De Carluccio, De Lucia, Di Penta, Oliveto, Strollo (2012). When Does a Refactoring Induce Bugs? An Empirical Study · Studie
  2. Bavota, De Lucia, Di Penta, Oliveto, Palomba (2015). An experimental investigation on the innate relationship between quality and refactoring · Studie
  3. Besker, Martini, Bosch (2018). Technical debt cripples software developer productivity · Studie
  4. Besker, Martini, Bosch (2019). Software developer productivity loss due to technical debt—A replication and extension study examining developers’ development work · Replikation
  5. Ernst, Bellomo, Ozkaya, Nord, Gorton (2015). Measure it? Manage it? Ignore it? software practitioners and technical debt · Studie
  6. Graves, Karr, Marron, Siy (2000). Predicting fault incidence using software change history · Studie
  7. Hassan (2009). Predicting faults using the complexity of code changes · Studie
  8. Herraiz, Rodriguez, Robles, Gonzalez-Barahona (2013). The evolution of the laws of software evolution · Metaanalyse
  9. Israeli, Feitelson (2010). The Linux kernel as a case study in software evolution · Studie
  10. Juergens, Deissenboeck, Hummel, Wagner (2009). Do code clones matter? · Studie
  11. Kapser, Godfrey (2008). “Cloning considered harmful” considered harmful: patterns of cloning in software · Studie
  12. Khomh, Penta, Guéhéneuc, Antoniol (2011). An exploratory study of the impact of antipatterns on class change- and fault-proneness · Studie
  13. Kim, Zimmermann, Nagappan (2014). An Empirical Study of RefactoringChallenges and Benefits at Microsoft · Studie
  14. Kula, German, Ouni, Ishio, Inoue (2017). Do developers update their library dependencies? · Studie
  15. Lehman (1980). Programs, life cycles, and laws of software evolution · Quelle
  16. Lientz, Swanson, Tompkins (1978). Characteristics of application software maintenance · Studie
  17. Mockus, Votta (2000). Identifying reasons for software changes using historic databases · Studie
  18. Nayebi, Cai, Kazman, Ruhe, Feng, Carlson, Chew (2019). A Longitudinal Study of Identifying and Paying Down Architecture Debt · Studie
  19. Palomba, Bavota, Penta, Fasano, Oliveto, Lucia (2017). On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigation · Studie
  20. Raemaekers, van Deursen, Visser (2017). Semantic versioning and impact of breaking changes in the Maven repository · Studie
  21. Rahman, Devanbu (2013). How, and why, process metrics are better · Studie
  22. Sjoberg, Yamashita, Anda, Mockus, Dyba (2013). Quantifying the Effect of Code Smells on Maintenance Effort · Studie
  23. Soldani, Tamburri, Van Den Heuvel (2018). The pains and gains of microservices: A Systematic grey literature review · Metaanalyse
  24. Taibi, Lenarduzzi, Pahl (2017). Processes, Motivations, and Issues for Migrating to Microservices Architectures: An Empirical Investigation · Studie
  25. Tornhill, Borg (2022). Code red: the business impact of code quality - a quantitative study of 39 proprietary production codebases · Studie
  26. Tufano, Palomba, Bavota, Oliveto, Di Penta, De Lucia, Poshyvanyk (2015). When and Why Your Code Starts to Smell Bad · Studie
  27. Zimmermann, Staicu, Tenny, Pradel (2019). Small World with High Risks: A Study of Security Threats in the npm Ecosystem · Studie

Teilen

XLinkedIn