Writing programming workshop resources

I write a lot of educational resources, so I thought it might be useful to share some tips for things I’ve learnt over the years. I’m hoping that these tips will be particularly helpful for those people in the wider community who volunteer to give up a lot of their time to run workshops for kids but who don’t necessarily have formal training in education.

Avoid a wall of text – Before you start writing anything at all, think about how old the learners are. If you’re working with very young children (5 – 7 years old) you will need to keep the written instructions to a minimum and use lots of pictures and screenshots. As the children get older they can cope with more verbose instructions…up to a point. Children don’t read instructions, and it’s not because they are naughty, easily distracted or can’t cope with the task. (Most adults don’t read instructions properly either!) Use pictures and diagrams as much as you can in place of lengthy explanations.

Check the level – The most common mistake I see in resources not written by teachers is vastly overestimating the level a child will be able to cope with. I’ve seen people assume that 8 year olds can cope with things that are introduced at A-Level. I’ve also seen people saying the equivalent of “the 7 year olds in my programming club wrote a recursive fibonacci sequence function last week”. No they didn’t. *You* wrote a recursive fibonacci sequence function last week and they copied out your code. If you’re not sure what level is appropriate, ask someone! There are plenty of experienced educators on twitter who could field your question. (Of course there will always be individual children whose capabilities far exceed their peers, but suitable tasks for a workshop should be designed with the average attendee in mind.)

Don’t make them type the hard stuff – If the thing you want to create requires a little bit of difficult code that is beyond your learner, that’s fine. Don’t make them copy out unintelligible (to them) code and say “don’t worry about what this does” though, give them a starter file with your code inside it. You could also consider using a site like trinket.io where you can add your code in a separate tab and let them get on with their bit.

Give clear instructions – When you ask the learner to perform a task, make the instruction for what they have to do explicit and clear. “You’ll need a forever block”/“You can use a forever block” is not as clear to a child as the direct instruction “Add a forever block”.

Explain where to add code – One of the most common sources of confusion for learners is being asked to add some code to their program but not knowing where to add it. Be very clear about where new code should go (“add this code as the first line of the blah() function”), or use a screenshot with line numbers or an arrow, for example:

Add the code to import the random library here:

 

 

 

 

Allow play and experimentation – The end goal of a tutorial or workshop is not to recreate the exact program you envisaged when coming up with the workshop. The end goal is that the learner learns something and has fun doing it! Try to plan for this in your task by allowing them to personalise the task (“Add your own page title between the <title> and </title> tags”/ “Choose a sprite to represent your player”). Does it really matter if their maze game character is a floating piece of cheese rather than Pacman?

Explain why – If you’re asking the learner to copy out some code, explain why. Compare the following approaches:

Add this code:

 

This line of code will open the file a_file.txt in read mode (r) so that you can see what’s inside it. Add the code at the end of your program.

 

 

Not too much too fast – I’ve seen resources for kids that start off by explaining variables, selection, two kinds of loops and functions within the first two paragraphs, and then expect them to be used fluently throughout the rest of the tutorial. It’s not going to happen. Don’t assume that because you explained something once it was understood.

One does not simply – Avoid using phrases which trivialise the instruction (“Simply add a function to invert the wobblybobble”/“It’s easy to add some code to jiggle the flimflam”). It might be easy or simple for you, but for the learner it might seem extremely tough, and there’s no reason to make them feel bad unnecessarily.

Choose your words wisely – The Wikipedia definition of a variable is “A storage location paired with an associated symbolic name (an identifier), which contains some known or unknown quantity of information referred to as a value.” I’ve seen definitions along those lines in resources intended for kids. You need to simplify a concept as appropriate for the age group, for example you might say “You can store data inside a variable, and each variable has a name”. Also think carefully about throwaway words you use – it’s unlikely that most kids will understand words like API, native, REPL, mutable etc. or be able to infer their meaning from context.

Think about their background – Younger kids type reeeeeally slooowly. Think about how much typing there is for them to do, and how frustrating it might be. Can you reduce unnecessary typing by providing some starter code? If you’re using concepts from maths or other areas, think about when these are introduced in school. For example, kids start learning about coordinates in Year 5 (age 9-ish) so younger children might not cope if your workshop assumes they know what a coordinate is.

Remove the stabilisers – Once your learner reaches the end of your tutorial, is there an open ended task for them to do to build on what they’ve done so far? If there is, it will reap dividends for you as it keeps the learner gainfully occupied whilst you help slower workers, lets them have fun experimenting and will be the acid test of whether they understood what they just did or just copied out your code!

Leave a comment with your own top tips! 🙂

Advertisements

gui zero – making Python GUIs really simple

The code in this post has been updated to reflect the changes in guizero version 0.4.

When I was a teacher, I found it frustrating that it was not at all easy for students to create GUIs using Python. I used tkinter a little bit with my GCSE class and they instantly loved creating GUIs, but became frustrated because simple things were so difficult to do. After talking with some developers about this at Pycon UK, I decided to do something about it, and so I wrote a library called guizero which is meant to be used by children and removes all the unnecessary nasty bits without removing the intellectual requirements. Another thing which is important to me is that guizero is very easy to install and get started with – so there’s a completely no faff installation process, which is a winner if you’re struggling with getting your school techies to install things.

Download guizero and read the documentation here

But, promo flannel aside – is it any good for use in the classroom? On the CAS resources site, Stuart Lucas posted a popular “Book of programming challenges” resource (9651 downloads at the time of writing) so I thought I’d put guizero to the test to see how easy it is to complete a few of his challenges with a GUI and let you see for yourself.

Challenge 1

Write a program that will display a joke. Don’t display the punchline until the reader hits the enter key.
Extension: display the punchline in a different colour.

from guizero import App, Text, PushButton

# Method to call when button pressed
def display_joke():
   punchline.value = "Poke him on"
   
# Set up the app
app = App("Joke teller")

joke = Text(app, "How do you get Pikachu on a bus?")
punchline = Text(app, text="", color="red")
button = PushButton(app, display_joke, text="Display punchline")

app.display()

challenge1

So this was pretty straightforward. I created two pieces of text and a button, with the second piece of text remaining blank until the button is pressed, at which point it fills in the punchline.

Challenge 2

Write a program that will ask you your name. It will then display ‘Hello Name’ where ‘Name’ is the name you have entered.

from guizero import App, Text, TextBox, PushButton

# Method to display the greeting
def display_greeting():
   text.value = "Hello " + name.value

# Set up the app
app = App("Hello machine")

text = Text(app, text="What is your name?")
name = TextBox(app)
button = PushButton(app, display_greeting, text="Greet me")

app.display()

challenge2a challenge2b

This challenge makes use of the get() and set() methods of the Text and TextBox widgets to easily get values typed in and display them elsewhere on the page.

Challenge 3

Write a program to work out the area of a rectangle. Collect the width and height of the rectangle from the keyboard. Calculate the area and display the result.

Extension: Display the volume of a cuboid. See what happens when you don’t type in numbers! Try to explain what has happened and why.

from guizero import App, Text, TextBox, PushButton, error

# Method to calculate the area
def calculate():

    # Validation to check whether they typed in numbers
    if not height.value.isdigit() or not width.value.isdigit():
        error("Input error", "You must type in numbers for height and width")
    # Depth is allowed to be a digit or blank
    elif not depth.value.isdigit() and depth.value != "":
        error("Input error", "You must type in a number for depth")

    # Perform the calculation
    else:
        area = int( height.value ) * int( width.value )
        if depth.value == "":        
            result.value = str(area) + "cm squared"
        else:
            volume = area * int(depth.value)
            result.value = str(volume) + "cm cubed"
        

# Set up the app
app = App("Area and Volume calculator", layout="grid")

width_label = Text(app, text="Width:", grid=[0,0], align="left")
width = TextBox(app, grid=[1,0], align="left", width=30)

height_label = Text(app, text="Height:", grid=[0,1], align="left")
height = TextBox(app, grid=[1,1], align="left", width=30)

depth_label = Text(app, text="Depth:", grid=[0,2], align="left")
depth = TextBox(app, grid=[1,2], align="left", width=30)

button = PushButton(app, calculate, text="Calculate", grid=[1,3])

result_label = Text(app, text="Result:", grid=[0,4], align="left")
result = TextBox(app, grid=[1,4], align="left", width=30)

app.display()

challenge3a challenge3b challenge3c

This challenge was a little tricker. I used a grid layout so make the interface look tidy and line up the boxes properly. However, it wasn’t the GUI part which generated most of the code here, it was the validation. Since the get() methods always return strings I had to cast them to integers to do calculations (but this should already be familiar to students). I also saw a good excuse to use the error() box function to pop up a message if the validation check didn’t pass.

What do you think?

I’d love to hear your thoughts on guizero – whether they are positive or negative. Is this useful for you and your students? Is there something you’d like it to do but it doesn’t currently do? Would you like to see a tutorial on how to do a particular thing? Is there a bug? You can find the project on GitHub and add issues/ideas here, or leave a comment on this post, or tweet me @codeboom with your thoughts.

Exciting adventures at Pycon UK

Having missed out on the previous n years and had to endure extreme jealousy caused by the exciting tweets, I decided that this was going to be the year I finally went to Pycon. I had heard that there was an education track and that this was the way to meet real live developers! I have never been to a conference before, so all expectations I had for what would happen were entirely based on my attendance at *cough* Anime conventions long long ago. Sadly there was no one dressed up as a Python and a distinct lack of people speaking questionable Japanese, but the following awesome things did happen:

– Everyone was super friendly! Without exception, everyone I spoke to was really positive, warm and welcoming:  the people who helped me in the slack, the organisers in every aspect, especially setting up the AV stuff for my talk, the hilarious waiter at the conference dinner and the people who said hi to me because they’d met me in a previous session.

– There were loads of women! I didn’t realise there was a Django Girls stall on Friday otherwise I would have gone to say hello to them, but in general just looking around there were far more women than I expected to see, which made me forget all about whether it would be weird to be female at a tech conference. Just like in real life™ it wasn’t, no one cared. Bov. Good.

– I got in a queue which I thought was for coffee, only to find out it was to be given a FREE MICROBIT. Seriously this is the best thing to find out when you get to the end of an enormous queue. And, double bonus, there was coffee as well somewhere else!

– Real developers wanted to help ME. Well, US – teachers of the UK, there is goodwill out there. There are lovely people who don’t laugh when you tell them you can’t get on with Tkinter and instead ask how they can make using GUIs better. They didn’t have to do that, they could have been in one of the many other talks which were probably more relevant to their own interests, but instead they chose to spend their valuable time coming to see how they could make education better. Thank you.

– There was free water, and lots of it. This was great, thank you. If I’m allowed one moan, it would be that it would have been nice to have some water available during my talk because by the end my throat felt like I’d just played chubby bunnies with a packet of Ryvita.

– There were loads of loos. I know this is really silly but queueing for ages for the loo at an event is really annoying. Plus, if you give out lots of free water then needing loos is a logical consequence. I’m going to stop talking about loos.

Carrie Anne talking about farts to parents. I’m not joking, capturing parents of kids on the kids track and bundling them off for a talk about digital making, that’s pure genius. Well played.

– My talk! I loved giving a talk, and people actually came to it and listened to it and tweeted about it. YAY. If you’re considering doing a talk, but don’t know if you should do a talk, you should do a talk. Totally.

So, I would highly recommend to teachers that next year you look up PyconUK and try to go on the teachers’ day (this year it was Friday) – they even offer you a bursary of £200 towards supply cover so there is really no excuse for school not to let you out.

I can’t believe I’ve got through a whole post without a rant. OK here’s a rant… I WAS A SPEAKER AND MY BADGE WASN’T BLUE. GAHHH. STUPID PYCON.
(Regular readers will know that this is of course a joke – most of my other blog posts are highly opinionated!)

Oh, and no one laughed at my Overwatch joke. *shakes fist*

 

Cat Cat Code Ltd

So here it is! I’m taking the plunge as of September and starting my own business – Cat Cat Code Ltd.

I’ve put up a blog post with some tips on teaching HTML and CSS on the site so please do pop over and have a look. If you know of someone who could benefit from some Computer Science expertise then I’d be extremely grateful if you would send them my way. I’m also not currently booked for BETT so I’m available for work there.

PS Fear not, this blog is not going to descend into a relentless spam of advertising, I just thought I’d give you a heads up and now it’s back to business as usual!

 

Exciting news!

I’m excited to announce that as of September I will be starting an education consultancy business and will be available to hire for training, speaking, advice and other awesome Comp. Sci. related activities.

When it comes to big changes, I don’t do them by halves. Since June this year I have got married, moved house, quit my job and decided to start my own business! Gulp. I decided to make this change because I really enjoyed the variety of the different things I did alongside my day job for the last few years. Having run training courses as a CAS Master Teacher I was delighted that people genuinely seemed enthused and happy with the delivery and the content of what I had taught them. As a teacher there’s nothing worse than going to a badly delivered training course, and with time being a very precious commodity my focus is always on getting the most use out of the short time available, matching the requirements of the people who are there.

I am also extremely pleased to announce that I will also be speaking at Pycon UK 2016, as a follow up to my blog post about the accessibility of educational software for teachers and schools. I have loved giving the various talks I have been invited to share in the past and public speaking is an area where I would certainly like to do more. Hopefully I will also be able to meet some interesting people – the Python in education mailing list has certainly impressed me with the willingness to listen and share from many talented developers.

I would really like to work on a variety of projects, so if you’re interested in working with me then please drop me a line. I haven’t yet launched my business website or contact methods so for the time being you can still reach me either on Twitter @codeboom or via email at codergoesforth@gmail.com – but you’ll be able to see my proper portfolio very soon! 🙂 I also realise that many people who comment on this blog are highly experienced and may have good advice to offer (and indeed some have already helped), so I would welcome your support.

Looking forward to developing this business over the coming year – it’s very weird to think I won’t be going back to school in September!

Scratch is the new Powerpoint

I keep hearing the phrase “Scratch is becoming the new Powerpoint” – teachers all over the country (nay, the world) are using the same programming teaching tool to teach with. So why is it that in a world with so many free tools for teaching kids to code, everyone seems to be using the same one?

I have a reason. Because the excessively complex installation process or the dreadful user interface of most of the other tools renders them completely unusable in education.

So it turns out that there are a lot of benevolent developers out there who really want to help improve the standard of CS education in our schools. They spend time building tools with kids in mind and then release them open source. I really appreciate that people do this – there’s some fantastic software out there (e.g. Sonic Pi) which is aimed at kids, free and frankly awesome. However, there’s also a lot of software which could be awesome but is missing something. Here are my top 3 peeves:

  1. If the website for your tool holds a thinly veiled contempt for Windows users (or no Windows installers), it’s unlikely it will ever see the light of day in education. Regardless of the pros, cons, rights and wrongs of the issue, the vast majority of schools run Windows networks and turning that juggernaut around ain’t going to happen overnight.
  2. OK so your software looks interesting, I decide to test it at home to see if it’s any good. If it takes me more than half an hour to install your product on my home computer because I have to work out which installer to get, install a dependent library, edit a config file and then perform 20 star jumps while turning the lights on and off in time to “Spice Up Your Life”, imagine how much I’ll be looking forward to asking the technicians to install it on the school network.
  3. I finally got the software installed, so I head to the “newbie tutorial”. Here’s something I learned – a lot of software creators have NO FREAKING CLUE what a newbie tutorial is. When I’m new to something, I want you to show me how to get started in a really basic way. Pygame, I’m looking at you here as an inexcusable offender. The top of the Pygame “learn” page has the sentence

“The PYGAME Documentation page has a number of tutorials.
A Newbie Guide to pygame is very good.”

Go on, click the newbie guide link, I dare you.

PSYCH! IT’S NOT A NEWBIE GUIDE! It’s not even a guide! It’s not remotely in the least bit helpful to an intelligent person who knows Python but who has just downloaded this library in the hope that it might be interesting to look at with A Level Comp Sci’s. (I’m asking for a friend *cough*) It even says (paraphrased) in the guide “if you get stuck, don’t ask anyone for help – spend hours trying to solve the problem yourself”. Wooooowww, such welcoming, many warmth. With introductions this good, is it any surprise hardly anyone uses Pygame in education when it looks like it has SO MUCH potential? (I hear there is now Pygame Zero but I found that similarly mystifying…what the hell is this pip of which you speak so casually?)

I guess what I really want to say is, if you’re making some software to help kids learn – THANK YOU. However, your software isn’t going to get the attention it probably deserves if things like the interface and the installation process are a bodged after thought. People just won’t bother to install it. Don’t confuse “I learnt how to do this a long time ago” with “this is trivial” when it comes to the installation procedure, and don’t think that people will be so blown away with your awesome backend implementation that they’ll forget Windows 3 called and wants its interface back.

Computing – the cake is a lie

I’m nearly at the end of my first time round teaching GCSE Computing and something has been bothering me. I decided to leave the topic of networking until the end, because I think it’s one of the hardest and also because I thought it would be beneficial to do it in Year 11 when my students are at their most knowledgeable. So I am teaching such objectives as:

“f) explain the terms IP addressing, MAC addressing, packet and protocols”

Eh? That’s quite a big ask really, isn’t it. My Year 11 group are as sharp as a hedgehog carrying a bag of knives to a cactus convention, so when I offer my GCSE level definitions with a casual “this is the stuff you need to know for the exam” I get questions along the lines of:

  • Why does a computer on a LAN need a MAC address and an IP address?
  • If packets are addressed to and from an IP address, how does that work when IP addresses are allocated dynamically?
  • Is it possible for someone with malicious intentions to create two pieces of hardware with the same MAC address? or to ‘steal’ your MAC address?
  • If a web server has an IP address which is looked up via DNS, how is it possible to host multiple websites on the same server with different domain names?

Now if you read the textbook, it just glosses over all of these things, which is sort of fair enough because a GCSE textbook isn’t meant to be a comprehensive tome on networking. I’m also not saying that I either don’t already know the answer or am lacking the ability to look up the answer to these things. The point I’m making is not that I need some help googling this stuff – stand down industry, I’ve turned off the bat signal. I’m stuck in a hideous choose your own adventure game where you can’t cheat and turn ahead. Do I…

a) Say “that’s not on the spec, don’t worry about that”
(crushing the student’s natural curiosity and undermining their confidence in me)

b) Say “I don’t know but I think it’s probably because of x…”
(fudge over the details until they get bored, not something I enjoy doing to my students, and something they HATE)

c) Tell the student the real answer
(and in the process waste lesson time on something that isn’t going to come up in the exam, confusing some students and opening up all sorts of other “but why is THAT” time sink questions)

No option is acceptable. It’s like when I did GCSE Biology and then I found out afterwards that everything I had learnt was actually a vastly simplified version of reality. And the cake being a lie doesn’t stop at GCSE – it’s all over A-Level as well. Computer architecture and processor design? A lie. Compilers? Lies. Networking? Still fib-a-licious. I really hope Professor Davenport doesn’t show up and say that everything in Uni networking lectures was a lie too otherwise I might cry.

So what do YOU do about this?

 

Image from http://cdn.meme.am/instances/250×250/59745067.jpg