Year 11 · Computer Science · Summer 2

After the exams · Lesson 3 of 5

Build

Project7.1 The program development life cycle8.1 Programming concepts

Year 11 · Computer Science · After the exams · Lesson 3 of 5

You will learn to

  • Use a two-minute stand-up to say what you did, what is next and what blocks you.
  • Create the project in small parts, testing each part before adding the next.
  • Write a log of what you built, what broke and what you fixed.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Success criteria

You have got it when you can say:

  • I can give my stand-up in under two minutes.
  • I can show one working part by the end of the lesson.
  • I can show a log entry with today's date, progress and next step.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Retrieval starter

Questions from before. Write your answers, then show them.

  1. Last unit

    Abnormal test data is…

    A Typical dataB Data at the edge of the rangeC Data that should be rejected

    C. Data that should be rejected

  2. Earlier this year

    A NOT gate has…

    A Two inputsB Three inputsC One input

    C. One input

  3. Last year

    A REPEAT … UNTIL loop…

    A Runs for everB May run zero timesC Always runs at least once

    C. Always runs at least once

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (1 of 8)

Program development life cycle
The four stages of making a program: analysis, design, coding and testing.
Abstraction
Removing details that do not matter so you can focus on the ones that do.
Decomposition
Breaking a problem into smaller parts that are easier to solve.
Structure diagram
A top-down diagram that shows how a system is split into sub-systems.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (2 of 8)

Flowchart
A diagram of an algorithm using standard shapes joined by flow lines.
Pseudocode
A structured, code-like way of writing an algorithm that is not tied to one language.
Totalling
Keeping a running total by adding each value to a total variable.
Counting
Adding 1 to a counter variable each time something happens.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (3 of 8)

Validation
An automatic check that input data is reasonable and follows set rules.
Check digit
An extra digit calculated from the other digits, used to catch typing errors.
Normal data
Test data that should be accepted.
Abnormal data
Test data that should be rejected.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (4 of 8)

Extreme data
The largest and smallest values that should be accepted.
Boundary data
The largest and smallest accepted values and the nearest rejected values next to them.
Variable
A named place in memory whose value can change while the program runs.
Constant
A named value that is set once and cannot change while the program runs.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (5 of 8)

Identifier
The name given to a variable, constant, array or subroutine.
Data type
The kind of value stored: INTEGER, REAL, CHAR, STRING or BOOLEAN.
Assignment
Storing a value in a variable, written with ← in pseudocode.
Sequence
Statements run one after another in the order they are written.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (6 of 8)

Selection
Choosing which statements to run using a condition (IF or CASE).
Iteration
Repeating a block of statements in a loop.
Count-controlled loop
A FOR loop that repeats a set number of times.
Pre-condition loop
A WHILE loop that checks its condition before each pass, so it may run zero times.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (7 of 8)

Post-condition loop
A REPEAT UNTIL loop that checks its condition after each pass, so it runs at least once.
Procedure
A named subroutine that does a task and is run with CALL; it does not return a value.
Function
A named subroutine that returns a single value to where it was called.
Parameter
A variable in a subroutine heading that receives a value when the subroutine is called.

Year 11 · Computer Science · After the exams · Lesson 3 of 5

Key words (8 of 8)

Local variable
A variable declared inside a subroutine that can only be used inside it.
Global variable
A variable declared in the main program that can be used anywhere in the program.
Library routine
A ready-made, tested subroutine provided with the language, such as ROUND or RANDOM.
Array
A data structure holding many values of the same data type under one name, each found by its index.

7.1 The program development life cycle · The explanation · step 1 of 26 · part 1 of 3

Four stages, in order

The program development life cycle is the set of stages a programmer goes through to make a program.

There are four stages: analysis, design, coding and testing.

It is called a cycle because problems found in testing send you back to an earlier stage.

7.1 The program development life cycle · The explanation · step 1 of 26 · part 2 of 3

Four stages, in order (continued)

StageQuestion it answersWhat is produced
AnalysisWhat must the program do?A list of requirements
DesignHow will it do it?Structure diagrams, flowcharts, pseudocode
CodingCan we build it?Program code, tested as it is written
TestingDoes it work for all data?Test results with test data
?Why?

Planning before coding is faster overall. A mistake fixed in the design costs minutes. The same mistake found after coding can cost hours.

7.1 The program development life cycle · The explanation · step 1 of 26 · part 3 of 3

Four stages, in order (continued)

!Watch out

Learn the four names exactly. Cambridge uses analysis, design, coding, testing. Words like 'planning' or 'making' do not earn the mark.

7.1 The program development life cycle · The explanation · step 2 of 26 · part 1 of 3

Analysis: understand the problem

In analysis you find out exactly what the problem is and what the program must do. These needs are the requirements.

Abstraction means removing the details that do not matter, so you can focus on what does.

Decomposition means breaking a big problem into smaller parts that are easier to solve.

7.1 The program development life cycle · The explanation · step 2 of 26 · part 2 of 3

Analysis: understand the problem (continued)

e.g.Example
Problem: a school canteen wants a top-up system for student cards. Requirements: input the card number and amount, add the amount to the balance, show the new balance. Abstraction: the colour of the card and the student's hair colour do not matter. Keep card number, name and balance. Decomposition: read card → choose amount → take payment → update balance.

7.1 The program development life cycle · The explanation · step 2 of 26 · part 3 of 3

Analysis: understand the problem (continued)

?Why?

Abstraction stops you wasting time on details that will not affect the program. Decomposition turns one scary problem into several small, easy ones.

7.1 The program development life cycle · The explanation · step 3 of 26 · part 1 of 3

Design, coding and testing

In design you plan how the program will work. You decompose further and use structure diagrams, flowcharts and pseudocode.

In coding you write the program. You test each part as you write it. This is called iterative testing: write a bit, test it, fix it, repeat.

In testing you run the finished program with planned test data to check it works for every kind of input.

7.1 The program development life cycle · The explanation · step 3 of 26 · part 2 of 3

Design, coding and testing (continued)

e.g.Example
Canteen system: Design: a flowchart for 'take payment'. Coding: write 'update balance' and test it with one card before writing the next part. Testing: try a top-up of 10 euros (normal), -5 euros (abnormal) and the largest allowed amount (extreme).

7.1 The program development life cycle · The explanation · step 3 of 26 · part 3 of 3

Design, coding and testing (continued)

!Watch out

Do not mix up iterative testing and final testing. Iterative testing happens during coding, part by part. Final testing uses a full test plan on the finished program.

8.1 Programming concepts · The explanation · step 4 of 26 · part 1 of 3

Variables: named boxes in memory

A variable is a named place in memory that holds one value. The value can change while the program runs.

The name is called an identifier. Cambridge pseudocode writes identifiers in PascalCase, such as `TotalScore`.

`DECLARE` gives the name and the data type before the variable is used.

The arrow `←` means assignment: work out the value on the right, then store it in the variable on the left.

8.1 Programming concepts · The explanation · step 4 of 26 · part 2 of 3

Variables: named boxes in memory (continued)

e.g.Example
Score ← 0 stores 0. Score ← Score + 5 reads the old value (0), adds 5, and stores 5. Output: 5
DECLARE Score : INTEGER
Score ← 0
Score ← Score + 5
OUTPUT Score
score = 0
score = score + 5
print(score)

8.1 Programming concepts · The explanation · step 4 of 26 · part 3 of 3

Variables: named boxes in memory (continued)

?Why?

Python does not need a declaration. It works out the type from the value. Cambridge pseudocode declares every variable so the type is clear to the reader.

!Watch out

Read `Score ← Score + 5` from right to left. It is not a maths equation. It means: work out Score + 5, then put the answer back in Score.

The explanation · 22 more steps

More on the lesson page

The lesson page has the rest of the explanation, step by step:

  • Constants: values that never change
  • The five data types
  • Choosing the right data type
  • Input and output
  • Sequence: one step after another
  • Selection with IF
  • Nested IF: up to three levels
  • Selection with CASE
  • Relational and logical operators
  • Arithmetic operators, DIV and MOD
  • Iteration: the count-controlled FOR loop
  • The pre-condition WHILE loop
  • The post-condition REPEAT UNTIL loop
  • Choosing the right loop
  • Totalling and counting
  • String handling: LENGTH, UCASE, LCASE
  • SUBSTRING and the first position: 1 or 0
  • Procedures and parameters
  • Functions: subroutines that return a value
  • Local and global variables
  • Library routines: MOD, DIV, ROUND, RANDOM
  • Writing maintainable programs

Open the lesson page