Show understanding of ways of exposing and avoiding faults in programs

Resources | Subject Notes | Computer Science

Cambridge A-Level Computer Science 9618 - 12.3 Program Testing and Maintenance

12.3 Program Testing and Maintenance

This section explores the crucial aspects of ensuring program correctness and maintaining software over its lifecycle. It covers various techniques for identifying and preventing faults, as well as strategies for ongoing maintenance.

Testing Techniques

Testing is the process of executing a program with the intention of finding errors. Several testing techniques are commonly employed:

  • Black Box Testing: Testing without knowledge of the internal program structure. Focuses on input and output.
  • White Box Testing: Testing with knowledge of the internal program structure. Aimed at verifying code paths and conditions.
  • Boundary Value Analysis: Testing at the edges of valid and invalid input ranges.
  • Equivalence Partitioning: Dividing input data into classes where the program should behave the same.
  • Decision Table Testing: Creating tables to cover all possible combinations of inputs and their effects on the output.
  • State Transition Testing: Testing based on the different states a system can be in and the transitions between them.

Fault Prevention Techniques

Employing techniques during the development process can significantly reduce the likelihood of faults:

  1. Modular Design: Breaking down a program into smaller, independent modules.
  2. Code Reviews: Having other developers examine the code for potential errors.
  3. Static Analysis: Using tools to analyze code without executing it, looking for potential problems.
  4. Formal Methods: Using mathematical techniques to specify and verify program behavior.
  5. Use of Design Patterns: Applying well-established solutions to common design problems.

Program Maintenance

Maintenance involves modifying a program after it has been deployed. It's a significant part of the software lifecycle and can be broadly categorized into:

Type of Maintenance Description Examples
Corrective Maintenance Fixing faults in the program. Bug fixes, error handling improvements.
Adaptive Maintenance Modifying the program to adapt to changes in the environment. Changing operating systems, adapting to new hardware.
Perfective Maintenance Improving the program's performance or adding new features. Optimizing code, adding user interface enhancements.

Effective maintenance requires good documentation and a clear understanding of the program's design.