What is Code?
Time 1.8 hrs

Difficulty Beginner
Prerequisites Problem Solving
Departments Science
Authors Sandra Kuipers
Groupings Individual
Minimum Year Group None


Start learning to read and write some code.


This work is shared under the following license: Creative Commons BY-SA-NC


Learner Outcomes
Students will:
  • ...
Competency Focus
  • ...
Interdisciplinary Connections
  • ...
What was successful? What needs changing? Alternative Assessments and Lesson Ideas? What other Differentiation Ideas/Plans could be used?
  • ...
Any CC attribution, thanks, credit, etc.

This page requires you to be logged in to access it. Please login and try again.
5 mins
Want To Change The World?
The Pitch
  • Programming, known as the "new superpower", let's you control computers, create something from nothing and change the world. So, want to learn how to build awesome stuff?
  • The following companies were started by individuals with programming skill: they turned an idea into multi-billiion dollar business that have changed our lives. Amazing.

5 mins
Getting Started
  • In this unit you will learn the fundamentals of code. From this simple start, you can build your knowledge to develop more complex systems.
  • At it's most basic, programming can be thought of as  “the creation of computer software”.
  • As you learn, please try to remember that programming is an exercise in problem-solving, patience and intellectual curiosity.
5 mins
What is Code?
Getting Started

15 mins
Early Code
Punch Cards
  • Code hasn't always been written with words.
  • Long before programmers wrote code with keyboards, they punched code as tiny holes in paper.
  • Punch Cards were one of the earliest ways to write computer instructions.
  • This is an early programmer:
  • She's writing code, which will be physically fed into a computer to run a set of instructions.
  • The box next to her has a whole stack of punch cards.
  • You can't fit too many commands on a single card, so programs were written as stacks of cards.
  • This is what a punch card looks like up close:
  • How do the numbers relate to the letters above?
  • Want to see it in action? You can write your own punch card.
  • Visit Masswerk Virtual Keypunch
  • Type some words, then hit the Release key to create your punch card.
10 mins
  • We saw how code can consist of holes in a piece of paper.
  • But punch card programmers didn't just write:
    • "Hello computer, please add these numbers together"
  • They used special words and symbols the computer could understand.
  • These special instructions are called the syntax of a computer language.

  • All programming languages have at least one thing in common: syntax.
  • Syntax is the special set of rules that defines a particular programming language.
    • Human languages have syntax too.
    • The English language uses a set of grammar to say what is and is not correct English.
    • The period at the end of a sentance and the capital letter at the start is part of English syntax.
  • The above picture is an example of HTML syntax.
  • There's some words in there that look English.
  • The rest is made up of words and symbols like <head> and <body>
  • These are the tokens that a computer understands.
  • Tokens are then converted by the computer into machine language (think 1s and 0s).
15 mins
Reading Code
Digging In
  • Luckily we won't be punching holes in this class: modern programming languages use words.
  • Let's start learning to read and write some basic code.
  • In English, the punctuation ! ? "" $ we use has a specific meaning.
  • In code, symbols like a semicolon ; braces { } and equal sign = also have a specific meaning.

  • The snippet below is very similar to the example we just saw.
  • Press play to run this code.
  • Change some lines in the code and press play again.
  • Can you get the password checker to say "Correct!"
  • You can also edit a live example of the password checker.

10 mins
Writing Code
Digging In
  • If and else are an important part of code: this is where decisions happen.
  • For example, this is a simple if statement:
    if (you are tired) {
        get some sleep.
  • This is an if statement with an else (which means "otherwise"):
    if (it is a typhoon) {
        stay home.
    } else {
        go to school.
  • We can read this as "If it is a typhoon then stay home, else go to school".
  • Anything in the else section happens if the first thing is not true.
  • If and else work well together when we have a yes/no decision to make.
  • We can also combine if and else together to make elseif.
    if (it is the weekend) {
        stay home, have fun.
    } elseif (it is a holiday) {
        go traveling!
    } else {
        go to school.
  • Writing code in words like this is called pseudocode.
  • It's not a specific programming language, "pseudo" means imitation or "fake" code.
  • Code like this won't compile, but it's a very handy first step for writing real code.
45 mins
Your Robot Clone
  • Picture you have been given a robot clone that looks exactly like you.
  • You could send it out into the world and it could pretend to be you.
  • You could do fun stuff while the robot cone does all the boring stuff.
  • But, it doesn't come with any programming.
  • Your goal is to write some pseudocode to program your robot clone for a typical day.
    • Create a Google doc.
    • Take a moment to think about the decisions you make in a day.
    • What kind of decisions would your robot clone need to make?
    • Write some simple if, if else, and if elseif else statements to program your robot.
    • Writing pseudocode means you can use regular English words, like our example above.
  • Program as may decisions as you can think of. These can be in a list, one after another.
  • Try to think of what could go wrong in a day. Can you program your robot to respond?
  • Once you're done, submit your pseudocode as evidence of learning in this unit.
There are no records to display.
Powered by Gibbon v27.0.00dev

Founded by Ross Parker at ICHK Secondary | Built by Ross Parker, Sandra Kuipers and the Gibbon community
Copyright © Gibbon Foundation 2010-2024 | Gibbon™ of Gibbon Education Ltd. (Hong Kong)
Created under the GNU GPL | Credits | Translators | Support