Course 7.1Lesson 1 of 3
A program is planned and built in four stages: analysis, design, coding and testing. This lesson says what happens at each stage, from finding the requirements to testing with test data, and why a programmer often goes back to an earlier stage.
Try the code and the simulations beside the lesson.
Think about building a garden shed. You do not start by nailing boards together. First you decide what the shed is for and how big it must be. Then you draw a plan. Then you build it, checking each wall as you go. At the end you check the whole shed. Writing a program works the same way.
The program development life cycle is the set of stages a program goes through as it is made. The Cambridge IGCSE syllabus uses four stages: analysis, design, coding and testing.
In the analysis stage the programmer finds out exactly what the problem is and what the program must do. The list of things it must do is the requirements. The tasks at this stage are:
Here is an example. A small cinema wants a program for its ticket desk. After talking to the staff, the programmer writes these requirements.
Notice what is left out. The colour of the tickets and the name of the film do not change the total, so the program ignores them. That is abstraction. You meet abstraction and decomposition again in the next lesson.
In the design stage the programmer plans how the program will work. Nothing is typed into a computer yet. The tasks are:
The pseudocode for the ticket program is only three steps of processing.
INPUT Adults
INPUT Children
Total ← Adults * 9 + Children * 5
OUTPUT "Total cost: ", TotalThe arrow ← means "takes the value". So the third line works out the total and stores it in Total.
In the coding stage the programmer writes the program code in a programming language. The design tells them what to write. The syllabus names one more task here: iterative testing. The programmer tests each part as soon as it is written, corrects any mistake, and tests it again. This repeats until the part works. "Iterative" means "repeated".
In the testing stage the whole program is tested with test data. Test data is a set of inputs, chosen on purpose, with the result that each input should give. A test passes when the program gives the expected result. You learn how to choose test data in the second course of this chapter.
The stages make a cycle. Testing may show that a requirement was missed, so the programmer goes back to analysis. A design may be too hard to code, so the programmer goes back to design. Later, when the users ask for a change, the cycle starts again.
The grey block marked pseudocode is written in the exam style. It does not run on the site. The box marked Python below it is the same algorithm in Python, and that one runs. Here the program is the ticket program from the analysis. The inputs are fixed, so the program runs at once.
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place in the course.