
Y11 CS Unit 10 T4 Maintainable programs
Presentation
•
Computers
•
12th Grade
•
Practice Problem
•
Easy
Michael Harrington
Used 4+ times
FREE Resource
15 Slides • 14 Questions
1
Objectives
• Understand how to create maintainable programs
including the appropriate use of:
• Meaningful identifiers
• Comments
• Procedures and functions
• Relevant and appropriate commenting of syntax
• Use meaningful identifiers for:
• Variables and constants
• Arrays
• Procedures and functions
2
Multiple Choice
This topic may come up in the exam.
If you read this carfully you should be able to get 90% +
How will you ensure a good grade in the GCSE in 3 months?
Guess the answers
Do not bother reading the slides
Read carefully as this time is your exam revision on this topic
Just chat and not pay attention
3
Fill in the Blanks
Show you know the objectives:
including the appropriate use of <?> identifiers
4
5
Fill in the Blanks
Show you know the objectives:
including the appropriate use of Procedures and <?>
6
Fill in the Blanks
Show you know the objectives:
Use meaningful identifiers for <?> and constants
Type answer...
7
Maintainable programs
Unit 10 Advanced programming and databases
Starter
• Think about programs you have
looked at and programs that
you or your friends
have written
• What features made them
easy or hard to read, edit
and understand?
8
Open Ended
Think about programs you have looked at and programs that you or your friends have written.
What features made them easy or hard to read, edit and understand?
9
Maintainable programs
Unit 10 Advanced programming and databases
Starter
• Programs are easy to maintain (read, understand
and make changes to) when
• They use meaningful identifiers for variables, constants,
arrays, procedures and functions
• They have useful comments that are relevant and appropriate
• They make use of procedures and functions
• Another area that helps to make programs easy to
maintain is:
• Good use of indentation and whitespace
10
Maintainable programs
Unit 10 Advanced programming and databases
Meaningful identifiers
• The two programs below are the same algorithm
• Which is easier to understand? Why?
INPUT a
INPUT b
INPUT c
d <- a + b + c
e <- d / 3
OUTPUT e
INPUT num1
INPUT num2
INPUT num3
total <- num1 + num2 + num3
average <- total / 3
OUTPUT average
11
Multiple Choice
The two programs are the same algorithm
Which is easier to understand?
Left
Right
12
Open Ended
The two programs are the same algorithm
Which is easier to understand?
Why is your chosen one easier?
13
Maintainable programs
Unit 10 Advanced programming and databases
Meaningful identifiers
• The two programs below are the same algorithm
• Which is easier to understand? Why?
• It is important to use meaningful names for
variables, constants, arrays, functions & procedures
• This makes code easier to read and understand
INPUT a
INPUT b
INPUT c
d <- a + b + c
e <- d / 3
OUPTUT e
INPUT num1
INPUT num2
INPUT num3
total <- num1 + num2 + num3
average <- total / 3
OUTPUT average
✓
14
Maintainable programs
Unit 10 Advanced programming and databases
Maintainable programs
• Programs need to be maintained
• This will be to improve the code, fix bugs or add new features
to the program
• It may be carried out by the original programmer or different
programmers
• It is important that programs are written in a way to
make them easily maintainable. This includes:
• Using meaningful identifiers
• Adding comments
• The use of functions and procedures
• Indentation
15
Maintainable programs
Unit 10 Advanced programming and databases
Commenting
• Comments in code help other programmers to
understand your code
• They also help you understand your code when you go back
to it at a later time
• Which parts of programming code tend
to be commented?
• Which parts are typically not commented?
16
Maintainable programs
Unit 10 Advanced programming and databases
Commenting
• Comments are usually written for:
• Parts of a program/algorithm that are difficult to understand
• At the start of a function or procedure to explain what it does
• Comments usually aren’t written for:
• Every line of code
• To explain parts of code that are obvious
• To explain easier syntax used in the programming language –
programmers are expected to look up and learn parts of the
language that they don’t understand
17
Reorder
Reorder the following about Comments
Comments are usually written for: Parts of a program/algorithm that are difficult to
understand. At the start of a function or procedure to explain what it does. Comments
usually aren’t written for: Every line of code. To explain parts of code that are
obvious. To explain easier syntax used in the programming language – programmers
are expected to look up and learn parts of the language that they don’t understand.
18
Maintainable programs
Unit 10 Advanced programming and databases
Procedures and functions
• Subroutines include functions and procedures
• Well written subroutines will take inputs (through parameters)
and if necessary return a value
• They should be written in a modular so that they can be
reused multiple times in the program or by other programs
• The two programs below are for a function that works out the
area of a circle. Which is more easy to reuse and help create
maintainable code?
FUNCTION circle(radius)
area = 3.14 * radius^2
RETURN area
ENDFUNCTION
FUNCTION circleFive()
area = 3.14 * 5^2
RETURN area
19
Drag and Drop
Well written subroutines will take
They should be written in a
20
Maintainable programs
Unit 10 Advanced programming and databases
Using subroutines
• The program on the left takes any sized radius as
an input
• This means that it is reusable many times in the program and
in other programs
• This will make a larger program easier to maintain as there
will be just one function to calculate the area of a circle
FUNCTION circle(radius)
area <- 3.14 * radius^2
RETURN area
FUNCTION circleFive()
area <- 3.14 * 5^2
RETURN area
✓
21
Maintainable programs
Unit 10 Advanced programming and databases
Indentation
• Look at the following pseudocode:
tables <- 12
rows <- 12
FOR i <- 1 TO tables
FOR j <- 1 TO rows
answer <- i * j
NEXT j
NEXT i
OUTPUT i, "x", j, "=", answer
• Why would the use of indentation improve it?
•Why may indentation be essential in some languages?
22
Open Ended
Question from the previous slide:
Why would the use of indentation improve it?
23
Open Ended
Question from the previous slide:
Why may indentation be essential in some languages?
24
Maintainable programs
Unit 10 Advanced programming and databases
Indentation
tables = 12
rows = 12
FOR i - 1 TO tables
FOR j = 1 TO rows
answer = i * j
NEXT j
NEXT i
OUTPUT i, "x", j, "=", answer
• Why would the use of indentation improve it?
•Indentation makes it possible to easily see which lines of
code are part of different structures
• Why may indentation be essential in
some languages?
•Some languages use braces { } to show where structures
start and end, but some, such as Python use indentation
25
Maintainable programs
Unit 10 Advanced programming and databases
Plenary
• The following code calculates the area of a triangle
• Look at the following and explain at least four improvements
that would make it more maintainable
FUNCTION triA(a, b)
c = 0.5 * a * b
RETURN c
ENDFUNCTION
OUTPUT triA(5, 3)
26
Multiple Select
The following code calculates the area of a triangle
Look at the following and select improvements that would make it more maintainable
FUNCTION triA(a, b)
c = 0.5 a * b
RETURN c
ENDFUNCTION
OUTPUT triA(5, 3)
Meaningful identifiers for the function name
Use of comments that are irrelevant and inappropriate
Indentation
Meaningful identifiers for the compiler to understand
Well spaced out for readability
27
Open Ended
Use SHIFT and ENTER for a new line!
Re write this function with the improvements that would make it more maintainable at least four improvements that would make it more maintainable
28
29
Multiple Choice
Which is correct for the previous code and as in the image?
10 marks for getting this correct
Objectives
• Understand how to create maintainable programs
including the appropriate use of:
• Meaningful identifiers
• Comments
• Procedures and functions
• Relevant and appropriate commenting of syntax
• Use meaningful identifiers for:
• Variables and constants
• Arrays
• Procedures and functions
Show answer
Auto Play
Slide 1 / 29
SLIDE
Similar Resources on Wayground
20 questions
REMOTE DESKTOP CONFIGURATION
Presentation
•
12th Grade
19 questions
Module 1 Lesson 3A: Storage Devices
Presentation
•
12th Grade
26 questions
PROGRAMMING-ARRAY
Presentation
•
12th Grade
25 questions
HDD and SSD
Presentation
•
University
22 questions
Security
Presentation
•
11th Grade
25 questions
01 Python Basics
Presentation
•
University
24 questions
Government Response to the Great Depression
Presentation
•
11th Grade
Popular Resources on Wayground
10 questions
Safety Day 2026 – Student Review
Quiz
•
9th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade