Software Evolution and Maintenance

UNIT 2 • MODULE 2 • LESSON 09

Six months after the library system goes live, the committee sends a list: “Members should get two days’ grace before fines start. The new tablet at the front desk runs a different operating system. The overdue report sometimes lists a book twice. And could members renew online?” None of these mean the original project failed. They are normal. Software that people use keeps changing for as long as it is used. This continuing change is called software evolution, and the work of making it happen is maintenance.

What you will learn

  • Why software must keep changing after it is delivered.
  • The three kinds of change in the syllabus: fault repairs, environmental adaptation and functionality addition.
  • The matching types of maintenance (corrective, adaptive, perfective) and preventive maintenance.
  • The steps of handling a change request.
  • Why documentation must be reviewed and updated with every change.
  • What regression testing is, and how to run a regression suite in C after a change.

Part 1: Why software must evolve

Software is not like a bridge that, once built, mostly needs repainting. Software models part of the real world, and the real world keeps moving:

  • Users find faults that testing missed, because real use is more varied than any test plan.
  • The environment changes: new operating systems, new hardware, new browsers, new versions of the libraries and services the system depends on.
  • The organisation changes: new rules, new laws, new prices, new products, mergers and growth.
  • Users want more: once a system works well, people think of new things it could do.

A system that is not changed gradually becomes less useful, and eventually is replaced. Studies of real projects commonly find that most of the total cost of a long-lived system is spent after its first release. That is why maintainability (Lesson 01) is one of the most valuable attributes a system can have.

Part 2: Kinds of change and types of maintenance

The syllabus names three kinds of change. Each matches a standard type of maintenance:

Kind of change (syllabus)Type of maintenanceMeaningLibrary example
Fault repairsCorrectiveFixing faults found after release: coding, design or requirements errors.The overdue report lists a book twice; fix the loop.
Environmental adaptationAdaptiveChanging the system so it keeps working in a new environment, without changing what it does.Make the system run on the new tablet’s operating system; switch to a new database version.
Functionality additionPerfectiveAdding or changing features because requirements have changed, or improving performance or usability.Add online renewals; add the two-day grace period; make searches faster.

Some books add a fourth type, preventive maintenance: changing the system to make future maintenance easier, such as restructuring tangled code, adding comments or replacing magic numbers, without changing its behaviour. It does not fix a current problem, but it reduces the cost of the next change.

Of these, functionality addition and change usually take the largest share of maintenance effort, not fault repair. Most maintenance is the system keeping up with its users.

Try it 1Classify the change request

Choose the type of maintenance each change request needs.

Notice CR-14 versus CR-17. In CR-17 the code disagrees with the specification, so it is a fault. In CR-14 the code did exactly what was specified, but the rule changed, so it is a change in functionality. Deciding which it is matters, because faults are often fixed free under a support agreement while new functionality is usually charged for.

Part 3: The maintenance process

Changes are not made the moment someone asks. A controlled process protects the working system:

StepWhat happensFor CR-14 (grace period)
1. Change requestThe request is recorded with an ID, who asked, why and how urgent.CR-14 logged from the library committee.
2. Impact analysisFind which requirements, design documents, modules and tests are affected, and estimate cost and risk.Affects requirement F7 (fines), module fine, its tests, and the user guide section on fines.
3. Approval and release planningManagers decide whether, and in which release, to make the change. Changes are often grouped into versions.Approved for version 2.0 in January.
4. Change implementationUpdate the design and code, following the same standards as original development.Add GRACE constant; change the fine function.
5. Testing, including regression testingTest the new behaviour, and re-run earlier tests to check nothing else broke.New tests for 1, 2 and 3 days; re-run all old fine tests.
6. Documentation review and updateBring every affected document into line with the new system.Update requirement F7, the module description, the test plan and the user guide.
7. ReleaseInstall the new version, with release notes describing the change.Version 2.0 released with a note about the grace period.

Try it 2Which step of the process?

Each activity belongs to one step of the maintenance process. Choose it.

Part 4: Documentation review

Every change makes some documents out of date. If the code says one thing and the design says another, the next maintainer will be misled, and the cost of each later change rises. A documentation review checks, for each change, which documents are affected and updates them:

  • Requirements specification (the changed requirement and its number).
  • Design documents: structure charts, module descriptions, data dictionary, ERD.
  • Comments in the code, including the version and change ID.
  • Test plan and test cases, including new expected results.
  • User documentation: guides, help screens, training material.
  • Release notes and the change log.

Notice that the test plan is a document too. Before CR-14, a test said “1 day late gives $1”. After CR-14 that expected result is wrong. The test must be updated to expect $0, or it will report a failure for correct code.

Part 5: Regression testing

A regression is a fault introduced into a part of the system that used to work, as a side effect of a change. Regression testing means re-running earlier tests after a change, to check that previously working features still work. It is essential because a change in one place can easily break something elsewhere, especially when modules share data or code.

In practice, teams keep a regression test suite: a saved collection of test cases with expected results, ideally run automatically after every change. The C harness from Lesson 08 is a tiny regression suite.

Worked example: CR-14 and a regression

A programmer implements CR-14. The fine function is changed and the test table is updated: old tests whose expected results are unaffected stay as they are (“old”), and new tests for the grace period are added (“new”). The old test for 1 day was removed because its expected result changed; it is replaced by the new 1-day test.

#include <stdio.h>

#define MAXFINE 30
#define GRACE    2   /* CR-14: grace days */

/* fine version 2: CR-14 adds a 2-day
   grace period; other fines unchanged. */
int fine(int d)
{
    int f;
    if (d <= GRACE)            /* CR-14 */
        f = 0;
    else if (d <= 7)
        f = d - GRACE;         /* CR-14 */
    else
        f = 7 + (d - 7) * 2;
    if (f > MAXFINE)
        f = MAXFINE;
    return f;
}

struct Test { int in, want; char *kind; };

int main(void)
{
    struct Test t[] = {
        {0, 0, "old"},  {7, 7, "old"},
        {8, 9, "old"},  {18, 29, "old"},
        {40, 30, "old"}, {1, 0, "new"},
        {2, 0, "new"},  {3, 3, "new"}
    };
    int n = 8, pass = 0;

    for (int i = 0; i < n; i++) {
        int got = fine(t[i].in);
        int ok = (got == t[i].want);
        printf("%s %2d: %2d want %2d %s\n",
               t[i].kind, t[i].in, got,
               t[i].want,
               ok ? "PASS" : "FAIL");
        pass += ok;
    }
    printf("%d of %d passed\n", pass, n);
    return 0;
}

Output:

old  0:  0 want  0 PASS
old  7:  5 want  7 FAIL
old  8:  9 want  9 PASS
old 18: 29 want 29 PASS
old 40: 30 want 30 PASS
new  1:  0 want  0 PASS
new  2:  0 want  0 PASS
new  3:  1 want  3 FAIL
6 of 8 passed

An old test fails: 7 days late used to give $7, and the specification says it still should, but the new code gives $5. The programmer subtracted the grace days from every fine in the first band, which the change request never asked for. Without the old test, this regression would have gone live, and members would have been undercharged. The new 3-day test fails for the same reason.

The fix is to charge the normal rate once the grace period is over:

#include <stdio.h>

#define MAXFINE 30
#define GRACE    2   /* CR-14: grace days */

/* fine version 2.1: CR-14 adds a 2-day
   grace period; other fines unchanged. */
int fine(int d)
{
    int f;
    if (d <= GRACE)            /* CR-14 */
        f = 0;
    else if (d <= 7)
        f = d;
    else
        f = 7 + (d - 7) * 2;
    if (f > MAXFINE)
        f = MAXFINE;
    return f;
}

struct Test { int in, want; char *kind; };

int main(void)
{
    struct Test t[] = {
        {0, 0, "old"},  {7, 7, "old"},
        {8, 9, "old"},  {18, 29, "old"},
        {40, 30, "old"}, {1, 0, "new"},
        {2, 0, "new"},  {3, 3, "new"}
    };
    int n = 8, pass = 0;

    for (int i = 0; i < n; i++) {
        int got = fine(t[i].in);
        int ok = (got == t[i].want);
        printf("%s %2d: %2d want %2d %s\n",
               t[i].kind, t[i].in, got,
               t[i].want,
               ok ? "PASS" : "FAIL");
        pass += ok;
    }
    printf("%d of %d passed\n", pass, n);
    return 0;
}

Output:

old  0:  0 want  0 PASS
old  7:  7 want  7 PASS
old  8:  9 want  9 PASS
old 18: 29 want 29 PASS
old 40: 30 want 30 PASS
new  1:  0 want  0 PASS
new  2:  0 want  0 PASS
new  3:  3 want  3 PASS
8 of 8 passed

All old and new tests pass. The version number in the comment (2.1) and the CR-14 tags record what changed and why, so the next maintainer can follow the history. The test table is now the regression suite for the next change.

Part 6: Maintainability and legacy systems

How expensive each change is depends on decisions made long before: in design and coding. Look back at the features that made CR-14 cheap to implement:

  • The fine rule lived in one function, so only one module changed (high cohesion).
  • Constants such as MAXFINE and GRACE meant each business rule was edited in one place.
  • A saved table of test cases already existed, so regression testing took seconds.
  • Comments and the change ID show the next maintainer what changed and why.

Systems built without these habits become legacy systems: old systems that are still vital to the organisation but are hard and risky to change, often because the original developers have left, the documentation is missing or wrong, or the technology is out of date. Organisations then face a choice: keep paying high maintenance costs, re-engineer the system (restructure and re-document it, a large preventive effort), or replace it with a new system, which starts the life cycle again with a feasibility study.

Try it 3Maintenance drill

“Types” asks for the maintenance type. “Process” checks the process and regression ideas.

Common mistakes

  • Saying maintenance means "fixing bugs". Fault repair is only one of the three kinds of change.
  • Mixing up adaptive and perfective. Adaptive keeps the same features working in a new environment; perfective adds or improves features.
  • Testing only the changed feature. Without regression testing, side effects go unnoticed.
  • Forgetting to update tests whose expected results have legitimately changed.
  • Changing the code but not the documents, so the design and user guide no longer match the system.

Summary

IdeaKey point
EvolutionSoftware must keep changing: faults, environments, organisations and users all change.
Fault repairsCorrective maintenance.
Environmental adaptationAdaptive maintenance.
Functionality additionPerfective maintenance (largest share of effort).
PreventiveRestructure to make future change easier.
ProcessRequest, impact analysis, approval, implement, test, update documents, release.
Regression testingRe-run earlier tests after every change.

Review questions

1. Why must software be maintained after it is delivered?

Show answer

Faults are found in use; the environment (hardware, operating systems, laws) changes; the organisation’s needs change; users want new features. Without change the system becomes less useful.

2. Name and explain the THREE kinds of software change in the syllabus, with an example of each.

Show answer

Fault repairs (corrective): fixing errors, such as a report listing a record twice. Environmental adaptation (adaptive): changing the system to work in a new environment, such as a new operating system. Functionality addition (perfective): adding or changing features, such as online renewals.

3. Distinguish between adaptive and perfective maintenance.

Show answer

Adaptive maintenance keeps existing functions working in a changed environment. Perfective maintenance adds new functions or improves existing ones in response to changed requirements.

4. What is preventive maintenance?

Show answer

Changing a system to make future maintenance easier, such as restructuring code or improving documentation, without changing its behaviour.

5. Outline the steps in handling a change request.

Show answer

Record the request; carry out impact analysis; approve and plan the release; implement the change; test it, including regression testing; review and update documentation; release the new version.

6. What is regression testing, and why is it needed?

Show answer

Re-running earlier tests after a change to check that features that worked before still work. A change can have side effects that break other parts of the system.

7. Why must documentation be reviewed after every change?

Show answer

So that requirements, design documents, code comments, tests and user guides match the system. Out-of-date documents mislead future maintainers and users.

Homework

  1. Write three change requests for an app you use: one corrective, one adaptive and one perfective. For each, list the documents that would need updating.
  2. Extend regress_fixed.c with a new change: seniors (a flag passed to fine) pay half the normal fine, rounded down. Add new tests and keep all old tests. Run the full suite.
  3. Find a place in one of your own C programs where a change could cause a regression. Write two tests that would catch it.

Mastery quiz: Evolution and maintenance

This 10-question quiz is separate from the short Quick quiz at the end of the lesson. Score 8/10 or higher to earn this lesson’s badge. Your best score is saved in this browser on this device.

Mastery quiz: Software Evolution and Maintenance

Your course badges: loading saved progress…

View badges

    No course badges earned yet. Score 8/10 in a lesson quiz to earn its badge.

    Saved in this browser on this device. Clearing browser data may remove your badges.

    Answer all 10 questions. Earn this lesson’s badge at 8/10 or higher. Read the explanations, revisit the Try it activities and retry as often as you need. These are self-study badges, not formal grades.

    1. Changing software after delivery to keep it useful is called
    2. Fixing a fault found after release is
    3. Making a system work on a new operating system is
    4. Adding a feature users have asked for is
    5. Restructuring code to make future changes easier, with no change in behaviour, is
    6. Re-running earlier tests after a change is
    7. Working out which modules and documents a change affects is
    8. Which type usually takes the largest share of maintenance effort?
    9. In the CR-14 example, why did the 7-day test fail?
    10. After a change, a user guide still describes the old behaviour. What was missed?

    Exam tips

    Specimen Unit 2 Paper 01 (2021), Item 19. This item describes a system being changed after delivery to meet changing needs and asks you to name the activity or phase. Learn "evolution" and "maintenance" as names for the same phase, and the three kinds of change with their maintenance types.

    When asked to describe a type of maintenance, give the meaning and an example from the scenario. For regression testing, always say both what it is (re-running earlier tests) and why (changes can break previously working features).

    Previous: Unit 2 • Module 2 • Lesson 08 – Validating Software: Test Plans, Black-Box and White-Box Testing. Next: Unit 2 • Module 2 • Lesson 10 – Professional Issues: Intellectual Property, Privacy, Computer Misuse and Threats.

    Syllabus link: CAPE Computer Science (CXC A19/U2/21), Software Engineering (Unit 2, Module 2). Specific Objective 8: the evolution phase, including why maintenance is needed; fault repairs, environmental adaptation and functionality addition; types of maintenance; documentation review; regression testing.

    Video search terms

    Search YouTube for: "types of software maintenance corrective adaptive perfective preventive", "regression testing explained", "software change management impact analysis".

    Try it 4Quick quiz

    Tap an answer. All eight questions are self-checks on this lesson.

    Updates

    2026/12/01

    - First version of the lesson.

    © 2026 islandclass.org

    Leave a Reply