☰ Year plan · Communication Technology

Code, mazes and flowcharts

Week 27 · Theme 4, Lesson 6 Principles of Programming · 3 lessons
1

Code: instructions for a computer

ICT P4 Term 2, Theme 4: pp. 66–69
GoalSay what coding is and why a computer needs exact instructions.
New words
program · a large set of algorithms working togethercode · the instructions we write for a computerprogramming language · a language a computer understands, used to write codeexact · completely clear and specific
Explanation

Cartoons, films and video games are made with code. Coding, or programming, means writing many algorithms to build a whole program. A program is like a whole cookbook, and each recipe in it is an algorithm. People talk to each other in languages such as Arabic and English. Computers use programming languages, and there are many of them. A computer follows your instructions exactly and cannot guess what you meant. If you tell a robot friend “walk”, it does not know how far or where. So code needs exact instructions: how many steps and in which direction.

What I say to a friendWhat I must tell a computer
Go to the door.Turn right, walk 5 steps, then stop.
Draw a square.Draw a line, turn a quarter turn, and repeat that 4 times.
Wait a little.Wait 2 seconds.
Worked examples
“walk”?“walk 3 steps”✓
In a robot game, Marwan tells Seif: “walk”. Seif does not know where or how far. But “walk 3 steps forward” is an exact instruction.
the catjumps upcomes down
In a cartoon, the code tells a cat: when the key is pressed, jump up two squares and then come back down.
human languagesprogramming languages
Just as Salma speaks Arabic with her grandmother and English at school, a programmer may use different programming languages for different jobs.
Class activity

Robot and programmer. Work in pairs: one is the programmer and the other is the robot. The programmer gives exact commands only from this list: forward 1, turn left, turn right. The robot must obey exactly, even if it looks funny. The goal is to walk from your seat to the door. Then swap roles. What happened when a command was not exact?

Practice
1
What does coding mean?
2
Name two things made with code.
3
Why does a computer need exact instructions?
4
Which instruction is exact enough for a robot? A “go there” B “forward 3 squares” C “move a bit”