Cambridge AS & A Level9608

Software development (4.4)

Computer Science 9608 Chapter Notes

What this chapter covers

Software development
ShareWhatsAppPost
Software development (4.4) notes

Unable to load PDF

The notes viewer could not load. Please refresh the page.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full Software development (4.4) notes as text: skim, search, and jump between subtopics.

~18 min read

1. The Development Process and Tools

Modern software is rarely built by a single person. Large projects are developed by teams, often spread across different locations. To manage this complexity and work efficiently, developers use various tools. Key among these are program libraries and program generators. A program library is a collection of pre-written, pre-tested code (like functions or subroutines) that can be reused in many different projects. This saves significant time and effort. For example, instead of writing code to draw a window on the screen from scratch, a developer can use a routine from a graphics library. A program generator is a tool that creates source code automatically from a higher-level description, such as a diagram or a set of parameters, which further speeds up routine coding tasks.

Key term

Program Library: A collection of pre-written and pre-tested code modules that can be reused in new programs, saving development time and reducing errors.

Fun fact

The Python Package Index (PyPI), a vast repository of program libraries, hosts over 500,000 projects, demonstrating the immense scale of code reuse in modern development.

Worked example 14 marks

A team is developing a new video game. Explain two benefits of using a physics engine library instead of writing all the physics code from scratch.

  1. 1

    Benefit 1: Reduced Development Time. The team does not need to spend months writing and debugging complex physics calculations for gravity, collisions, and motion. They can use the library's pre-built functions, allowing them to focus on the unique gameplay elements of their game.

  2. 2

    Benefit 2: Increased Reliability. Professional physics libraries are extensively tested and optimized for performance. Using a well-established library means the physics in the game is likely to be more stable, realistic, and have fewer bugs than a custom solution written under a tight deadline.

Recap

  • Large software projects are typically developed by teams.
  • Program libraries provide reusable, pre-tested code to speed up development.
  • Using libraries reduces development time and increases the reliability of the final software.
  • Program generators automatically create source code from a high-level specification.
  • Teamwork and specialized tools are essential for managing the complexity of modern software development.

Quick check

  1. State one reason why a developer might use a program library.1 mark
  2. What is the primary role of a program generator?1 mark

2. Understanding and Exposing Errors

An error, or 'bug', is a fault in a program that causes it to behave in an unintended way. Understanding the different types of errors is the first step to fixing them. There are three main categories:

  1. Syntax Errors: These are grammatical mistakes that violate the rules of the programming language. For example, misspelling a keyword like `PRNT` instead of `PRINT`. The compiler or interpreter will detect these errors and prevent the program from running.
  2. Logic Errors: The program runs, but produces the wrong output or behaves incorrectly. The syntax is correct, but the algorithm itself is flawed. For example, calculating an average by dividing by the wrong number of items.
  3. Run-time Errors: These errors occur while the program is executing. They are often caused by unexpected circumstances, like trying to divide by zero or attempting to open a file that doesn't exist. These errors typically cause the program to crash.

Key term

Logic Error: An error in the program's algorithm that causes it to produce incorrect or unexpected results, even though the program runs without crashing.

Examiner insight

Examiners expect you to not only identify the type of error but also to explain *why* it fits that category, often with reference to a specific line of code.

Worked example 13 marks

The following pseudocode algorithm is intended to calculate the total of five numbers entered by a user. Identify the error type and correct the code.

01 Total = 1 02 FOR Count = 1 TO 5 03 INPUT Number 04 Total = Total + Number 05 NEXT Count 06 OUTPUT Total

  1. 1
    1. Error Identification: The error is a logic error. The program will run without crashing (no syntax or run-time error) but will produce an incorrect result.
  2. 2
    1. Error Analysis: The variable `Total` is initialized to 1 on line 01. This means the final output will always be 1 greater than the correct sum of the five input numbers.
  3. 3
    1. Correction: The `Total` variable should be initialized to 0 to act as a correct accumulator. The corrected line is: `01 Total = 0`.

Recap

  • Syntax errors are caught by the translator before the program runs.
  • Logic errors cause incorrect output or behaviour, and are often the hardest to find.
  • Run-time errors occur during program execution and can cause it to crash.
  • Testing is the process of deliberately trying to find these errors.
  • The goal of testing is to increase confidence in the software's correctness.

Quick check

  1. A program crashes when the user enters 'abc' for their age. What type of error is this?1 mark
  2. Which type of error is found by a compiler?1 mark

3. Testing Methods: An Overview

To find errors, developers use a variety of testing methods. These can be broadly categorized as static or dynamic. Static testing involves examining the code or documentation without executing the program. It's like proofreading an essay. The main static methods are:

  • Dry Run: A developer manually steps through an algorithm using a set of test data, often with a trace table to track variable values. This is a mental or on-paper exercise to check the logic.
  • Walkthrough: A formal review process where a developer presents their code to a small group of peers. The team asks questions and provides feedback to identify potential issues, inconsistencies, or logical flaws.

Dynamic testing involves executing the program with test data to see how it behaves. This is where the program is actually run on a computer. The two main approaches to dynamic testing are white-box and black-box testing.

Key term

Walkthrough: A peer-review process where a developer guides team members through their code to receive feedback and identify errors.

Common pitfall

Confusing a dry run with a walkthrough. A dry run is a solitary check of logic by tracing data, whereas a walkthrough is a collaborative review focused on code quality and correctness.

Worked example 14 marks

A junior programmer has just finished writing a complex sorting module. Their manager suggests they perform a code walkthrough before integrating it with the main application. Explain two potential benefits of this approach.

  1. 1
    1. Early Error Detection: The walkthrough allows other developers to review the code's logic before it is even run. They might spot logical errors, inefficient code, or non-compliance with coding standards that the original programmer missed. Finding these errors at this early stage is much cheaper and faster than finding them after integration.
  2. 2
    1. Knowledge Sharing: The walkthrough process shares knowledge of how the module works with other team members. This is beneficial because it means more than one person understands the code, which helps with future maintenance and reduces risk if the original programmer leaves the team.

Recap

  • Static testing methods analyse code without executing it.
  • A dry run involves manually tracing the execution of an algorithm.
  • A walkthrough is a peer-review process to find defects and improve code quality.
  • Dynamic testing involves running the program with test data.
  • Static testing helps find errors early in the development cycle.

Quick check

  1. Is a dry run an example of static or dynamic testing? Justify your answer.2 marks

4. White-Box and Black-Box Testing

White-box and black-box testing are two fundamental approaches to dynamic testing. The key difference is the tester's knowledge of the software's internal structure.

White-Box Testing: In this method, the tester has full access to the source code and understands the internal logic, data structures, and paths through the program. The goal is to test these internal structures. Test cases are designed to ensure that every statement is executed, every branch (e.g., in an IF or CASE statement) is taken, and every loop is tested. It is also known as structural or glass-box testing.

Black-Box Testing: In this method, the tester has no knowledge of the internal code or logic. The software is treated as a 'black box'. The tester only knows what the software is supposed to do, based on its requirements specification. Test cases are created based on inputs and the expected outputs. This method is focused entirely on functionality and is also known as functional testing.

Key term

Black-Box Testing: A testing method where the tester has no knowledge of the internal workings of the software and tests the system based on its inputs and expected outputs.

Examiner insight

Candidates score highly when they can clearly link white-box testing to code paths and black-box testing to requirements and specifications.

Worked example 14 marks

A function is designed to check if a user-entered password is valid. The rule is that the password must be at least 8 characters long. Describe one white-box and one black-box test you would perform.

  1. 1
    1. Black-Box Test: Based on the requirement, I would treat the function as a black box. I would provide an input of 'pass123' (7 characters) and check that the output is 'Invalid'. I would then provide an input of 'password123' (11 characters) and check that the output is 'Valid'. This tests the functionality without seeing the code.
  2. 2
    1. White-Box Test: Assuming I can see the code `IF LENGTH(Password) < 8 THEN...`, my goal is to test this internal structure. I would design a test case with a password of exactly 7 characters to ensure the `TRUE` path of the `IF` statement is executed. I would also design a test case with a password of exactly 8 characters to ensure the `FALSE` path is executed. This directly tests the branches in the code.

Recap

  • White-box testing requires knowledge of the internal code structure.
  • The goal of white-box testing is to test every path and statement in the code.
  • Black-box testing requires no knowledge of the internal code.
  • The goal of black-box testing is to verify the software's functionality against its requirements.
  • White-box testing is also called structural testing; black-box is also called functional testing.

Quick check

  1. Which testing method, white-box or black-box, is best for verifying that a program meets the user's requirements specification?1 mark
  2. To ensure every line of code has been executed at least once, what type of testing would you use?1 mark

5. Levels of Testing

Software testing is not a single event but a series of activities that occur at different stages of the development lifecycle. These stages are known as levels of testing.

  1. Integration Testing: After individual modules or components have been tested in isolation (unit testing), they are combined and tested as a group. Integration testing aims to find errors in the interfaces and interactions between these integrated modules.
  2. Alpha Testing: This is the first phase of testing by end-users. It is performed in-house by the organisation's own QA team or testers before the product is released externally. The goal is to find as many bugs as possible in a controlled environment.
  3. Beta Testing: After passing alpha testing, the software is released to a limited number of external users (beta testers) in the real world. These users use the software in their own environment and report back any bugs or issues they find. This is often the final stage of testing before a general release.
  4. Acceptance Testing: This is the final testing phase, performed by the client or customer. They test the software to ensure it meets all the requirements laid out in the contract and is 'fit for purpose'. If the software passes acceptance testing, the client formally 'accepts' the product.

Key term

Acceptance Testing: The final phase of testing where the client determines if the software meets the agreed-upon requirements and is ready for delivery.

Fun fact

Many large tech companies, like Google and Microsoft, run perpetual beta programs for their software, continuously gathering feedback from millions of users.

Worked example 12 marks

A software company has developed a new accounting application for a specific client. The application is now feature-complete. The client has arrived at the company's office to perform the final checks before signing off on the project. What level of testing is being described, and who is performing it?

  1. 1
    1. Level of Testing: This is Acceptance Testing.
  2. 2
    1. Justification: The testing is being performed by the client to verify that the software meets their specific requirements and is ready for delivery. This is the definition of acceptance testing, which is the final step before the project is formally completed and handed over.

Recap

  • Integration testing checks the interfaces between combined software modules.
  • Alpha testing is in-house testing by internal teams before any external release.
  • Beta testing involves releasing the software to a limited number of external users.
  • Acceptance testing is performed by the client to confirm the software meets their requirements.
  • These testing levels follow a logical progression: Integration -> Alpha -> Beta -> Acceptance.

Quick check

  1. Who typically performs Beta testing?1 mark
  2. What is the main purpose of integration testing?1 mark

6. Test Planning and Data Selection

Effective testing is not random; it is a planned and systematic process. A Test Plan is a formal document that outlines the entire testing strategy. It details the scope of testing, the features to be tested, the resources required, the schedule, and the specific test cases. A crucial part of a test plan is the selection of appropriate test data. Test data is chosen to systematically check the software's behaviour. There are three main types:

  1. Normal Data: Sensible, valid data that the program should accept and process correctly. This tests the program's normal operation.
  2. Abnormal (or Erroneous) Data: Data that is invalid and should be rejected by the program. This tests the program's error-handling capabilities, ensuring it doesn't crash and provides a helpful error message.
  3. Extreme/Boundary Data: Data that is at the very limits of the valid range. This is used to check how the program handles edge cases. For a given range, there are typically two boundary values (the lower and upper limit) and values just outside the boundary.

Key term

Boundary Data: Test data that is at the upper or lower limits of a valid range, used to check how the program handles edge cases.

Common pitfall

Only testing one boundary value. For any range, you must test both the minimum and maximum valid values to be thorough.

Worked example 15 marks

A program requires the user to enter a ticket quantity. The valid range is an integer from 1 to 10 inclusive. Provide one piece of normal data, two pieces of boundary data, and two pieces of abnormal data for a test plan.

  1. 1
    1. Normal Data: 5 (Any integer between 1 and 10, e.g., 2, 7, 9).
  2. 2
    1. Boundary Data: 1 and 10 (The lowest and highest valid values).
  3. 3
    1. Abnormal Data: 0 and 11 (Values just outside the valid boundaries). Other examples could be -5, 'three', or 2.5, which test for different types of invalid input.

Recap

  • A test plan is a document that describes the strategy and scope of testing.
  • Normal test data is valid data used to check expected functionality.
  • Abnormal test data is invalid data used to check the program's error handling.
  • Boundary test data is data at the edges of valid ranges.
  • Testing both boundaries is crucial for robust software.

Quick check

  1. For a program that accepts exam scores from 0 to 100, what are the two boundary data values?1 mark
  2. What is the purpose of using abnormal data in testing?1 mark

7. Project Planning with Gantt Charts

Managing a software project involves coordinating many tasks, people, and deadlines. Project planning techniques are essential for this. A Gantt chart is a popular tool for visualizing a project schedule. It is a type of bar chart where the vertical axis lists the tasks to be performed, and the horizontal axis represents time. Each task is represented by a bar; the position and length of the bar reflect the start date, duration, and end date of the task. Gantt charts are excellent for showing 'what' needs to be done and 'when'. They can also show dependencies between tasks, often with arrows linking the end of one task to the beginning of another. This helps managers see which tasks must be completed before others can start, and allows them to track progress against the original plan.

Key term

Gantt Chart: A type of bar chart that illustrates a project schedule, showing the start and finish dates of the tasks within a project.

Worked example 14 marks

A project has the following tasks: Task A (2 weeks), Task B (3 weeks, starts after A), Task C (1 week, starts after A), Task D (2 weeks, starts after B and C). Create a simple Gantt chart for this project.

  1. 1
    1. Set up the axes: The vertical axis will list tasks A, B, C, D. The horizontal axis will be time in weeks (e.g., Week 1, Week 2, ...).
  2. 2
    1. Plot Task A: Draw a bar for Task A starting at Week 1 and extending for 2 weeks, ending at the end of Week 2.
  3. 3
    1. Plot Task B: Task B depends on A. Draw a bar for Task B starting at Week 3 and extending for 3 weeks, ending at the end of Week 5.
  4. 4
    1. Plot Task C: Task C also depends on A. Draw a bar for Task C starting at Week 3 and extending for 1 week, ending at the end of Week 3. Note that Tasks B and C run in parallel.
  5. 5
    1. Plot Task D: Task D depends on B and C. The latest finishing dependency is Task B (end of Week 5). So, draw a bar for Task D starting at Week 6 and extending for 2 weeks, ending at the end of Week 7. The total project duration is 7 weeks.

Recap

  • Gantt charts are bar charts used for project scheduling.
  • The horizontal axis represents time, and the vertical axis lists tasks.
  • The length of a bar shows the duration of a task.
  • Gantt charts can visualize task dependencies.
  • They are used to track progress and manage project timelines.

Quick check

  1. On a Gantt chart, what does the length of a bar represent?1 mark

8. Analysing Dependencies with PERT Charts

While Gantt charts are good for scheduling, PERT (Program Evaluation and Review Technique) charts excel at showing the dependencies and logical flow of a project. A PERT chart is a network diagram. It consists of:

  • Nodes (circles or boxes): These represent project milestones or events (the start or end of a task).
  • Arcs (arrows): These represent the actual tasks, showing the dependency between nodes. Each arc is labelled with the task name and its duration.

A key concept in PERT is the Critical Path. This is the longest possible path of sequential tasks through the network diagram from the start node to the finish node. The length of the critical path determines the minimum time required to complete the entire project. Any delay in a task that lies on the critical path will delay the entire project. Tasks not on the critical path have 'float' or 'slack', meaning they can be delayed slightly without affecting the project's overall finish date.

Key term

Critical Path: The sequence of tasks in a project which determines the minimum time for completion; any delay on this path delays the entire project.

Examiner insight

Marks are often awarded for correctly identifying all possible paths in a PERT chart before determining which one is critical. Show your working for the duration of each path.

Worked example 14 marks

A project has tasks A(2), B(4), C(3), D(5), E(2). Dependencies are: B and C start after A finishes. D starts after B finishes. E starts after C finishes. The project is complete when D and E are both finished. Identify the critical path and the minimum project completion time.

  1. 1
    1. Visualize the paths: There are two main paths from the start to the finish of the project.
  2. 2
    1. Path 1: Through tasks A, B, and D. The duration is the sum of the durations of these tasks.
  3. 3
    1. Calculate Path 1 duration: Duration(A) + Duration(B) + Duration(D) = 2 + 4 + 5 = 11 weeks.
  4. 4
    1. Path 2: Through tasks A, C, and E. The duration is the sum of the durations of these tasks.
  5. 5
    1. Calculate Path 2 duration: Duration(A) + Duration(C) + Duration(E) = 2 + 3 + 2 = 7 weeks.
  6. 6
    1. Identify Critical Path: The critical path is the longer of the two paths. In this case, Path 1 (A-B-D) is the critical path.
  7. 7
    1. State Minimum Completion Time: The minimum time to complete the project is the length of the critical path, which is 11 weeks.

Recap

  • PERT charts are network diagrams showing task dependencies.
  • Nodes represent milestones, and arcs represent tasks with durations.
  • The critical path is the longest path through the PERT chart.
  • The length of the critical path defines the minimum project duration.
  • Any delay on a critical path task delays the whole project.

Quick check

  1. If a task on the critical path is delayed by 3 days, what is the effect on the project's completion date?1 mark
  2. What is the term for the amount of time a non-critical path task can be delayed without affecting the project finish date?1 mark

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. Explain two ways in which using a pre-existing program library can benefit a software development team.4 marks
  2. Distinguish between a logic error and a run-time error. Provide a simple example for each.4 marks
  3. A website form has a field for a user's year of birth, which must be between 1920 and 2010. Identify one piece of normal, one piece of abnormal, and two pieces of boundary test data.4 marks
  4. Compare and contrast white-box testing and black-box testing, mentioning the tester's knowledge and the primary goal of each.4 marks
  5. A video game company is about to release a major update. First, they let their internal Quality Assurance department test it. Then, they release it to 10,000 players who have signed up to test. Identify and describe the two levels of testing being used.4 marks
  6. Describe the purpose of a dry run and a code walkthrough in the context of static testing.4 marks
  7. A project has the following tasks and dependencies: Task P (4 days). Task Q (5 days, after P). Task R (3 days, after P). Task S (2 days, after Q and R). Draw a simple Gantt chart for this project and state the total project duration.5 marks
  8. A PERT chart shows two paths to project completion. Path 1 consists of tasks A(3), C(5), and F(4). Path 2 consists of tasks B(4), D(2), and E(7). All tasks are measured in weeks. Identify the critical path and calculate the minimum project completion time.3 marks
  9. Why is a formal test plan considered essential for large software projects?2 marks
  10. A bank has commissioned a new mobile banking app. Before the app is released to the public, the bank's own managers test every feature to ensure it matches the original contract. What is this final level of testing called and why is it performed?3 marks

Go deeper

Practise and revise with member-only material for this chapter.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters