Choose exam board for KS4 Computer Science (GCSE)
Choose exam board for KS4 English
Choose exam board for KS4 French
Choose exam board for KS4 Geography
Choose exam board for KS4 German
Choose exam board for KS4 History
Choose tier for KS4 Maths
Choose exam board for KS4 Music
Choose exam board for KS4 Physical education (GCSE)
Choose exam board for KS4 Religious education (GCSE)
Choose exam board for KS4 Spanish

      Refining code for a programming project

      Lesson details

      Learning outcome

      I can identify and make improvements to refine code.

      Key learning points

      1. Reviewing code means checking how well it works, how readable it is and whether it meets the functional requirements.
      2. Improving code may involve simplifying logic, breaking large sections of code into subroutines or correcting any errors.
      3. Code should be readable and maintainable, so that others can understand and work with it easily.

      Keywords

      • Modularity - breaking software into independent, self-contained units or modules

      Common misconception

      A function and a procedure are the same.

      A function is different from a procedure because it returns a value or values to the main program.

      Teacher tip

      This lesson assumes pupils have already developed a part-completed solution. If required, you can provide them with a sample solution at oak.link/stream-scheduler.

      Equipment

      Pupils will need access to a device that can edit and run Python programs. Examples in this lesson use the RPF Code Editor https://oak.link/python-editor

      Licence

      This content is © Oak National Academy Limited (2026), licensed on Open Government Licence version 3.0
      except where otherwise stated. See Oak's terms & conditions
      (Collection 2).

      Lesson video

      Loading...

      Prior knowledge starter quiz

      6 Questions

      Q1.
      Which statement best describes a functional requirement?

      The program should look appealing.
      Correct answer: The program must allow users to print documents.
      The program should run quickly.
      The program must use a specific brand of computer.

      Q2.
      What is the main purpose of validation in a program?

      to improve the appearance of data
      to increase the speed of processing
      to change the data format
      Correct answer: to check that data meets certain standards

      Q3.
      What is a key feature of a list as a data structure?

      It can only store numbers.
      It is always a fixed size.
      Correct answer: It can contain items of different data types.
      It cannot be changed after creation.

      Q4.
      Put these steps in the correct order for processing data in a program:

      1 - data is input
      2 - data is validated
      3 - data is processed
      4 - data is output

      Q5.
      Match each term to its correct description:

      Correct Answer:functional requirement,specifies what a system must do

      specifies what a system must do

      Correct Answer:validation,ensures data meets criteria before use

      ensures data meets criteria before use

      Correct Answer:list,stores multiple items and can change size

      stores multiple items and can change size

      Q6.
      What is an output in a program?

      the data entered by a user
      the calculation the program performs
      Correct answer: the result shown on screen
      the process of sorting data

      6 Questions

      Q1.
      What is the main reason for reviewing code?

      Correct answer: to check readability, functionality and requirements
      to make the code longer
      to add more comments
      to change the programming language

      Q2.
      What word describes code that is organised into independent sections, making it easier to understand and maintain?

      Correct Answer: modular

      Q3.
      Which of these is an example of improving code?

      making variable names shorter
      adding unnecessary lines
      removing all comments
      Correct answer: breaking down large code into subroutines

      Q4.
      What Python statement allows you to use functions that generate unpredictable numbers, such as for picking a value from a list at random?

      Correct Answer: import random

      Q5.
      Match each example to the correct concept:

      Correct Answer:modularity,breaking code into subroutines

      breaking code into subroutines

      Correct Answer:function,a block of code that gives back a result

      a block of code that gives back a result

      Correct Answer:code review,looking for errors and improvements

      looking for errors and improvements

      Q6.
      Which statement correctly explains the difference between a function and a procedure in programming?

      both return a value to the main program
      only a procedure can take parameters
      Correct answer: only a function returns a value to the main program
      both are used only for displaying information

      To help you plan your 11 computer science lesson on: Refining code for a programming project, download all teaching resources for free and adapt to suit your pupils' needs...