Computing fundamentals
Lesson 3
Fundamentals of
programming
Complete the algorithm
Groan Throw off duvet
Hit snooze button
Repeat X times
When alarm rings
Hide under duvet
Turn off alarm
Put feet on floor
Get up
Complete the algorithm
When alarm rings
Repeat X times
Groan
Hide under duvet
Hit snooze button
Turn off alarm
Throw off duvet
Put feet on floor
Get up
Algorithms
A set of instructions, steps or rules to solve a problem
or complete a task.
Written for humans to follow
Can be written in different ways
Pseudocode
A way of writing algorithms that uses plain text English
A simple way of describing an algorithm
IF grade is greater than or equal to 60
OUTPUT Print "passed"
ELSE
OUTPUT Print "failed"
Flowcharts
A diagram that represents an algorithm using standard
symbols
Start
Read grade
Yes No
Is grade >=60?
Output Output
Print Print
“Passed” “Failed”
Stop
Learning objectives:
● to understand the relationship between algorithms and
programming
● to understand and use pseudocode and flowchart
algorithms
● to tinker, testing and debug to create a working
program using a graphical programming language
What is programming?
The process of writing computer code to create a
program.
Translating the steps in an algorithm into a language
the computer can understand so the problem can be
solved.
Programming languages
A language we can use to write the steps of the
algorithm so the computer can understand and run it.
What programming languages have you already used?
E.g. MakeCode
Algorithms to Programs
Start
When button A pressed
play high C INPUT
Button A pressed
show smiley face
OUTPUT
Play high C
When button B pressed
play low C
Output
Display smiley face
show sad face
Stop
Testing & debugging
● Everyone makes mistakes
● Regular testing is essential to:
○ make sure the program does what you expect
○ spot any ‘bugs’
● You can then ‘debug’ the program as you go to remove
errors
○ identify where the bug is
○ step through the code where the bug is
○ find and fix the error
○ test again
Learning objectives revisited:
● to understand the relationship between algorithms and
programming
● to understand and use pseudocode and flowchart
algorithms
● to tinker, testing and debug to create a working
program using a graphical programming language
Lesson review
● What is programming?
● Why are pseudocode and flowcharts used to write
algorithms before programming
● Why is regular testing important when programming?
● What is debugging?
● What is a graphical programming language?
Copyright information
Published by the Micro:bit Educational Foundation [Link]
Licence: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)