CS 410/510 - Software Engineering

Software Evolution

Reference: Sommerville, Software Engineering, 10 ed., Chapter 9

The big picture

There are many reasons why software change is inevitable:

A key problem for all organizations is implementing and managing change to their existing software systems.

Organizations have huge investments in their software systems - they are critical business assets. To maintain the value of these assets to the business, they must be changed and updated. The majority of the software budget in large companies is devoted to changing and evolving existing software rather than developing new software. A spiral model of development and evolution represents how a software system evolves through a sequence of multiple releases.

Evolution processes

Software evolution processes depend on:

Proposals for change are the driver for system evolution. These should be linked with components that are affected by the change, thus allowing the cost and impact of the change to be estimated. Change identification and evolution continues throughout the system lifetime.

Change implementation can be viewed as an iteration of the development process where the revisions to the system are designed, implemented and tested. A critical difference is that the first stage of change implementation may involve program understanding, especially if the original system developers are not responsible for the change implementation. During the program understanding phase, you have to understand how the program is structured, how it delivers functionality and how the proposed change might affect the program.

Agile methods are based on incremental development so the transition from development to evolution is a seamless one. Evolution is simply a continuation of the development process based on frequent system releases. Automated regression testing is particularly valuable when changes are made to a system. Changes may be expressed as additional user stories.

Program evolution dynamics

Program evolution dynamics is the study of the processes of system change. The system requirements are likely to change while the system is being developed because the environment is changing, therefore a delivered system won't meet its requirements. Systems are tightly coupled with their environment. When a system is installed in an environment it changes that environment and therefore changes the system requirements. Systems MUST be changed if they are to remain useful in an environment.

After several major empirical studies, Lehman and Belady proposed that there were a number of 'laws' which apply to all systems as they evolved. There are sensible observations rather than laws. They are applicable to large systems developed by large organizations.

Law Description
Continuing change A program that is used in a real-world environment must necessarily change, or else become progressively less useful in that environment.
Increasing complexity As an evolving program changes, its structure tends to become more complex. Extra resources must be devoted to preserving and simplifying the structure.
Large program evolution Program evolution is a self-regulating process. System attributes such as size, time between releases, and the number of reported errors is approximately invariant for each system release.
Organizational stability Over a program's lifetime, its rate of development is approximately constant and independent of the resources devoted to system development.
Conservation of familiarity Over the lifetime of a system, the incremental change in each release is approximately constant.
Continuing growth The functionality offered by systems has to continually increase to maintain user satisfaction.
Declining quality The quality of systems will decline unless they are modified to reflect changes in their operational environment.
Feedback system Evolution processes incorporate multi agent, multi loop feedback systems and you have to treat them as feedback systems to achieve significant product improvement.

Software maintenance

Software maintenance focuses on modifying a program after it has been put into use. The term is mostly used for changing custom software. Generic software products are said to evolve to create new versions. Maintenance does not normally involve major changes to the system's architecture. Changes are implemented by modifying existing components and adding new components to the system.

Types of software maintenance include:

Maintenance costs are usually greater than development costs (2x to 100x depending on the application). Costs are affected by both technical and non-technical factors; they tend to increase as software is maintained. Maintenance corrupts the software structure making further maintenance more difficult. Aging software can have high support costs (e.g. old languages, compilers etc.).

Maintenance cost factors include:

Maintenance prediction is concerned with assessing which parts of the system may cause problems and have high maintenance costs. Predicting the number of changes requires and understanding of the relationships between a system and its environment. Tightly coupled systems require changes whenever the environment is changed. Factors influencing this relationship are:

Predictions of maintainability can be made by assessing the complexity of system components. Studies have shown that most maintenance effort is spent on a relatively small number of system components. Complexity depends on:

Process metrics may be used to assess maintainability; if any or all of these is increasing, this may indicate a decline in maintainability:

System reengineering refers to restructuring or rewriting part or all of a legacy system without changing its functionality. It is applicable where some but not all sub-systems of a larger system require frequent maintenance. Reengineering involves adding effort to make them easier to maintain. The system may be restructured and re-documented. Advantages of reengineering include:

Reengineering process activities include:

Refactoring is the process of making improvements to a program to slow down degradation through change. You can think of refactoring as 'preventative maintenance' that reduces the problems of future change. Refactoring involves modifying a program to improve its structure, reduce its complexity or make it easier to understand. When you refactor a program, you should not add functionality but rather concentrate on program improvement. Reengineering takes place after a system has been maintained for some time and maintenance costs are increasing. You use automated tools to process and reengineer a legacy system to create a new system that is more maintainable. Refactoring is a continuous process of improvement throughout the development and evolution process. It is intended to avoid the structure and code degradation that increases the costs and difficulties of maintaining a system.

'Bad smells' of code are stereotypical situations in which the code of a program can be improved through refactoring:

Legacy system management

Organizations that rely on legacy systems must choose a strategy for evolving these systems. The chosen strategy should depend on the system quality and its business value:

AI and Software Testing

Software testing is about designing, executing, and evaluating tests to find defects, assess quality, and provide confidence that a system meets its requirements. Large Language Models (LLMs) are increasingly used to assist with generating test ideas, test cases, and even test automation code. They can help reduce grunt work, but they also bring risks: AI-generated tests often emphasize "typical" behavior and may miss corner cases, nonfunctional concerns, and environment-specific behaviors that matter for real quality.

Where LLMs help in software testing? Below are common uses and what to be cautious about:

Generating test ideas and scenarios
LLMs can propose test cases from a requirement or spec text, including edge cases and negative scenarios you might overlook. This can expand your test scope quickly. The risk is that models may still focus on the "happy path" or generate cases that are irrelevant because they misinterpret the domain or constraints.
Drafting automated test code
LLMs can produce unit tests, integration tests, and mocks based on function signatures or example behaviors. This accelerates test authoring and lowers the initial barrier. The risk is generated tests may be syntactically valid but logically weak (assertions that always pass, missing validation of key behaviors) or violate project conventions.
Test documentation and traceability
LLMs can help write test plans, summarize test results, and connect tests to requirements. This is useful for reporting. The risk is that summaries can be shallow or inaccurate, and traceability outputs may overclaim coverage if not grounded in real test status and metrics.
Mutation and fuzz test suggestions
LLMs can suggest variations on inputs for fuzz testing or mutation testing ideas that explore unusual value combinations. The risk is absence of formal guarantees: the model cannot ensure these variations are meaningful for robustness or security without human interpretation and execution.
Regression test maintenance
LLMs can identify candidate tests that may be obsolete after code changes and suggest updates. This helps keep suites relevant. The risk is misalignment with true behavior change if the model does not understand semantics or contextual dependencies.

Bottom line: LLMs can be effective at generating ideas and scaffolding tests, but they cannot replace the careful thinking required to design meaningful, robust tests that truly evaluate correctness, performance, security, and other quality attributes. Human review and validation remain essential.

A simple guided example

Scenario:
You have a function that calculates the total cost of an order with discounts and taxes; you want test cases that cover typical and edge behaviors.
Prompt to an LLM:
"Generate unit test cases for an order total function. Include scenarios with zero items, high discount rates, tax boundary conditions, and invalid input."
Typical Output (Excerpt):
"Test: no items => total 0. Test: discount 0 => normal sum. Test: discount greater than 100% => total 0. Test: negative quantity => error."
Why this helps:
The model produces a range of plausible test cases and identifies some edge conditions you might otherwise overlook.
Why this can mislead:
The model may assume arbitrary boundaries (e.g., discount >100%), ignore domain constraints (max quantity limits), or miss nonfunctional scenarios (performance with large inputs, concurrency issues).
Discussion point:
Which test cases would you add that the model did not suggest? Are there domain rules that the model could not infer from the prompt?

Key Takeaways

AI and Software Evolution

Software evolution concerns how systems change over time to fix defects, add features, improve quality, or adjust to new environments. It includes maintenance, refactoring, reengineering, and adaptation to changing requirements or technology. Large Language Models (LLMs) are increasingly used in evolution tasks, particularly for understanding large codebases, suggesting changes, and drafting update artifacts. However, evolution is not just about producing updated code; it's about preserving system intent, architectural integrity, and long-term quality. LLMs can assist with parts of this work, but they do not replace the deep understanding and judgment required to evolve software responsibly.

Where LLMs help in software evolution? Below are common uses and what to watch out for:

Understanding legacy code
LLMs can summarize functions, explain code snippets in plain language, and help locate relevant logic in large, unfamiliar codebases. This accelerates onboarding. The risk is that summaries can gloss over subtle behavior, hidden dependencies, or context that only emerges through inspection and testing.
Suggesting refactorings
LLMs can propose ways to simplify or reorganize code (e.g., extract method, rename for clarity). This can help improve readability. The risk is that suggestions may not preserve semantics, may ignore performance implications, or may create coupling issues if applied without human discernment.
Drafting modification patches
LLMs can generate code changes for small features or bug fixes given a description. This speeds up initial drafts. The risk is that generated patches may be syntactically valid but semantically incorrect, inefficient, or incompatible with the system's design constraints.
Updating documentation
LLMs can update comments, generate change logs, and draft migration notes. This encourages better documentation practices. The risk is that documentation can become decoupled from actual code behavior if the model misinterprets intent or misses context.
Regression risk analysis
LLMs can suggest where regressions might occur based on a textual description of the intended change. This supports test planning. The risk is that such suggestions are heuristic guesses, not evidence-based analysis; they cannot replace rigorous regression testing.

Bottom line: LLMs can help evolve software by summarizing, suggesting, and drafting, but evolution still requires engineering judgment, deep understanding of system behavior and constraints, and rigorous validation through testing and analysis.

A simple guided example

Scenario:
You need to update a module to support a new configuration parameter that changes how logging behaves, and you want an initial patch draft and a summary of impacts.
Prompt to an LLM:
"Given this function and the description of the new configuration parameter, draft a patch that implements the behavior change and summarize what tests will be needed to validate it."
Typical Output (Excerpt):
"Patch: add parameter handling and conditional logic. Tests: parameter set to default, parameter set to edge values..."
Why this helps:
The model gives you a starting point for the patch and highlights candidate tests so you can plan evolution work more quickly.
Why this can mislead:
The model may not understand interactions with other modules, performance or concurrency implications, or deeper constraints (backward compatibility, security). It may also assume default behaviors that are not correct in your context.
Discussion point:
What nonfunctional concerns (performance, backward compatibility, security) should you consider before applying the draft patch? Which tests address those concerns?

Key Takeaways