Module 8 · 12 marks · Design, criticality & testing
Software evolution & maintenance
Software evolution is the continual change of a system after its first release. It follows Lehman's laws, takes the form of corrective, adaptive, perfective and preventive maintenance, and is managed through legacy-system strategies, re-engineering, refactoring and software configuration management.
Medium 45 minSyllabus: “Evolution”
Mark as
The idea in one minute
A house is never finished. You fix a leaking tap (corrective), rewire for a new electricity standard or add a ramp when a grandparent moves in (adaptive), build an extra room because the family grew (perfective), and treat the walls before damp sets in (preventive). Over the decades you keep a file of every alteration and approved plan, so the next mason knows what is behind each wall — that file is configuration management.
Key points — the night-before list
Evolution process: change requests → impact analysis → release planning (fault repair, platform adaptation, enhancement) → change implementation → system release; emergency fixes take a shortcut.
Maintenance types: corrective (fix faults), adaptive (new environment), perfective (new or better functions), preventive (easier future maintenance). Perfective takes the largest share.
Cost factors: team stability, contractual responsibility, staff skills, program age and structure. Maintenance usually costs more than development; Boehm: AME = ACT × development effort.
Legacy strategies by business value × quality: scrap, continue maintenance, re-engineer, replace.
Re-engineering: source translation, reverse engineering, structure improvement, modularisation, data re-engineering. Reverse engineering recovers design; forward engineering builds from design.
Refactoring improves structure without changing behaviour; smells: duplicated code, long method, large class, long parameter list, switch statements, feature envy, data clumps.
SCM: configuration items, baselines, version control, change control board, system building, release management, CI/CD; semantic versioning MAJOR.MINOR.PATCH.
01Why software evolves; evolution processes
Change is unavoidable. Users discover new needs once they start using the software; the business changes (new Government Orders, new schemes); faults have to be repaired; hardware, operating systems and equipment are replaced or added; and performance or reliability may need improving. Software that is used in the real world must keep changing to stay useful — which is why evolution, not initial development, consumes most software budgets.
Rajlich and Bennett describe the life of a system in stages: initial development, then evolution (significant changes to architecture and functionality), then servicing (only small tactical changes as the structure degrades and expertise is lost), and finally phase-out (the system is still used but no further changes are made). Sommerville's evolution process for each release is:
The software evolution process
Change requests
Proposals for change arrive from users, managers, developers and the environment.
Impact analysis
Assess which parts of the system are affected and how much the change will cost — traceability information is essential.
Release planning
Decide which changes go into the next release, grouped as fault repair, platform adaptation and system enhancement.
Change implementation
Revise the requirements, design and code (an iteration of the development process), and test.
System release
Release the new version — which becomes the starting point for the next round of change proposals.
Urgent changes — a serious fault, an unexpected environment change, a business change that cannot wait — may bypass the full process: the source code is analysed, modified and delivered directly. The danger is that the requirements and design documents are not updated, so they drift away from the code; the change should be redone properly later. Handing a system from a development team to a separate maintenance team also loses knowledge, which is one reason agile teams prefer to keep evolving the software they built.
PSC favourite
PSC 2026: software evolution is primarily driven by user requirements and environment changes — not by compiler changes or hardware failures.
02Lehman's laws of software evolution
From the 1970s Meir Lehman and Laszlo Belady studied the evolution of large systems such as IBM's OS/360 and formulated a set of 'laws'. They apply to E-type systems — programs embedded in the real world, whose requirements change as the world changes — rather than to S-type programs that are completely defined by a formal specification, or P-type programs that solve a problem only approximately.
Law (year)
Meaning in one line
I. Continuing change (1974)
A program used in a real-world environment must keep changing, or it becomes progressively less useful
II. Increasing complexity (1974)
As a program changes, its structure becomes more complex unless effort is spent preserving and simplifying it
III. Large program evolution / self-regulation (1974)
Evolution is self-regulating: attributes such as size, time between releases and reported errors are roughly invariant from release to release
IV. Organisational stability (1978)
Over the lifetime of a program its rate of development is approximately constant and independent of the resources devoted to it
V. Conservation of familiarity (1978)
The incremental change in each release is approximately constant — releases with too much change bring quality problems
VI. Continuing growth (1991)
The functionality offered must keep increasing to maintain user satisfaction
VII. Declining quality (1996)
Quality declines unless the system is modified to reflect changes in its operational environment
VIII. Feedback system (1996)
Evolution processes are multi-agent, multi-loop feedback systems and must be treated as such to achieve significant improvement
The laws have practical consequences: budget for continuous change rather than treating it as failure (I, VI); schedule refactoring and preventive maintenance, or structure decays (II, VII); and don't expect extra staff to speed up a mature system's evolution dramatically (IV), or a huge release to go smoothly (V). Sommerville notes that the laws seem to hold for large systems developed by big organisations, but are less certain for small systems, for COTS-based systems and for agile development.
Software maintenance means changing a system after it has been delivered. E. Burton Swanson (1976) named three types; a fourth, preventive, was added later (as in ISO/IEC/IEEE 14764, the successor of IEEE 1219):
Type
Purpose
HLAMS example
Corrective
Repair faults discovered after delivery — coding, design or requirements errors
Fix EMI truncation (₹10,624 instead of ₹10,625)
Adaptive
Adapt the software to a changed environment — hardware, OS, platform, interfaces, regulations
Move to a new cloud platform; follow a bank's new file format; apply a new GST rule
Perfective
Add or modify functionality, or improve performance, in response to user requests
Add a mobile app; add a district-wise arrears dashboard; speed up reports
Preventive
Change the software to make future maintenance easier and avert latent faults
Refactor the payment module; update documentation; add automated regression tests
Source
Corrective / fault repair
Adaptive / environmental adaptation
Perfective / functionality addition or modification
Figures differ by source, but every study finds adding or modifying functionality to be the largest share
Maintenance usually costs more than development — Sommerville quotes from 2 to 100 times as much, depending on the application — and adding functionality after delivery costs more than building it in originally. His key cost factors are: team stability (costs fall if the same people stay with the system); contractual responsibility (developers with no contract to maintain the system have no incentive to design for change); staff skills (maintenance staff are often inexperienced and unfamiliar with the domain); and program age and structure (structure degrades with age and changes, making programs harder to understand and change).
Boehm's maintenance estimate (COCOMO 81):
ACT (annual change traffic) = (KLOC added + KLOC modified in a year) ÷ total KLOC
AME (annual maintenance effort) = ACT × SDE (SDE = software development effort, PM)
Optionally multiplied by a maintenance effort adjustment factor (EAF).
PSC favourite
PSC 2018: finding and fixing errors during operation = corrective maintenance. Adaptive responds to the environment; perfective to users' requests; preventive to future maintainability.
04Maintenance prediction
Managers want to know which parts of a system will be expensive to maintain, how many change requests to expect and what maintenance will cost next year and over the system's lifetime. Sommerville divides maintenance prediction into predicting system changes, predicting maintainability and predicting maintenance costs — each feeding the next.
Predicting the number of changes depends on the relationship between the system and its environment: the number and complexity of system interfaces, the number of inherently volatile requirements, and the business processes in which the system is used.
Predicting maintainability uses complexity metrics of components — cyclomatic complexity, data-structure complexity, size of objects, methods and modules, depth of nesting. Studies show most maintenance effort goes into a small number of complex components.
Predicting costs combines the expected number of changes with the maintainability of the parts likely to change, and with historical cost data.
Once a system is in use, process metrics give the most reliable signals: the number of requests for corrective maintenance (rising → maintainability falling), the average time needed for impact analysis, the average time taken to implement a change request, and the number of outstanding change requests. If any of these trends upwards, the system is becoming harder to maintain — a cue for preventive work or re-engineering.
Tip
For HLAMS, the volatile areas are obvious: eligibility rules (Government Orders), bank and payment interfaces, and reports. Isolating each behind a clean interface — a rules component, adapters, a reporting layer — is the cheapest way to make predicted changes cheap.
05Legacy system management
Organisations with limited budgets must decide what to do with each legacy system. Sommerville lists four strategic options: scrap the system and change business processes so it is no longer needed; continue maintaining it; transform it by re-engineering to improve its maintainability; or replace it with a new system. The choice comes from assessing each system's business value and its technical quality.
Business value
System quality
Recommended strategy
HLAMS-era example
Low
Low
Scrap — keeping it running is expensive and the business gains little
An old DOS program that prints a report nobody reads
High
Low
Re-engineer to improve quality, or replace if a suitable system is available
The 1990s FoxPro loan ledger: essential, but fragile and undocumented
Low
High
Replace with a COTS product, scrap, or maintain at low cost
A well-built but rarely used vehicle-pool booking system
Application: understandability, documentation, data quality, performance, language, configuration management, test data, staff skills
Business-process assessment: how well the system fits current processes
Watch out
Replacement looks attractive but is risky: legacy systems embody business rules that exist nowhere else, the specification is usually missing, and the new system may not do everything the old one did. Re-engineering reduces that risk by keeping functionality while improving structure.
06Re-engineering, reverse and forward engineering
Chikofsky and Cross (1990) gave the standard taxonomy. Forward engineering is ordinary development: from abstract, implementation-independent designs down to a working implementation. Reverse engineering goes the other way without changing anything — it analyses an existing system to find its components and how they relate, and describes them at a higher level of abstraction (redocumentation and design recovery are forms of it). Restructuring turns one representation into another at the same level of abstraction, keeping external behaviour. Re-engineering examines and alters a system to rebuild it in a new form — usually reverse engineering, then restructuring and forward engineering.
The re-engineering process (Sommerville)
Source code translation
Convert the code to a new language or version, often automatically (e.g. FoxPro or COBOL to Java).
Reverse engineering
Analyse the program to understand it and document its organisation and functionality.
Program structure improvement
Analyse and modify the control structure to make it easier to read and understand (often tool-assisted).
Program modularisation
Group related parts of the program together and remove redundancy; may involve architectural refactoring.
Data re-engineering
Clean up and restructure the system's data — fix inconsistent formats, duplicates and missing values; migrate to a new database schema.
Re-engineering pays off when only some sub-systems of a large system are expensive to keep changing. Compared with replacement it has reduced risk (no new specification to get wrong) and reduced cost (usually far cheaper than new development). Its cost depends on the quality of the software, the tool support available, the extent of data conversion and the availability of expert staff. Approaches range from automated program restructuring and source conversion (cheapest) to restructuring plus architectural change (most expensive). There are limits: a function-oriented system cannot simply be re-engineered into a well-designed object-oriented one.
Pressman draws re-engineering as a cyclic process model of six activities: inventory analysis (list applications with size, age and business criticality to pick candidates), document restructuring, reverse engineering, code restructuring, data restructuring and forward engineering.
PSC favourite
Reverse engineering → understand and document (no change). Restructuring → same level, better form. Re-engineering → reverse + restructure/forward, functionality preserved. Forward engineering → design to code.
07Refactoring and bad smells
Refactoring (Opdyke, 1992; popularised by Martin Fowler's 1999 book) is the process of making improvements to a program's internal structure without changing its external behaviour, to slow down the degradation that Lehman's second law predicts. It is preventive maintenance done continuously in small steps, each protected by automated regression tests. Ward Cunningham's metaphor of technical debt (1992) explains why: shortcuts borrow time now and charge 'interest' as extra effort on every later change, until refactoring repays the debt.
Bad smell (Fowler & Beck)
Symptom
Typical refactoring
Duplicated code
The same or very similar code in several places
Extract Method; Pull Up Method into a superclass
Long method
A method doing too much to understand at a glance
Extract Method
Large class
A class with too many fields and responsibilities
Extract Class
Long parameter list
Many parameters passed together
Introduce Parameter Object; Preserve Whole Object
Switch statements
The same type-code switch repeated around the program
Replace Conditional with Polymorphism
Feature envy
A method that uses another class's data more than its own
Move Method
Data clumps
The same group of data items appearing together repeatedly
Extract Class / Introduce Parameter Object
Speculative generality
Hooks and abstractions 'for the future' that nothing uses
Collapse Hierarchy; remove unused code
JavaBefore: duplicated EMI code, a conditional on a type code and magic numbers
class InterestCalc {
double emi(String scheme, double p, double rate, int n) {
if (scheme.equals("LIG")) {
double r = (rate - 1.0) / 1200; // LIG gets a 1% concession
double f = Math.pow(1 + r, n);
return p * r * f / (f - 1);
} else if (scheme.equals("MIG")) {
double r = rate / 1200;
double f = Math.pow(1 + r, n);
return p * r * f / (f - 1);
} else {
double r = (rate + 0.5) / 1200; // HIG pays 0.5% more
double f = Math.pow(1 + r, n);
return p * r * f / (f - 1);
}
}
}
JavaAfter: Extract Method + Replace Conditional with Polymorphism + named constants — same results, one formula, new schemes added as new classes
abstract class Scheme {
abstract double effectiveRate(double baseRate);
final double emi(double p, double baseRate, int n) { // the single formula
double r = effectiveRate(baseRate) / 1200;
double f = Math.pow(1 + r, n);
return p * r * f / (f - 1);
}
}
class Lig extends Scheme {
static final double CONCESSION = 1.0;
double effectiveRate(double baseRate) { return baseRate - CONCESSION; }
}
class Mig extends Scheme {
double effectiveRate(double baseRate) { return baseRate; }
}
class Hig extends Scheme {
static final double LOADING = 0.5;
double effectiveRate(double baseRate) { return baseRate + LOADING; }
}
PSC favourite
PSC 2026: refactoring is improving code structure without changing behaviour — not adding features, fixing bugs or removing requirements. Refactoring is small and continuous; re-engineering is a larger, one-off project on a legacy system.
08Software configuration management and documentation
Software configuration management (SCM) is the discipline — policies, processes and tools — of keeping control over a software system while it keeps changing, so that everyone knows what is in each version and every change is authorised. Sommerville's four activities are change management, version management, system building and release management; Pressman lists five SCM tasks — identification, version control, change control, configuration auditing and status reporting (status accounting).
Term
Meaning
Configuration item (SCI)
Anything placed under configuration control — requirements, designs, code, test data, build scripts, manuals
Version / revision / variant
An instance of an item that differs from others; revisions succeed each other over time, variants coexist (e.g. Malayalam and English editions)
Baseline
A formally reviewed and agreed set of item versions that serves as the basis for further work and can be changed only through formal change control
Codeline / mainline
A sequence of versions of a component; the mainline is the sequence of baselines of the whole system
Branch / merge
A new codeline created from an existing version / a new version combining versions from different codelines
Release
A version of the system distributed to customers (or deployed), with code, configuration and data files, installation program and documentation
Change control board (CCB)
The group (customer and developer members) that assesses change requests from technical, business and strategic viewpoints and approves, defers or rejects them
Version control systems store every version of every item and record who changed what and why. Centralised systems (CVS, Subversion) keep one master repository; distributed systems (Git, created by Linus Torvalds in 2005; Mercurial) give every developer a full copy of the history. Older tools saved space with deltas — RCS stores the newest version in full plus reverse deltas. System building compiles and links the right versions into an executable — from make (Stuart Feldman, Bell Labs, 1976) to Maven and Gradle — and continuous integration (e.g. Jenkins) builds and tests after every commit. Continuous delivery keeps every change releasable; continuous deployment releases every change that passes the pipeline automatically.
Release management decides when to release and what goes in, and tracks which customers have which release. Semantic versioning numbers releases MAJOR.MINOR.PATCH: increment MAJOR for incompatible changes, MINOR for backward-compatible new features and PATCH for backward-compatible bug fixes. Relevant standards are IEEE 828 (configuration management in systems and software engineering) and ISO 10007 (guidelines for configuration management). The change-control flow is stepped through at the end of this page.
System documentation
Requirements document and traceability records
Architecture and design descriptions, data dictionary
Commented source code and build instructions
Test plans, test cases and reports
Maintenance guide: known problems, dependencies, how to evolve
User documentation
Functional description — what the system offers
Installation document
Introductory manual for new users
Reference manual with every facility and error message
System administrator's guide
PSC favourite
PSC 2024: version control is a task of the software configuration management process. A baseline can be changed only through formal change control — that is what distinguishes it from any other version.
Step through · A change request through change control
step 1 / 11
Step 1: Submit change request CR-117
An Accounts officer asks for a GST line on processing-fee receipts and fills in a change-request form: what is needed, why, and how urgent it is.
Worked examples
Try the problem first, then reveal the working one step at a time.
EX 1Classifying HLAMS maintenance requests
Classify each request: (a) receipts show the wrong date for payments made after midnight; (b) the State moves all servers to a new cloud platform with a newer operating system; (c) officers want a district-wise arrears dashboard; (d) the team splits the 4,000-line PaymentService class into smaller classes and adds unit tests, with no change in behaviour; (e) a new GST rule requires a tax line on processing-fee receipts; (f) the monthly report takes 3 hours and users want it in 10 minutes; (g) a bank changes its collection-file format.
EX 2Choosing strategies for KSHB's legacy portfolio
KSHB rates its old systems: (i) FoxPro loan ledger — business value high, quality low; (ii) vehicle-pool booking — value low, quality high; (iii) staff canteen coupons on an old DOS PC — value low, quality low; (iv) the new allotment-draw module — value high, quality high. Recommend a strategy for each and justify.
EX 3Estimating annual maintenance effort (Boehm's ACT)
HLAMS took about 91.3 person-months to develop (Basic COCOMO, 32 KLOC). In its first year of use, 3 KLOC are expected to be added and 1.8 KLOC modified. Estimate the annual change traffic and the annual maintenance effort, and the number of full-time maintainers needed.
EX 4Refactoring the InterestCalc class
Look at the 'before' InterestCalc code in the refactoring section. Identify its bad smells, name the refactorings applied in the 'after' version, and show that behaviour is preserved for an LIG loan of ₹10,00,000 at a base rate of 10% for 240 months.
Practice session
Work each problem on paper first, then check. Marking one solved earns 10 XP.0/5 solved
Q1
Name the Lehman law described: (a) each release should add about the same amount of change; (b) unless effort is spent on it, structure becomes more complex; (c) a program in real-world use must change or become less useful; (d) adding staff does not raise the long-term rate of development much; (e) quality falls unless the system adapts to its changing environment.
Q2
Name the re-engineering activity: (a) converting FoxPro code to Java automatically; (b) producing call graphs and data-flow diagrams from the old code; (c) removing duplicate customer records and unifying date formats; (d) replacing tangled GOTO logic with structured loops; (e) grouping all interest-related routines into one module.
Q3
Distinguish version, variant, release and baseline, using HLAMS examples. What does a branch allow developers to do?
Q4
HLAMS is at version 2.3.1 under semantic versioning. Give the next version number after each successive release: (a) a bug fix for receipts; (b) a new, backward-compatible SMS-preference feature; (c) an API change that breaks old mobile-app versions; (d) another bug fix.
Q5
HLAMS was built by a contractor who is not responsible for maintenance; the Board's two maintainers are new to housing finance; the code is six years old and has had 400 changes; the contractor's original team has left. Which of Sommerville's maintenance cost factors are at work, and what would you do about each?
Exam traps
Adaptive ≠ perfective. Adaptive responds to changes in the environment (OS, platform, bank interfaces, tax rules); perfective responds to users' requests for new or better functions or performance; preventive improves future maintainability.
Perfective maintenance (adding or modifying functionality) takes the largest share of effort — corrective is not the largest, though many students guess so.
Reverse engineering only analyses and documents — it does not change the system. Re-engineering changes the form (language, structure, data) but preserves functionality.
Refactoring is continuous, small-scale and behaviour-preserving; re-engineering is a larger, planned transformation of a legacy system.
A baseline can be changed only through formal change control; 'version' is any instance; a 'release' is a version delivered to customers; variants coexist side by side.
Lehman's laws apply to E-type systems embedded in a changing real world, not to S-type programs defined completely by a formal specification.
Quiz — KPSC style
10 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.