Moving on to how to program. What’s my best route in here? Scratch? Snap? JS Dares? Straight into Processing? Python?
DECISIONS.
2016 lessons
This block consisted of a total of 13 lessons, most of them around an hour and a half long (maybe more like 75 minutes, depending on how long choir went on for). On Thursdays I only had an hour, since I teach chemistry from 10:05, and on Wednesdays and Fridays I had to be out of the computer room by 10:05 so that another teacher could use it; that meant we had 25 minutes on those days to write in Main Lesson books.
A note on the Main Lesson in Steiner education: each class starts its day with a Main Lesson, of between about an hour to two hours (longer for younger classes). These are generally structured to start with some kind of rhythmic activity (in the upper school, this means choir); then there’s some time given over to recall of the previous day’s teaching. Most of the rest of the lesson follows along similar lines to lessons in most schools, but then the last part of the lesson is spent on ‘book work’ - the pupils work on putting together a book for every Main Lesson block they’re taught, usually adding about a page a day. Often these are illustrated, though I found it a little tricky incorporating strong visuals into this unit.
What follows below are some notes I asked myself before beginning.
What’s the most logical flow of this thing, pedagogically?
How should they write up their Main Lesson notes? Would it be sensible to do it online, or is that impossible in pairs?
If offline, need to allow time every lesson probably back in Class 9.
If online, we have a problem with other classes wanting to use the computer room.
What if they type up and print some pages?
After working through Lab 1, write about the nature of data and functions.
Literally just work through Lab 2
Then do the questions I didn’t make them do yesterday
just
get on with it
yeah
For each of the following terms, write
I also got some stuff about computer graphics in there
Start planning and/or making a simple Snap game.
Also, check out how HTML works.
Micro-Bits
JS Dares
OpenProcessing
CSS
Seven lessons to go…
I went for the slightly eccentric approach of starting with a textual programming language. There were a couple of reasons for this:
I’m personally more interested in graphics than sound, and suspect they teach more transferrable skills. So I’m looking at using Processing next time round.
[
{
“content”: “## Learning Objectives”
},
{
“content”: “## Starter Questions”
},
{
“content”: “## Notes”
},
{
“content”: “## Activities”
},
{
“content”: “## Book Work”
},
{
“content”: “## Evaluation”
}
]
Wrap up lesson
Introduce Scratch
An object is a kind of complex variable
about what you made with the Microbit, and any ideas you might have for other things you could try making in future.
Two lessons towards the end
First lesson
Barely touched on, in the end - ran out of time to play with electronics
Did a little bit on binary in section on history of computers, and a little on file formats in the final lesson (on the internet)
Covered in the penultimate lesson
Covered initially in lesson on Minecraft, in greater depth in Scratch
Covered over three lessons in Sonic Pi (conditionality; iteration; concurrency)
e.g. Sprites
How to place things on a screen.
Co-ordinates covered in Minecraft lesson, largely taken for granted in Scratch.
and commands
Covered in Sonic Pi and Scratch. Not encountered yet in the context of methods of objects.
Interactivity covered in Scratch lesson 2
Discussed in first lesson
Barely touched on.
Nothing.
Subject of final lesson.
This year I want to make sure all students have a chance to be exposed to the software and practices underlying general computer literacy.
My plan is to do this through tasks making use of relevant tools, with minimal introduction.
I have five lessons a week. Mondays, Fridays and some Wednesdays I teach till 10:30; one day a week Rachel will take them for a tutorial from 10:05; at least one day a week I need to set cover for another teacher.
Wednesdays and Fridays, KMR teaches in the computer room from 10:05 which means that the lessons can’t all be based there. I need to figure out what to get them to do with their non-computer time, given I don’t much want them to hand-write Main Lesson books.
First lesson should be largely spent on assessing where pupils are at so far with their understanding of and familiarity with computers.
Second lesson it makes sense to get them to start writing about what computers are and what they do.
Third lesson, maybe talk about what blogs are and how the internet works?
What is a computer?
Questionnaire
Any terms that are unfamiliar in there?
How do you all feel about the Steiner School’s policy on screen use, specifically avoiding computers before Class 9?
Is there anything that you would particularly like to learn about using computers?
Drawing heavily on https://www.raspberrypi.org/learning/sonic-pi-lessons/lesson-1/plan/
Not yet.
Pretty good discussions. Maybe a bit too much input from me. Everyone in the class engaged, though, and interesting observations from many participants.
Left quite a bit of time for introducing the Pi.
Besides being a useful thing to generally have a handle on, spreadsheets provide a handy introduction to:
I’ve had a few jobs where I’ve needed to use spreadsheets, but I’ve also used them for personal interest.
Need to incorporate some advice on safe internet use etc:
Online safety & basic search
How to use a spreadsheet: Basic skills like tabbing between cells, creating a chart, using simple functions.
How to use a wordprocessor: Basic skills like making headings, pasting images.
Research techniques: searching, finding Creative Commons images.
Using Word: Write up what exactly a computer is, including basic descriptions and examples of all its component parts and some Creative Commons images.
This was the class’s first chance to log in to computers, and play around with Excel; I’d originally intended for it to be a bit more structured, but in the end it felt like it made more sense for them to just try a couple of very simple things: enter some numbers in a spreadsheet, find their sum, find their average, make a chart.
What are some of the things you can do with a spreadsheet?
We talked a bit yesterday about some of the dangers of the internet. How can we minimise those risks?
(Also: we didn’t bring up the dangers of being misled, distracted or addicted!)
Spreadsheets are among the easiest ways to meet and experiment with ideas about data and functions.
Data is a collection of information that computers can work with. For example, it could be the numbers in a spreadsheet; or it could be the colours in a picture, or the notes in a piece of music.
Data can be represented in multiple ways, and that’s a big part of the power of computers. At a basic level, everything that computers do can be thought of as numbers. At an even more basic level, it is all about 1s and 0s.
We met two functions yesterday: sum and average. In maths, a function is just something that takes one or more inputs and produces an output, like a machine for turning numbers into other numbers. Another example could be ‘square’, which takes a number x as its argument (or input) and returns a value x×x as its value (or output).
That’s often what ‘function’ means in computing, too, but the concept is broader - a function in a programming language doesn’t always require input, it doesn’t always output a value, and it sometimes does other things too!
Using a chart to check whether stopping distance is proportional to speed.
Experimenting with different data sets and ways of representing and working with them.
Class discussion
Writing about what spreadsheets are, and what they’re used for.
Include a snippet of a spreadsheet.
Not bad; a little floppy in places. Need to make sure I have more satisfying data sets to play with next time (most of the ones I could find for this were too big, too cryptic and too hard to relate to).
Class discussion was a decent way to end the week, but I’d rather have them recording things if possible; it might be worth seeing if I can negotiate with Kirsty to swap rooms or something.
Checking in what people understand of the questions from yesterday (conditionals, etc.)
Not my best-planned lesson, but it was okay. Spent the last half-hour back in the classroom, largely holding forth about the history of computing.
Had a bit of Q&A about computers and science fiction after that.
Depending on what they name:
Introduction to blogging, and to Glow.
Online research: working in pairs for about half an hour, pick an episode from the history of computing, research it on the internet (make sure to look at more than one source). Write about 200 words on it (use your own words) and include a picture you found on the internet (or a space for a picture). Credit the picture, cite your sources.
Create a Glow blog. Save your work as a blog post.
If there’s time, write a blog post about everything you’ve made in Snap! to date.
A worthwhile exercise. Almost everyone in the class had a good idea about what they wanted to research, the exception being Celia & Fiona who were working together.
Most of the class were obviously comfortable using Word, but three or four of them struggled. Hopefully this was an opportunity for them to gain a little confidence.
I’d originally planned on introducing the Microbit in the same lesson as the internet history research, but we had a shorter time than usual in the computing room, and both the research and the Q&A session at the start were a little more time-consuming than I foresaw.
Further explorations of coding
Mini-lecture on markup
Look at HTML of a blog post
Continue self-directed work, but make sure to write it all up in the blog
Make sure blog posts are published, blogs are visible to Glow, I have URLs
Simulating gravity is super-easy.
Simulating motion, in general, is not hard.
Experiment with gravity
Start thinking about own project to work on this week
Have a quick look at HTML
Blog about plans for project
Worth including! Pretty satisfying. A bit messy. Do on Monday, as it’s the longest lesson?
A pretty good playful introduction to textual programming.
So nicely powerful, but is it too hard to get going with?
Worth getting them to just experiment with Inspect Element a bit more? Change the background of a page, that kind of thing?
What did you learn yesterday? Report back in pairs or similar.
The Microbit is 1/70th the size of the original BBC Micro, and 16 times the speed.
Another fun fact: When Star Trek (TNG) was filmed in 1989, Data was described as being able to perform 60 trillion operations per second (teraflops). At the time, that was 60,000x faster than any computer that had been invented. 26 years on, our most powerful computers are 500x as fast as Data.
Finish and print research from yesterday.
Pick a tutorial from the Microbit site, and work through it.
Write about things you’ve made.
Not a bad lesson. Spent a little while with the class sharing their research from the previous lesson. Some kids had fun with the Microbits. Not sure any of them were especially inspired.
Left them to do their own book work, on things they’d made in (or their general impression of) Scratch and/or Sonic Pi. Results were variable - a few seemed to have no idea what to put, but others evidently had plenty to say. I look forward to seeing this page in their books, more than the others.
Did anyone make anything interesting with the Microbit? Does anyone have any ideas for fun things to make with a Microbit or a Raspberry Pi?
Last lesson. Will need to spend some time on rounding up.
There are three main languages of the web: HTML, CSS and JavaScript.
HTML is the HyperText Markup Language. Without HTML, there is no web. ‘Hypertext’ here means that it is based on text with links to other bits of text. ‘Markup language’ means that it includes something besides text to give instructions about the text, in this case tags enclosed by <angle brackets>
Make an account on http://springtale.co.uk/school and write a blog post about the technology or idea described on the card I have given you (15 minutes).
Read submissions from the rest of the class. You may like to add respectful comments. Then add links to your post going to other posts on the site made by members of your class. (20 minutes)
Look at the blog post you made. Switch to Text viewing using the tab at the top right of the post editing window. That, there, is HTML. Switch back to the Visual mode, change some formatting, and then go back to HTML to see what’s different.
Now go to a web site of your choice and choose Inspect Element from the right-click menu to see how a web page is put together. You might like to change some of the text.
If there’s plenty of time, have a stab at a couple of things on http://jsdares.com
Write up about the internet.
But:
Introduction to functions.
Go to http://bit.do/function
Experiment with different mathematical functions and see what you find.
Record your results.
Look at http://bit.do/pfunction and try to make sense of what you see.
How to set up your Pi! Get it all plugged in, then log in. Introduce the command line - ls, cd, maybe mkdir, then startx.
Issue a Pi per pair and ask them to repeat what they just saw.
Once they’ve booted in, name the bits of the screen that they’re familiar with. What do they notice is different from Windows?
Load up Scratch, and load the Steerable Rocket example again. Let’s go through some of the different bits - draw an analogy between commands on the command line, and commands (or functions) in Scratch. Draw attention to the things from the Event block, and go through how to add more controls to this ‘game’.
Note the various other kinds of Event - collisions, interactions of different sorts…
Now that we’ve introduced the idea of a Speed variable, let’s introduce Acceleration. This could control how fast the rocket can change velocity; we could also introduce gravity.
Each pupil needs to research a term and explain them to the rest of the class next week, without notes:
Plenary
What did you discover?
This week’s homework (?)
Scratch is a visual programming language. It’s structured in blocks, which you can fit together a bit like Lego blocks.
Here’s a program that makes the Scratch cat draw a square. Play about with the numbers - see if you can make a bigger square, a triangle, a pentagon.
Table 4.2 Typical car stopping distances
Speed (mph)
20 30 40 50 60 70
Typical stopping distance (car lengths)
3 6 9 13 18 24
Every computer includes some form of storage, and a processor capable of acting on the information stored there. For a computer to communicate with the outside world, it also needs some kind of input and output.
See Notes: A summary of the nature of a computer, with an annotated diagram of a computer of their choice.
Partial success. Activity with cards did not go over; maybe they were embarrassed? Maybe it was unclear? Maybe I should have made them actually stand in a line?
Also felt like I hadn’t really explained enough about what they were looking at for them to spend the time available to play with code. Some pupils were altogether baffled; some made great progress; several got somewhere, but slowly.
A computer program consists of a series of commands for the computer to follow, one after the other. They often take parameters, for example with the play
method in Sonic Pi you need to specify which note you want it to play, like `play :c’.
An iterator is a special kind of command that tells the computer to run a block of commands repeatedly.
Plug in RPis. Load Sonic Pi. Check that they are working by entering the command
play :c
to play middle C (the weirdly placed colon tells Ruby the ‘c’ is a symbol). Note that play 60
should produce the same note, as should :c4
(:c5
would be one octave higher).
To change the sound of the note, use the synth
command.
You can also play samples using sample :bd_haus
and so on.
Use sleep
to pause between notes.
Put together a bassline or riff using this knowledge.
Now, try looping this riff using 5.times do ... end
Overview of what programming languages do
Definitely a better lesson. Everyone engaged, probably learning. Half hour of book work at the end, since we had to vacate the computer room for another class.
if
statementHow do you write a loop?
What’s a parameter?
Starter: can we listen to what people made last lesson?
Pupils should be should be shown how to add some randomisation to their code. This can be achieved by using the statement rand(10), which returns a random value between 0 and 10 (from 0 up to but not including the number you specify). You can specify other numbers for larger ranges; for instance, rand(20) will return values from 0 to 20. Let’s use this in our program by adding our random number to a note with the + operator:
3.times do
play 60 + rand(10)
sleep 0.5
end
Invite the pupils to observe the actual number of the note played in the output window.
Pupils should then be shown how to write an if statement in the Sonic Pi application. Ask them to copy the following code on their machines:
if rand < 0.5
play 60
sleep 0.5
play 62
else
play 72
sleep 0.25
play 71
sleep 0.25
play 70
end
After they’ve had a chance to experiment, see who’s willing to share their work.
Finally, teach the class that the hash symbol # is used to make a comment. Invite them to place comments in their code to explain what is happening. This is not just for other programmers who might read their code; it is also for themselves in the future, when they look back at old code they may have written a long time ago and have forgotten what it does. For example:
None this lesson - leaving at 10:05, and it makes sense to lump today’s and yesterdays lessons together in their books, so they can do that tomorrow.
Introduce a third way of controlling the flow of a program: doing two things at once (concurrency). Obviously this is very important in music. Try this:
in_thread do
10.times do
play 60
sleep 0.25
end
end
play 60
sleep 0.5
play 62
sleep 0.5
play 64
sleep 0.5
play 65
sleep 0.5
play 67
sleep 0.5
play 69
sleep 0.25
play 72
So far, almost all of the data you’ve been using has consisted of individual numbers. However, it’s often useful to store several numbers in one data structure. For example, we used this in play_chord
yesterday. What other kinds of data might consist of a list of numbers?
Play several notes in a row like this:play_pattern [40, 25, 45, 25, 25, 50, 50]
Try some sequences of your own.
Once they’ve had a short play with this, invite them to form a line and hand out cards (in no particular order), so each pupil in the line holds just one card. Explain that they have formed a list of numbers and that there are useful things that you can do with this. One example is sorting the numbers numerically, so that the smallest numbers are first and the largest last. Introduce the word ‘algorithm’ as a method for solving such problems.
Next, explain that we will explore a simple sorting algorithm: bubble sort. Start at the left hand side of the line and ask the first two pupils to compare their numbers. If they are in the right order do nothing, otherwise ask the pupils to swap. Then continue to the second and third pupils, and compare and swap again if necessary. Continue down the line. If at least one pair has swapped, start at the beginning of the line and repeat. If no pairs have swapped, the list is sorted.
Explain that most programming languages provide many such algorithms to make programming easier, and to reduce the amount of work you have to do as a programmer. Ask the pupils to type the following code:
`play_pattern [40, 25, 45, 25, 25, 50, 50].sort
play_pattern [40, 25, 45, 25, 25, 50, 50].shuffle`
Pupils are invited to play around with the constructs of this lesson, in addition to everything they’ve learned so far, to design a simple musical program.
The simplest computer programs are like recipes where a series of instructions are completed one after the other, but it’s useful to be able to include instructions for which instruction to run next.
if
will run a block of code only if some condition is met; this can be followed by else
.
Different kinds of loop
will keep running a block of code - either a set number of times (a ‘for
loop’), or as long as some condition is met (a ‘while
loop’), or just until something happens to stop it (an infinite loop).
Sometimes we want to run more than one bit of code at a time, which means using thread
s that run concurrently.
[Illustrate these with flowcharts]
Pretty solid lesson. With coaxing, got them to execute the bubble sort algorithm. Quite a lot of experimentation; most at least tried one or two things with threads.
This lesson draws heavily on https://www.raspberrypi.org/learning/getting-started-with-minecraft-pi/worksheet/
Things to know before you start:
Start Minecraft. Familiarise yourself with it, if you’re not already. Work through the worksheet!
With Minecraft running, and the world created, bring your focus away from the game by pressing the Tab key, which will free your mouse. Open Python 3 from the application menu and move the windows so they’re side-by-side.
You can either type commands directly into the Python window or create a file so you can save your code and run it again another time.
If you want create a file, go to File > New window and File > Save. You’ll probably want to save this in your home folder or a new project folder.
Start by importing the Minecraft library, creating a connection to the game and testing it by posting the message “Hello world” to the screen:
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
mc.postToChat("Hello world")
If you’re entering commands directly into the Python window, just hit Enter after each line. If it’s a file, save with Ctrl + S and run with F5. When your code runs, you should see your message on screen in the game.
Find your location
To find your location, type:
pos = mc.player.getPos()
pos now contains your location; access each part of the set of coordinates with pos.x, pos.y and pos.z.
Alternatively, a nice way to get the coordinates into separate variables is to use Python’s unpacking technique:
x, y, z = mc.player.getPos()
Now x, y, and z contain each part of your position coordinates. x and z are the walking directions (forward/back and left/right) and y is up/down.
Note that getPos() returns the location of the player at the time, and if you move position you have to call the function again or use the stored location.
Teleport
As well as finding out your current location you can specify a particular location to teleport to.
x, y, z = mc.player.getPos()
mc.player.setPos(x, y+100, z)
This will transport your player to 100 spaces in the air. This will mean you’ll teleport to the middle of the sky and fall straight back down to where you started.
Try teleporting to somewhere else!
Set block
You can place a single block at a given set of coordinates with mc.setBlock()
:
x, y, z = mc.player.getPos()
mc.setBlock(x+1, y, z, 1)
Now a stone block should appear beside where you’re standing. If it’s not immediately in front of you it may be beside or behind you. Return to the Minecraft window and use the mouse to spin around on the spot until you see a grey block directly in front of you.
An algorithm is a series of steps for solving a problem, or achieving some other goal. They often form part of a computer program, but we also use algorithms when performing mental arithmetic and so on.
Alorithms are named after the great Persian mathematician, astronomer and geographer, al-Khwārizmī.
https://en.wikipedia.org/wiki/File:1983_CPA_5426_%281%29.png
Pretty weak lesson. The big disadvantage of Minecraft is that it invites kids to just muck around building/destroying stuff in a way that it’s not obvious they’re learning anything at all.
Format of resource from Raspberry Pi Foundation was a problem: didn’t want to print 8 sets of 13 pages, so distributed files on USB sticks, which was a faff already (especially since I only had 3 sticks handy) - then the HTML worksheet file bizarrely opened in Geany by default, rather than in the browser.
Out of 7 groups, we had:
This lesson is mainly following https://www.codeclubprojects.org/en-GB/scratch/rock-band/ (short URL: http://bit.do/scratcha )
This was a fun lesson. The Code Club resource worked well; the only people who didn’t work through at least most of it were those who were already working at a somewhat higher level than the rest of the class.
So the next step is to build on their understanding of the Scratch environment to familiarise themselves with more of its possibilities…
Here I’m using my own resources exclusively.
Adapt Space Chase using a variable to change the speed and control it using the keyboard. Add another one to keep track of collisions and things.
Customise in any other way you feel like.
Share your work.
A variable is a symbol referring to a value which might vary. For example, the velocity of an object is often assigned to a variable v
.
In maths, a variable is usually a letter representing a quantity. In programming, the idea is broader: it can be any name representing anything the computer can store (which could be a number, text, an object, etc.)
A constant is like a variable, only it doesn’t vary.
Decent lesson. Angelina didn’t engage much. Everyone else did a good portion of the work, at least. Keelin, Paul and Kira got distracted mucking about with the Scratch web site’s social networking features.
clone
s in a programAn event triggers a program to take action. For example, the user might click a button to make something happen.
Events can also be triggered by a program, for example when one thread
needs to send a message to another. This is useful when something affects more than one sprite in a game at a time (like Game Over, or Next Level).
Modify Space Chase so that a collision results in an Event being broadcast, positions reset and 1 life being lost.
Use a new sprite with create clone of
to make it possible to fire at the pursuing spaceship.
Detect what your spaceship reaches the edge and loop it around?
This is a Thursday, so I’m teaching chemistry and leaving them to get on with it.
Can anyone identify all of these things?
(a ZX81, a BBC Micro, a computer tape, two kinds of floppy discs and a CD-ROM)
Behold, the ZX81 and the BBC Micro!
This seemed to work pretty well; they listened with apparent interest and occasional laughter to me talking about the history of the internet, and only a little less interest in the history of the computer leading up to that time (I ended up starting in about 1981 and then looping back round, since I had artifacts dating from that time which made quite a nice starter activity).
It probably would have been better to split the history of computing over two lessons, in retrospect.
HTML
HTML tag
CSS
JavaScript
WWW
URL
Jpeg
GIF
Content Management System
ftp
Functions (in maths) are things that take one number and turn it into another.
Draw a box on the whiteboard, with numbers going in and numbers coming out. Hands up if you think you know what the box is doing. Ask person with hands up to predict the next number.
Try another one.
Ask if anyone has ideas for another one. Get them to write it on the board and get people to guess.
Last week we made the Scratch Cat draw squares and triangles. What if we want it to be able to draw a shape with any number of sides we choose?
Have you come across the idea of variables in maths?
So a variable is a name given to a quantity, or thing, that can vary. It could represent the speed of an object, for example, or the amount of liquid in a container.
Here’s a program where you get to control a rocket-pen. How could you change the speed of the rocket using a variable? How could you allow the user to control that variable? Work in pairs or threes, and think if there’s anything else you might want to change. In twenty minutes we’ll all look at what the other pairs have made.
Sharing work.
This tiny computer is called a Raspberry Pi. We have one for each person in the class, and we’re going to start playing with them for real next week.
This thing is just slightly smaller than the 16k RAM pack we used to hold in the back of my ZX81 with Blu-tack to keep it from wobbling too much. It has 32,000 times as much RAM, and this tiny micro-SD card that goes in it has 16 times as much again, so altogether it has eight and a half million times as much memory as the original ZX81. It runs faster than any computer that existed anywhere in the world before about 1992, when I was your age.
It’s pretty slow by modern computing standards, but it’s powerful.
It’s also versatile - half of the fun of this thing is that you can plug all kinds of things into it - if I attach an LED to these two pins, you can see it light up. We could use it to build robots or light shows, take pictures from a high-altitude balloon, all kinds of things.
I also like the Raspberry Pi because you can see what makes up a computer right there - a power supply, a main processor (with the RAM right there), and various connectors to the outside world - 4 USB sockets, one for a monitor, a socket to output sound, one to connect it to a network, a slot for a camera, and so on.
What did you learn? Discuss in pairs.
Make an account on the Scratch web site, and upload a project that involves at least one variable, and something moving around. Upload it to the class studio on the Scratch site
I wonder if I gave insufficient guidance on this last year?
Conditionals (if/else) and iteration (for/while)
First we need to define a variable for the number of sides.
Then it needs to turn that fraction of an angle between each line.
Is there anything else we might want to change?