A Level Computer Science · Chapter 6 · Component 01: Computer systems
Building software is a project with users, deadlines and risks, so teams follow a methodology that sets out the stages of the work and how often users see progress.
This chapter teaches the stages of the systems development life cycle and four methodologies: waterfall, agile with extreme programming, the spiral model and rapid application development. It also teaches how to plan a project with a critical path, and how to choose the right methodology for a project.
In this chapter · jump to a section
Start here
Your route through this chapter
By the end of this chapter you will be able to:
- describe the stages of the systems development life cycle, from feasibility to maintenance
- describe the waterfall model and explain why late changes are expensive in it
- describe agile methods and extreme programming, and use velocity to plan sprints
- describe the spiral model and rank risks by their exposure
- describe rapid application development, prototyping and timeboxing
- find the critical path and the slack of tasks in a project plan
- choose and justify a methodology for a given project
Time: two sessions, about 3 hours, plus the programming task.
You need first: nothing beyond general programming experience. Testing is taught in full in Development environments, testing and computational methods.
The big picture
The big picture
Most software is not written by one person in an afternoon. A school's timetabling system, a bank's mobile app or a hospital's patient records may take a team of people months or years to build. The team must find out what the users need, design a solution, write and test the code, and then keep the system running for years afterwards.
A methodology is an agreed way of organising that work. It says which stages the project goes through, in what order, and how often the users are shown what has been built. Different methodologies make different trade-offs between predictability, flexibility and risk.
The waterfall model goes through the stages once, in strict order, finishing each before the next begins. Agile methods build the software in short cycles, showing it to users every few weeks and changing direction as they learn. The spiral model repeats the stages in loops, each starting with an analysis of what could go wrong. Rapid application development builds prototypes quickly and refines them with the users.
No methodology is best for every project. A system whose requirements are fixed by law, such as payroll software, suits a careful, planned approach. A new app whose users are not yet sure what they want suits a flexible one. Knowing the strengths and weaknesses of each methodology lets a team choose well.
Getting this choice wrong is one of the most common reasons software projects fail. A project can be finished on time and still fail, because it does the wrong thing. Another can do exactly the right thing but arrive a year late and far over budget. Methodologies exist to reduce both dangers: building the wrong system, and building the right system badly.
Whatever methodology is chosen, the team must also plan the work. Some tasks depend on others, so they must wait; other tasks can run at the same time. Critical path analysis finds the shortest time in which the whole project can be finished, and shows which tasks must not slip.
Section 1
The systems development life cycle
The stages
Every software project passes through the same broad stages, whatever methodology it follows. The methodologies differ in how they order and repeat these stages, not in which stages exist.
A feasibility study comes first. It asks whether the project is worth doing and possible to do. It looks at whether the technology exists, whether the cost is justified by the benefits, whether the project can be finished in time, and whether it would be legal. If the answer is no, the project stops here, having cost very little.
The parts of a feasibility study are often remembered by their headings. Technical feasibility asks whether the hardware and software needed exist and whether the team has the skills to use them. Economic feasibility compares the costs with the benefits. Legal feasibility checks laws such as data protection. Operational feasibility asks whether staff will be able and willing to use the system, and schedule feasibility asks whether it can be ready in time.
Requirements analysis finds out exactly what the system must do. Analysts interview users, watch them work, hand out questionnaires and study the documents the current system uses. The result is a requirements document, which lists what the new system must do and the standards it must meet.
Each way of gathering requirements has strengths. Interviews give detailed answers and let the analyst ask follow-up questions, but they take time, so only a few people can be interviewed. Questionnaires reach many users quickly, but the answers are short and cannot be followed up. Observation shows how people really work, which may differ from what they say they do.
Requirements are usually split into two kinds. Functional requirements say what the system must do, such as "print a report of every overdue book". Non-functional requirements say how well it must do it, such as how fast it must respond, how many users it must handle, or how secure it must be.
Design decides how the system will meet the requirements. It covers the structure of the program, the algorithms, the data structures and the database, the user interface and the hardware needed. Implementation is the writing of the code, following the design. Testing checks that the system works and meets the requirements.
Deployment installs the system for real use. The old system may be replaced all at once, run alongside the new one for a while, or replaced in phases. Users are trained, and data is moved from the old system to the new one.
Direct changeover is quick and cheap, but if the new system fails there is nothing to fall back on. Parallel running is the safest, since results from the two systems can be compared, but staff must do every job twice. Phased and pilot changeovers limit the damage a failure can do by introducing the system a piece, or a place, at a time.
After deployment
Evaluation checks how well the finished system meets the requirements, and whether the users are happy with it. Maintenance then continues for as long as the system is used. Corrective maintenance fixes bugs that were missed. Adaptive maintenance changes the system to suit new hardware, new laws or new ways of working. Perfective maintenance improves its speed or adds features users ask for.
Maintenance often costs more than the original development, because a system may be used for ten or twenty years. Code that is well structured and well documented is much cheaper to maintain, which is why methodologies care so much about design and documentation.
The life cycle is not only for brand-new systems. A large change to an existing system, such as moving a shop's website to a new payment provider, goes through the same stages on a smaller scale. Each change is checked for feasibility, its requirements are agreed, and it is designed, built, tested and deployed. So the maintenance stage of one cycle often becomes the start of the next.
Common mistake: thinking the life cycle ends when the program is handed over. Handing over the system starts the longest stage of all. Maintenance continues for as long as the system is used, and evaluation and maintenance feed new requirements back into the cycle.
Worked example 1: is the project worth it?
A feasibility study finds that a new booking system would cost £48,000 to build and would save £16,000 a year in staff time. How long would it take to pay for itself?
| Working | Reason |
|---|---|
| Payback period = cost ÷ yearly saving | The saving pays back the cost a year at a time |
| £48,000 ÷ £16,000 = 3 years | Divide the total cost by the saving per year |
| After year 3, the system saves money | Every later year is a real gain |
| The project is worth doing if it lasts beyond 3 years | The feasibility study weighs this against the risks |
Check yourself. A school's IT team fixes a bug in its registration system that has been live for a year. Which stage of the life cycle is this, and which kind?
Show the answer
This is maintenance, because the system is already in use. Fixing a bug that was missed in testing is corrective maintenance.
Section 2
The waterfall model
Stages in strict order
The waterfall model takes the stages of the life cycle one at a time, in order. Each stage is finished and signed off before the next begins, and each produces documents that the next stage uses. The requirements document feeds the design, the design feeds the implementation, and so on, like water flowing down a series of steps.
The waterfall model is easy to manage. Everyone knows which stage the project is in, progress is easy to measure, and the documents produced at each stage make the system easier to maintain later. Costs and deadlines can be planned at the start.
The documents also make it easy to bring new staff into the project, because the reasoning behind every decision is written down. Many large organisations, and some customers such as governments, require this level of documentation in their contracts. A signed-off requirements document also protects both sides: it records exactly what the customer asked for.
Some versions of the waterfall model allow a stage to send problems back to the stage before it. A designer who finds a requirement that cannot be met can return it to the analysts. But going back more than one stage is expensive, and the model still assumes that most of the requirements are right first time.
A variation called the V-model pairs each stage of building with a stage of testing. The requirements are checked by acceptance testing with the users, the overall design by system testing, and the detailed design by testing each module. Planning the tests at the same time as each stage means that problems with a requirement can be spotted before any code is written.
The cost of late changes
The weakness of the waterfall model is that users see the working system only near the end. If the developers misunderstood a requirement at the start, the mistake is built into the design, the code and the tests. When the users finally see the system and spot the problem, all of that work may need redoing.
Figure 6.1 runs the same project two ways. A requirement is misunderstood in the first week. Move the week in which the users notice, and compare the work that must be redone in each approach. Then switch on the wrong model.
When a misunderstanding is found
- Waterfall weeks to redo
- 9
- Agile weeks to redo
- 1
Common mistake: thinking a late change in waterfall only redoes the current stage. Every stage rests on the requirements. A misunderstood requirement found during testing may mean redesigning, recoding and retesting, so all the work since the requirements stage can be affected, not just the stage in progress.
Worked example 2: a mistake found in week 9
In Figure 6.1, the mistake is found in week 9. How many weeks of work must be redone in each approach?
| Working | Reason |
|---|---|
| Waterfall: all 9 weeks so far rest on the mistake | Users have not seen the product until now |
| So 9 weeks of work may need redoing | Design and code both built on the error |
| Agile: users reviewed the product at the end of week 8 | A review happens every two-week sprint |
| So only week 9, 1 week, must be redone | The mistake was caught within one sprint |
Worked example 3: the effect on the deadline
The waterfall project was planned to take 14 weeks. The mistake is found in week 12, and every week so far must be redone. When will the project now finish?
| Working | Reason |
|---|---|
| Weeks to redo = 12 | All the work so far rests on the mistake |
| New length = 14 + 12 = 26 weeks | The redone work is added to the plan |
| The project is almost twice as long as planned | Late changes are very expensive in waterfall |
| An agile project would lose at most one sprint | Feedback arrives every two weeks |
Derivation: the work redone when a mistake is found
Suppose a requirement is misunderstood at the start and noticed in week w. In waterfall, users only see the product at the end, so all the work done so far rests on the mistake.
In an agile project with sprints of s weeks, users review the product at the end of every sprint. The mistake is found at the latest in the next review, so only the current sprint is affected.
With w = 9 and s = 2, waterfall redoes 9 weeks and agile redoes 1. The later a mistake is found, the bigger the gap between the two.
When waterfall suits a project
Waterfall suits projects whose requirements are clear, fixed and well understood from the start. Examples include systems that must follow a law or a standard, safety-critical systems that need thorough documentation, and projects that repeat something the team has built before. It does not suit projects where users are unsure what they want.
Check yourself. State a strength and a weakness of the waterfall model.
Show the answer
It is easy to manage and measure, because each stage has clear documents and sign-off. But users see the working system only at the end, so a misunderstood requirement is expensive to fix.
Section 3
Agile methods and extreme programming
Working in sprints
Agile methods build software in short cycles, often called sprints or iterations, that typically last one to four weeks. Each sprint plans, designs, builds and tests a small set of features, then shows them to the users. Their feedback decides what happens in the next sprint.
Agile methods grew out of frustration with long projects that delivered the wrong thing. In 2001 a group of developers wrote a short statement of values for agile software development. It values individuals and interactions over processes and tools, and working software over comprehensive documentation. It also values customer collaboration over contract negotiation, and responding to change over following a plan.
Agile methods value working software and close contact with users over long documents and fixed plans. Requirements are written as short user stories. A typical one reads: as a pupil, I want to see my homework for the week, so I can plan. The users rank the stories, and the team builds the most important ones first.
A good user story is small enough to finish within one sprint and can be tested, so everyone can agree when it is done. Large stories are split into smaller ones. Each story is written on its own, with no technical detail, so that the users can understand and rank it without help from the developers.
Because users see the software every few weeks, misunderstandings are caught quickly and requirements can change as the users learn what they need. The disadvantage is that the final cost and finishing date are harder to predict, and less documentation is produced, which can make long-term maintenance harder.
Scrum
Scrum is one of the most widely used agile frameworks. A product owner represents the users and keeps the product backlog, the ranked list of everything the product should do. A scrum master helps the team follow the process and removes obstacles. The development team itself decides how to build each feature.
Each sprint begins with planning, where the team chooses stories from the top of the backlog. Every day, the team holds a short stand-up meeting: each member says what they did yesterday, what they will do today and what is blocking them. The sprint ends with a review, where working software is shown to the users, and a retrospective, where the team discusses how to work better.
Common mistake: thinking agile means there is no planning or documentation. Agile teams plan every sprint and keep the most important documents up to date. They simply plan in shorter steps and avoid writing documents that nobody will use, rather than abandoning planning altogether.
Velocity and burndown
Each user story is given an estimate in story points, a measure of how much effort it needs. The number of points a team finishes in one sprint is its velocity. Once a team knows its velocity, it can estimate how many sprints the remaining work will take.
A burndown chart plots the points left in the backlog after each sprint. A steady downward line means the project is on track; a flat section shows a sprint where little was finished.
Worked example 4: how many sprints?
A backlog holds 120 story points, and the team's velocity is 25 points per sprint. How many sprints are needed?
| Working | Reason |
|---|---|
| 120 ÷ 25 = 4.8 | Divide the work by the work done per sprint |
| Round up to 5 sprints | Part of a sprint is still a whole sprint |
| With two-week sprints, that is 10 weeks | Each sprint lasts two weeks |
| The last sprint has spare capacity for changes | Only 20 points remain for it |
Worked example 5: reading a burndown
A 60-point backlog has velocities of 20, 15 and 25 in its first three sprints. Find the points left after each sprint and the average velocity.
| Working | Reason |
|---|---|
| After sprint 1: 60 − 20 = 40 points | Subtract each sprint's velocity |
| After sprint 2: 40 − 15 = 25 points | The second sprint finished less |
| After sprint 3: 25 − 25 = 0 points | The backlog is complete |
| Average velocity = 60 ÷ 3 = 20 points | Total points divided by sprints |
Extreme programming
Extreme programming, often called XP, is an agile methodology with a set of specific practices. Programmers work in pairs at one computer: one writes the code while the other reviews each line as it is typed, and they swap roles often. Pair programming catches mistakes early and spreads knowledge of the code through the team.
XP teams write the tests before the code, so that every feature has a test that shows when it is finished. They integrate their code into the shared program several times a day, and release small working versions often. A customer representative works with the team, writing user stories and answering questions straight away.
XP also values simple design and refactoring. Code is kept as simple as possible for the features needed now, and is restructured whenever it becomes untidy. Everyone owns all the code, so anyone can improve any part of it, and the team works a sustainable number of hours to avoid tired mistakes.
These practices support each other. Tests written first make refactoring safe, because the tests show at once if a change breaks something. Continuous integration means each programmer's work is combined with everyone else's within hours, so conflicts are small and easy to fix. Pair programming spreads knowledge, so collective ownership of the code really works.
Check yourself. With 90 points remaining and a velocity of 18 points per sprint, how many sprints are left?
Show the answer
Dividing gives 90 ÷ 18 = 5, so exactly 5 sprints are left, assuming the velocity stays steady.
Section 4
The spiral model
Loops driven by risk
The spiral model, introduced by Barry Boehm, develops a system in a series of loops. Each loop passes through four stages: decide the objectives, identify and resolve the risks, develop and test the next version, and plan the next loop. The system grows with each loop, from a first prototype to the finished product.
What makes the spiral model different is its focus on risk. A risk is anything that could make the project fail or overrun. It might be a technology that is too slow, a key programmer who leaves, or users who reject the interface. At the start of each loop, the team identifies the risks and tackles the most serious ones first, often by building a prototype or running a test.
Ranking risks
A risk can be ranked by its exposure: the probability that it happens multiplied by the cost if it does. A likely problem with a small cost and an unlikely problem with a huge cost can both deserve attention, and the exposure lets them be compared on one scale.
Common mistake: ranking risks by their impact alone. The risk with the largest possible cost is not always the most serious. A risk that would cost £120,000 but has a 1 in 10 chance has a lower exposure than one costing £50,000 with a 1 in 4 chance.
Worked example 6: risk exposure
A database might be too slow for the number of users, with a probability of 0.2. Fixing it late would cost £50,000. Find the risk exposure.
| Working | Reason |
|---|---|
| Exposure = probability × impact | It combines likelihood and cost |
| 0.2 × £50,000 = £10,000 | Multiply the two values |
| The team can spend up to about £10,000 reducing it | A test or prototype costing less is worthwhile |
| A spiral loop would test the database early | Risks are tackled before more is built |
Worked example 7: which risk first?
Risk A has probability 0.1 and impact £120,000. Risk B has probability 0.4 and impact £20,000. Which should be tackled first?
| Working | Reason |
|---|---|
| A: 0.1 × £120,000 = £12,000 | Exposure of risk A |
| B: 0.4 × £20,000 = £8,000 | Exposure of risk B |
| Risk A has the higher exposure, so it comes first | Ranking uses exposure, not impact or probability alone |
| Risk B is still worth reducing in a later loop | Its exposure is still large |
The spiral model suits large, expensive and high-risk projects, such as new military or medical systems, where the cost of failure justifies time spent on risk analysis. In such projects a single wrong assumption, such as a sensor that responds too slowly, could waste years of work. Finding it in the first loop is worth a great deal. It needs staff skilled in assessing risk, and its loops can make the cost and length of the project hard to predict. For a small, low-risk project it is far more process than is needed.
A loop of the spiral need not produce finished code. An early loop might only produce a paper design or a quick prototype to test whether a risky idea works at all. If a loop shows that a risk cannot be reduced, the project can be stopped before more money is spent. Stopping early is a success of the model, not a failure.
Compared with waterfall, the spiral model accepts that the requirements and the design will change as risks are explored. Compared with agile, it puts much more effort into formal risk analysis and planning. It can be seen as a framework that borrows from both: each loop may run like a small waterfall, while the loops together make the project iterative.
Each loop ends with a review, where the customer decides whether to continue into the next loop. So the spiral model gives the customer regular points at which to commit more money or to stop. The loops grow wider as the project goes on, because each one builds more of the real system than the last.
Check yourself. What is the exposure of a risk with probability 0.3 and impact £40,000?
Show the answer
The exposure is 0.3 × £40,000 = £12,000. That is the amount the risk is expected to cost, on average, if nothing is done about it.
Section 5
Rapid application development
Prototypes and feedback
Rapid application development, or RAD, builds a working prototype quickly and improves it with the users. A prototype is an early, incomplete version of the system that shows how it will look and behave. Users try it, say what they like and dislike, and the developers build an improved prototype, repeating until the users are satisfied.
Prototypes can be throwaway or evolutionary. A throwaway prototype is built only to find out what the users want, and is then discarded before the real system is written. An evolutionary prototype is improved step by step until it becomes the finished system.
Common mistake: thinking a prototype is the finished product. A prototype is an early version used to gather feedback. It may leave out features, error handling and security, and a throwaway prototype is discarded completely. Users who see a polished prototype can wrongly assume the system is nearly finished.
Timeboxing
RAD projects are usually timeboxed: each phase has a fixed deadline, and if work is running late, features are dropped rather than the deadline moved. Features are ranked using MoSCoW: must have, should have, could have and won't have this time. The must-haves are always delivered, and the others are added as time allows.
RAD relies on tools that let developers build working screens quickly. These include graphical interface builders, where buttons and forms are dragged into place, and libraries of reusable components. Requirements are often gathered in workshops, where developers and users sit together and agree what each prototype should do next.
Imagine a dentist's surgery that wants an online booking system. In the first week, the developers build a prototype of the booking screens with no database behind them, and the receptionists try it. They ask for a view of a whole week rather than one day. The next prototype shows a week, connects to a test database and adds reminders by text message. After three or four rounds, the receptionists are happy, and the remaining work goes into security, testing and the real data.
Worked example 8: filling a timebox
A 20-day timebox must deliver must-have features needing 14 days. The should-haves need 8 days, and the could-haves 6 days. What can be delivered?
| Working | Reason |
|---|---|
| Must-haves take 14 days | They are always delivered first |
| Days left = 20 − 14 = 6 | The deadline cannot move |
| The should-haves need 8 days, which do not all fit | There is not enough time left |
| Deliver some should-haves; leave the could-haves | Features are dropped, not the deadline |
RAD suits projects with a strong user interface, such as apps and websites, where users can judge a prototype by trying it. It needs users who can give time throughout the project. It suits small and medium projects better than very large ones, and is less suited to systems that need a lot of complex processing that users cannot see.
A risk with RAD is that the code becomes messy as prototype after prototype is changed in a hurry. Without care, the final system can be hard to maintain or to scale up to many users. Teams reduce this risk by refactoring the code between prototypes, and by agreeing which parts of an evolutionary prototype must be rebuilt properly before release.
Check yourself. What is the difference between a throwaway and an evolutionary prototype?
Show the answer
A throwaway prototype is discarded once it has shown what the users want. An evolutionary prototype is improved repeatedly until it becomes the finished system.
Section 6
Planning a project and choosing a methodology
Dependencies and the critical path
A project plan lists the tasks, how long each will take, and which tasks must finish before each one can start. A Gantt chart draws each task as a bar along a timeline. Tasks that do not depend on each other can run at the same time, if there are people to do them.
A project plan also marks milestones, points where a major piece of work is finished, such as "design signed off" or "first release". Milestones let the customer and managers check progress at a glance. If a milestone is missed, the plan is updated at once, so that everyone can see the new finishing date and decide what to do about it. Missing a milestone early is a warning; hiding it until the deadline turns a small problem into a crisis. Each task in the plan is given to particular people, so the plan also shows whether anyone has been given two tasks at once.
Critical path analysis works out the shortest time in which the project can be finished. Each task starts as soon as all the tasks it depends on have finished. The longest chain of dependent tasks through the project is the critical path. Its length is the length of the whole project, and any delay to a task on it delays the finish.
Figure 6.2 shows a small project as a Gantt chart. Change how long the interface design takes, and watch how the project length and the critical path change. Then switch on the wrong model.
The critical path
- Project length
- 16 days
- Critical path
- Requirements → Design database → Code back end → Testing
- Slack on Design interface
- 2 days
Common mistake: thinking a project takes as long as all its tasks added together. Tasks that do not depend on each other run at the same time. The project's length is the longest chain of dependent tasks, which is usually much shorter than the total of every task.
Derivation: earliest starts, project length and slack
A task can start only once every task before it has finished. So the earliest start of a task t, with duration d, is the latest finish among its predecessors.
The project length is the latest finish of any task. The slack of a task is how far it can slip without moving that finish, found from its latest allowed start.
Tasks with zero slack form the critical path. Any delay to one of them moves the end of the project by the same amount.
Critical path analysis tells managers where to focus. Extra people or time spent on a task with plenty of slack will not finish the project any sooner. But speeding up a critical task, perhaps by adding a programmer, can bring the end date forward. That works until another chain of tasks becomes the longest and takes over as the critical path.
Worked example 9: finding the critical path
The project in Figure 6.2 has six tasks. Requirements takes 3 days. Design database takes 4 days and Design interface 3 days, both after requirements. Code back end takes 6 days after the database design. Code front end takes 5 days after the interface design. Testing takes 3 days after both.
| Working | Reason |
|---|---|
| Database route: 3 + 4 + 6 = 13 days before testing | Requirements, database design, back end |
| Interface route: 3 + 3 + 5 = 11 days before testing | Requirements, interface design, front end |
| Testing starts on day 13 and ends on day 16 | It waits for the slower route |
| Critical path: requirements, database, back end, testing | The longest chain of dependent tasks |
Worked example 10: slack
How much slack does the interface design have, and what happens if it takes 6 days instead of 3?
| Working | Reason |
|---|---|
| Interface route finishes on day 11, testing starts on day 13 | The front end finishes 2 days early |
| Slack = 13 − 11 = 2 days | It can slip by this without delay |
| At 6 days, the interface route takes 3 + 6 + 5 = 14 days | That is 3 days longer than before |
| The project now ends on day 17, on a new critical path | Using more than the slack delays the finish |
Choosing a methodology
The right methodology depends on the project. The key questions are how clear and fixed the requirements are, how large and risky the project is, and how much time the users can give.
Waterfall suits fixed, well-understood requirements and projects that need strong documentation. Agile and XP suit projects whose requirements will change, where users can review work every few weeks. The spiral model suits large, risky and expensive projects. RAD suits interactive systems that users can judge from a prototype, built to a tight deadline.
Real teams often mix approaches. A company might plan a whole year's budget in a waterfall style, then build each feature in agile sprints. A safety-critical system might use the spiral model's risk analysis for its riskiest parts, and a careful waterfall approach for the parts that are well understood. What matters is that the choice is made on purpose, for reasons that fit the project.
Worked example 11: choosing for a school app
A school wants an app for pupils to check homework and timetables. The pupils are not sure what they want, the app must be ready for September, and a group of pupils can test it every fortnight. Which methodology suits it best?
| Working | Reason |
|---|---|
| The requirements are unclear and will change | This rules out the waterfall model |
| Pupils can review the app every two weeks | Agile and RAD both depend on regular feedback |
| The project is small with few serious risks | The spiral model would be too much process |
| Choose agile or RAD, timeboxed to September | They give working software early and often |
Check yourself. In Figure 6.2, would adding a second programmer to the interface design make the project finish sooner? Explain.
Show the answer
No. The interface design has 2 days of slack and is not on the critical path, so finishing it sooner changes nothing. Only speeding up a critical task, such as the back end, would bring the end forward.
Reference
Key algorithms and definitions
| Term or algorithm | What it means | Example | Cost or rule to learn |
|---|---|---|---|
| Life cycle stages | Feasibility to maintenance | Requirements document | Maintenance lasts longest |
| Feasibility | Is the project worth doing and possible? | Payback period | Cost ÷ yearly saving |
| Waterfall | Stages once, in strict order | Payroll system | Late changes redo w weeks |
| Agile | Short sprints with user review | User stories | Rework at most one sprint |
| Velocity | Points finished per sprint | 25 points per sprint | Sprints = points ÷ velocity, rounded up |
| Extreme programming | Agile practices | Pair programming, tests first | Small, frequent releases |
| Spiral model | Loops driven by risk analysis | Medical system | Exposure = probability × impact |
| RAD | Prototypes refined with users | A booking app | Timeboxed, MoSCoW priorities |
| Critical path | Longest chain of dependent tasks | Gantt chart | Zero-slack tasks set the finish |
Programming task
Programming task: a critical path calculator
Aim
Write a Python program that takes a list of tasks, each with a duration and the tasks it depends on. It must work out the earliest start of every task, the project length, the critical path and the slack of every task.
Design
The tasks are stored in a dictionary that maps each name to its duration and its list of predecessors. A recursive function finds the earliest start of a task: zero with no predecessors, otherwise the latest finish among them. Results are stored as they are found, so each task is worked out only once.
The latest finish of each task is found by working backwards from the end of the project. A task with no successors must finish by the project's end; any other task must finish before its earliest-needed successor starts. Slack is the latest start minus the earliest start, and the critical path is the chain of tasks with zero slack.
Code
tasks = {
"Requirements": (3, []),
"Design database": (4, ["Requirements"]),
"Design interface": (3, ["Requirements"]),
"Code back end": (6, ["Design database"]),
"Code front end": (5, ["Design interface"]),
"Testing": (3, ["Code back end", "Code front end"]),
}
start = {}
def earliest(name):
if name not in start:
days, after = tasks[name]
start[name] = max((earliest(p) + tasks[p][0] for p in after), default=0)
return start[name]
for name in tasks:
earliest(name)
length = max(start[n] + tasks[n][0] for n in tasks)
latest_finish = {}
for name in sorted(tasks, key=lambda n: -start[n]):
followers = [f for f in tasks if name in tasks[f][1]]
latest_finish[name] = min((latest_finish[f] - tasks[f][0] for f in followers), default=length)
slack = {n: latest_finish[n] - tasks[n][0] - start[n] for n in tasks}
critical = [n for n in sorted(tasks, key=lambda n: start[n]) if slack[n] == 0]
print("Length:", length, "days")
print("Critical path:", " -> ".join(critical))
print("Slack:", slack)
Sorting by earliest start, latest first, means every successor's latest finish is known before it is needed. The default values handle tasks with no predecessors and tasks with no successors.
Testing
| Test | Input | Expected output | Why this test |
|---|---|---|---|
| 1 | The six tasks above | Length 16 days | Matches worked example 9 |
| 2 | The six tasks above | Critical path Requirements, Design database, Code back end, Testing | The longest chain |
| 3 | The six tasks above | Slack 2 days on Design interface | Matches worked example 10 |
| 4 | Design interface set to 6 days | Length 17 days, new critical path | Using more than the slack |
| 5 | One task of 5 days | Length 5, slack 0 | A project with no dependencies |
| 6 | Three tasks in a chain of 2, 3 and 4 days | Length 9, all on the critical path | Nothing can run in parallel |
| 7 | Three independent tasks of 2, 3 and 4 days | Length 4 | Everything runs at the same time |
Evaluation
The calculator gives the right length, critical path and slack for every test, including the extreme cases of a single chain and fully independent tasks. Test 4 shows how using up a task's slack moves the critical path, which matches Figure 6.2.
The program assumes there is always someone free to start a task as soon as it can begin. An improvement would allow for a limited number of developers. It would also check the task list for loops, where two tasks each wait for the other, which would make the recursion run forever.
Practice
Practice ladder
Rung 1: Recall and fluency
Q1. List the stages of the systems development life cycle in order.
Worked solution to Q1
The stages are feasibility study, requirements analysis, design, implementation, testing, deployment, evaluation and maintenance. Maintenance and evaluation lead back to new requirements, so the cycle repeats.
Q2. State three practices of extreme programming.
Worked solution to Q2
Three practices are pair programming, writing the tests before the code, and continuous integration with small, frequent releases. Others include refactoring, collective code ownership and an on-site customer.
Q3. What does timeboxing mean, and why is it used?
Worked solution to Q3
Timeboxing gives each phase of a project a fixed deadline that cannot move. If the work is running late, lower-priority features are dropped, so the most important features are still delivered on time.
Rung 2: Application
Q4. A new system costs £90,000 and saves £30,000 a year. Find its payback period.
Worked solution to Q4
The payback period is the cost divided by the yearly saving: £90,000 ÷ £30,000 = 3 years. After that, every year of use is a real saving for the organisation.
Q5. A backlog holds 200 story points and the team's velocity is 30 points per sprint. How many sprints are needed?
Worked solution to Q5
Dividing gives 200 ÷ 30 = 6.67, which rounds up to 7 sprints, because part of a sprint still takes a whole sprint. The last sprint has spare capacity.
Q6. Find the exposure of a risk with probability 0.25 and an impact of £60,000.
Worked solution to Q6
The exposure is the probability multiplied by the impact: 0.25 × £60,000 = £15,000. That is the average cost the team should expect from this risk if it does nothing.
Q7. A requirement misunderstood in week 1 is found in week 7. How many weeks must be redone in a waterfall project and in an agile project with two-week sprints?
Worked solution to Q7
In waterfall, all 7 weeks so far rest on the mistake, so 7 weeks may be redone. In agile, the last review was at the end of week 6, so only week 7, 1 week, must be redone.
Rung 3: Analysis
Q8. Risk P has probability 0.5 and impact £10,000. Risk Q has probability 0.05 and impact £200,000. Which has the higher exposure?
Worked solution to Q8
Risk P has exposure 0.5 × £10,000 = £5,000, and risk Q has 0.05 × £200,000 = £10,000. So Q has the higher exposure and should be tackled first, even though it is much less likely.
Q9. Explain why the waterfall model suits a payroll system better than a new social app.
Worked solution to Q9
Payroll rules are fixed by law and well understood, so they can be fully specified at the start, and the documentation helps later maintenance. A social app's users do not know what they want until they try it, which needs frequent feedback.
Q10. Tasks A (2 days), B (5 days after A), C (3 days after A) and D (4 days after B and C) make a project. Find its length and critical path.
Worked solution to Q10
Task D can only start once B finishes on day 7, since C finishes earlier, on day 5. So D runs from day 7 to day 11, giving a length of 11 days and a critical path of A, B and D.
Q11. In Q10, how much slack does task C have, and what is the wrong total if all the tasks are added?
Worked solution to Q11
C finishes on day 5 but D cannot start before day 7, so C has 2 days of slack. Adding all the tasks gives 2 + 5 + 3 + 4 = 14 days, which wrongly ignores that B and C run at the same time.
Rung 4: Stretch
Q12. A team has velocities of 22, 18 and 26 in three sprints, and 132 points remain. Estimate the sprints still needed.
Worked solution to Q12
The average velocity is (22 + 18 + 26) ÷ 3 = 22 points per sprint. Dividing the remaining work gives 132 ÷ 22 = 6, so about 6 more sprints are needed.
Q13. Explain why pair programming can be worth the cost of two programmers working on one piece of code.
Worked solution to Q13
The second programmer reviews every line as it is written, catching mistakes when they are cheapest to fix. Knowledge of the code is shared, so the team is not stuck if one person leaves, and the code is often simpler.
Q14. Using the derivation, explain why the saving from agile grows the later a mistake is found.
Worked solution to Q14
Waterfall redoes all w weeks, which grows as the mistake is found later. Agile redoes at most one sprint of s weeks, however late it is. So the saving, at least w − s weeks, keeps growing with w.
Exam practice
Exam technique and worked answer workshop
When describing a methodology, give its stages or practices and then its strengths and weaknesses. "Users see a working version every two weeks, so misunderstandings are caught early" earns marks; "agile is more flexible" alone earns little.
For "suggest a methodology" questions, use the details in the scenario. Pick out how clear the requirements are and how big and risky the project is. Then note how much time users have and how tight the deadline is, and link each one to your choice.
For critical path questions, show the earliest start of each task. Give the project length, list the tasks on the critical path in order, and state the slack of any task you are asked about.
Exam question 1 (4 marks · Paper 01 · about 5 minutes)
(a) Describe what happens in a feasibility study. [2]
(b) Give two types of maintenance, with an example of each. [2]
Mark scheme for exam question 1
- B1 it decides whether the project is possible and worth doing
- B1 by looking at the technical, economic, legal and time feasibility
- B1 corrective maintenance, such as fixing a bug missed in testing
- B1 adaptive maintenance, such as changing the system for a new law, or perfective maintenance, such as making it faster
Exam question 2 (5 marks · Paper 01 · about 7 minutes)
A team uses an agile method. Its backlog holds 120 story points, and its velocity is 25 points per sprint.
(a) Calculate the number of sprints needed. [2]
(b) Describe two features of an agile methodology. [2]
(c) State one disadvantage of agile for the customer. [1]
Mark scheme for exam question 2
- M1 120 ÷ 25 = 4.8
- A1 5 sprints, rounded up
- B1 the software is built in short sprints, each producing working software
- B1 users review the software after every sprint, and their feedback changes the plan
- B1 the final cost and finishing date are harder to predict at the start
Exam question 3 (5 marks · Paper 01 · about 7 minutes)
Two risks are found at the start of a spiral model loop. Risk A has probability 0.1 and impact £120,000; risk B has probability 0.4 and impact £20,000.
(a) Calculate the exposure of each risk. [2]
(b) State which risk should be tackled first, and why. [1]
(c) Describe the four stages of a loop of the spiral model. [2]
Mark scheme for exam question 3
- B1 A: £12,000
- B1 B: £8,000
- B1 risk A, because it has the higher exposure
- B1 determine objectives, then identify and resolve risks
- B1 develop and test the next version, then plan the next loop
Exam question 4 (4 marks · Paper 01 · about 5 minutes)
A requirement misunderstood at the start of a 14-week project is found in week 9.
(a) State how many weeks of work may need redoing in a waterfall project, and explain why. [2]
(b) State how many weeks must be redone in an agile project with two-week sprints, and explain why. [2]
Mark scheme for exam question 4
- B1 9 weeks
- B1 users see the product only at the end, so all the work so far rests on the mistake
- B1 1 week
- B1 users reviewed the product at the end of week 8, so only the current sprint is affected
Exam question 5 (6 marks · Paper 01 · about 9 minutes)
A school wants an app for pupils to check homework and timetables. The pupils are unsure what they want, the app must be ready for September, and pupils can test it every fortnight. Discuss which methodology the developers should use.
Mark scheme for exam question 5
Level 3 (5–6 marks): a balanced discussion of at least three methodologies, each linked to details of the scenario, including the unclear requirements, the deadline and the regular testing. The answer reaches a justified recommendation. It is well organised and uses technical terms accurately.
Level 2 (3–4 marks): a correct description of at least two methodologies with some link to the app. The comparison or the recommendation is limited.
Level 1 (1–2 marks): some relevant points, such as describing waterfall, with little application. The answer may lack structure.
0 marks: no response or no response worthy of credit.
Indicative content:
- the requirements are unclear, so they will change as pupils try the app
- waterfall needs fixed requirements at the start, and pupils would see the app only at the end
- a misunderstanding found late in waterfall would be expensive to fix
- agile builds the app in sprints, and pupils can review each one every fortnight
- feedback catches mistakes early and lets requirements change
- RAD builds prototypes pupils can try, which suits an app with a strong interface
- timeboxing with MoSCoW priorities makes sure the must-haves are ready for September
- the spiral model suits large, risky projects, so it would be too much for a small app
- recommendation: agile or RAD, timeboxed to September
Annotated model answer: exam question 5
"The pupils are not sure what they want, so the requirements will change. Waterfall needs fixed requirements at the start. The pupils would only see the app at the end, so a misunderstanding would be found too late." (Waterfall rejected, linked to the scenario.)
"An agile method builds the app in two-week sprints, and the pupils can test each one. Their feedback catches mistakes early, and the plan can change as they learn what they want." (Agile linked to the fortnightly testing.)
"RAD would also suit, because pupils can judge the app by trying prototypes. Timeboxing with MoSCoW would make sure the must-have features, such as homework lists, are ready for September." (RAD and the deadline.)
"The spiral model is meant for large, high-risk projects, which this is not. So the developers should use agile or RAD, timeboxed to September." (A third methodology weighed, and a justified conclusion.)
This answer reaches Level 3 and scores 6 marks. It weighs four methodologies against the details of the scenario and reaches a clear recommendation.
Exam question 6 (6 marks · Paper 01 · about 9 minutes)
A project has six tasks. Requirements takes 3 days; Design database takes 4 days and Design interface 3 days, both after Requirements. Code back end takes 6 days after Design database, and Code front end 5 days after Design interface. Testing takes 3 days after both coding tasks.
(a) Calculate the earliest day Testing can start, and the length of the project. [3]
(b) Identify the critical path. [1]
(c) Calculate the slack on Design interface. [2]
Mark scheme for exam question 6
- M1 database route 3 + 4 + 6 = 13 and interface route 3 + 3 + 5 = 11
- A1 Testing starts on day 13
- A1 the project takes 16 days
- B1 Requirements, Design database, Code back end, Testing
- M1 13 − 11
- A1 2 days
Exam question 7 (4 marks · Paper 01 · about 5 minutes)
(a) Describe rapid application development. [2]
(b) Explain the difference between a throwaway and an evolutionary prototype. [2]
Mark scheme for exam question 7
- B1 a prototype is built quickly and shown to the users
- B1 their feedback is used to refine it repeatedly, usually within timeboxed phases
- B1 a throwaway prototype is discarded once it has shown what users want
- B1 an evolutionary prototype is improved until it becomes the final system
Exam question 8 (6 marks · Paper 02 · about 9 minutes)
Tasks are stored in arrays name, days and after, where after[i] is the index of the one task that task i depends on, or −1 if none. Tasks are listed so that every task comes after the task it depends on. Write a function projectLength(days, after, n) that returns the length of the project.
Mark scheme for exam question 8
- B1 a function header with the three parameters
- B1 an array finish of size n
- B1 a loop over all n tasks in order
- B1 a task with after[i] = −1 starts at 0, so finish[i] = days[i]
- M1 otherwise finish[i] = finish[after[i]] + days[i]
- A1 the largest value in finish is returned as the length
Annotated model answer: exam question 8
function projectLength(days, after, n)
array finish[n]
longest = 0
for i = 0 to n - 1
if after[i] == -1 then
finish[i] = days[i]
else
finish[i] = finish[after[i]] + days[i]
endif
if finish[i] > longest then
longest = finish[i]
endif
next i
return longest
endfunction
The header and the finish array earn the first two marks, and the loop earns the third. A task with no predecessor finishing after its own duration earns the fourth. Adding the duration to the predecessor's finish earns the method mark, and returning the largest finish earns the last.
Connections
Synoptic link
The testing stage of the life cycle is taught in detail in Development environments, testing and computational methods, including black-box, white-box and alpha and beta testing. Critical path analysis finds the longest path through a graph of tasks, a close relative of the shortest path algorithms in Graph traversal and shortest paths.
Agile's user stories and the spiral model's prototypes both use abstraction and decomposition, from Computational thinking. They break a large problem into parts that can be built and tested separately. Feasibility studies weigh legal and ethical questions covered in Legal, moral, ethical and cultural issues.
Synoptic question 1. A Gantt chart's tasks form a directed graph with no loops. Why would a loop, where task X waits for task Y and Y waits for X, make the project impossible to schedule?
Answer to synoptic question 1
Each task could start only after the other had finished, so neither could ever begin. The earliest start of X would depend on Y, and Y's on X, so the calculation would never end, as the evaluation of the programming task warns.
Recap
Recap and next step
- The life cycle runs from feasibility, through requirements, design, implementation, testing and deployment, to evaluation and maintenance, which lasts longest.
- Waterfall does each stage once, in order; it is easy to manage, but a misunderstanding found in week w may redo w weeks.
- Agile builds working software in sprints reviewed by users; sprints needed = points ÷ velocity, rounded up. XP adds pair programming, tests first and continuous integration.
- The spiral model repeats loops that tackle the biggest risks first, ranked by exposure = probability × impact.
- RAD refines prototypes with users within timeboxes, using MoSCoW priorities.
- The critical path is the longest chain of dependent tasks; its length is the project length, and its tasks have zero slack.
Next chapter: Compression, encryption and hashing looks at how data is made smaller, kept secret and checked, ideas every methodology must plan for when a system handles real data.
For your exam board
OCR A Level Computer Science (H446): this chapter covers section 1.2.3, Software Development, in Component 01: the waterfall life cycle, agile methodologies, extreme programming, the spiral model and rapid application development, with their relative merits and drawbacks.
AQA A Level Computer Science (7517): the stages of analysis, design, implementation, testing and evaluation appear in the systematic approach to problem solving, and are applied in the non-exam assessment. Agile and other methodologies are not named separately, but the planning and iterative development skills here support the project.