Killing the crab

For anyone who isn’t in the loop, I’m currently in my final week of radiotherapy for breast cancer, having followed the loooongest treatment path which began on 11th November (I like to start things with a bang so my first chemo resulted in instant anaphylaxis which was about as fun as it sounds). I thought I’d note down my thoughts at this point, largely because my throat is so sore I need a distraction, but perhaps also because someone might find it interesting or useful!

Shortly after this photo I met my alter ego, Anna Phylaxis

Don’t get cancer.

No really, I know no one wants to get cancer but if you can do anything at all to avoid it (eat healthily, exercise, don’t smoke, you know, all that stuff) then do it. You REALLY don’t want this, it is less fun than being on hold with HMRC. The weirdest thing about it for me is that, other than a lump, I never had any symptoms at all. I didn’t feel ill or tired, in fact the only things that have made me feel ill or tired are the treatments!

One of my prevailing thoughts throughout this process has been…how lucky am I to be living right now with all the stuff they can do to treat this.

Over the past 10 months I have had MRI scans, mammograms, about a thousand biopsies (OK this is a wild exaggeration but it was a lot), CT scans, a PET/CT scan (this one involves being injected with radioactive glucose), four different chemo drugs plus a huge pile of steroids and antiemetics, several ECGs, two x-rays, a mastectomy (including a drain and a pressure dressing), multiple aspirations and radiotherapy. Some clever medics and scientists had to invent all this stuff, and also some poor person had to be the first to say “yes, you may indeed inject me with vile red liquid that looks like corona cherryade and let’s hope it works”.

This is an iron infusion, not IV Guinness unfortunately

I’ve participated in two clinical trials and several masters research project questionnaires during this time because I think it is extremely important to help with research if you are in a position to do so. I also kind of wish I had known a bit more about medical careers involving Physics when I was at school. Radiation is cool. And dangerous. If you want to help support cancer research financially, you can donate on my page here.

Something which people often say is something like “your fight against cancer is an inspiration”. Don’t get me wrong, I know that anyone who says this means well and I am grateful for that. But there are two flaws in this statement. Firstly, you don’t fight cancer. Do you fight a broken leg or battle a heart attack? I don’t remember beating up an earache. Cancer is basically where your own cells get f-ed up and start a riot, and then ignore your body’s own mechanisms for telling them to sit down and shut up. It’s not a malevolent force here to get you. It’s a disease, just like any other, and talking about it like it’s some max level elite bad guy doesn’t really help because people are going to get it (the lifetime risk is 1 in 2, sorry), and all this kind of talk achieves is to scare the poop out of you.

Mrs Potato Head

Secondly, the inspiration part. What people actually mean by this is “thank F it isn’t me having to do this” but that’s not really a thing you can respectfully say to a person with cancer. I’m not an inspiration, I’m just doing what anyone would do given the circumstances. If you’re faced with a choice of “have 10 months of awful treatment” or “lay down and die” there isn’t really much of a choice, is there? Might as well shut up and get on with it.

On the other hand, the actual inspirational people are the people who deal with this stuff on a daily basis – the oncologists, surgeons, radiographers, nurses, doctors, healthcare assistants, even the hospital porters are ace. I can remember thinking at the start of my treatment how depressing it would be to have to work with cancer patients all day. But it turns out that cancer patients are just regular people with hats on. Never during my treatment did I feel like I had metamorphosed into some special category of ‘cancer patient’, I was just me except in the mirror I looked weirdly like a potato.

Hair now getting to the Beavis and Butthead stage

I am also in awe of the inventors of things like the MRI scanner (this guy, who apparently only died a few days ago). You can’t fail to walk into a room with a gigantic piece of machinery like this and be impressed. I have definitely not had enough of experts, sorry Michael. Experts are awesome.

Anyway, let’s hope that it’s time to wave tatty-bye to cancer, and as Yazz from the 80’s would say – the only way is up!

Am I a woman in tech now?

Today is a good day because it is the day that I finally achieved a life goal and had a book published! Together with Martin O’Hanlon, I wrote a series of fun projects based on guizero for beginners. I’m also particularly excited that book also has loads of awesome colourful illustrations by Sam Alder.

Holding a paper copy of a book I have written has been my goal for a long time. I actually did write a book in 2015 but despite it taking an inordinate amount of effort to write, it was only ever published electronically and I am not sure that many people have ever read it. However, thanks to Raspberry Pi Press and encouragement from Carrie Anne to add it as a ‘personal goal’ at work, it is done!

The title of this blog post might seem to have little relevance to a book, but for me it has everything to do with it. I have a very uneasy relationship with ‘women in tech’. When I was a teacher, I thought no one would recognise me as a ‘woman in tech’ because I was “just a teacher*”. So I stopped being a teacher, and then I thought that no one would take me seriously as I hadn’t written any software. So I wrote a Python package called guizero which gets about 100 downloads a day, and then I thought maybe people would take me seriously if I had a book published. And now…well, you get the point.

I know that the aim of most initiatives to highlight ‘women in tech’ is to be inspirational and to encourage other women to join the field. I applaud all attempts to improve diversity in tech (hell, I’ve led some of them myself!) However, I’ve realised that for me, ‘women in tech’ initiatives have meant I have just spent the past eight years wondering why I don’t count yet as a ‘woman in tech’ and what I need to do to be recognised. Every time a list of women in tech came out, I went through a cycle of feeling upset that I hadn’t been nominated, followed by the “who the hell do you think you are and why would anyone think to nominate YOU” self-talk, to “OK I’m going to psych myself up and do something else so that I might be considered next time”. It’s exhausting.

Me, being an idiot as usual

I guess this bit is where I’m supposed to loftily proclaim that I have learned much from this whole process and I’m now an all round better person. However, like most people, I’m a flawed human being. I’ll still worry about whether I ‘count’ as a woman in tech. I’ll still probably be sad about some random list I shouldn’t care about. But at least now I can say I’ve written a real book, with pictures and everything, and there’s a new tick on my bucket list 🙂

* Being ‘just a teacher’ is a good thing, but no one talks nicely to themself in their inner monologue, including me.

Do you want to run a workshop?

Following on from the post I made a while back about writing resources, I thought a post about things to consider when running a workshop for beginner coders might be handy too. This post is primarily aimed at those lovely people who have no training in education but who give up their time to teach other people how to code.

Preparation

It might seem obvious, but you need to prepare some things in advance to make sure your workshop runs smoothly.

Before you even start writing your workshop, think about the name of the workshop. I often see workshops for kids with titles like “Control a HC-SRO4 in Python”. You might know why this is cool, but why would a 7 year old want to do this? Do the same workshop but call it “See like a bat”, add a bit of fluffy story about bats and you’re on to a winner. Never underestimate the power of the fluffy bits. (This also works with adults!)

When you plan a workshop for beginner coders, I would always recommend that you do the task in advance using your own instructions – and even better, get someone else to do it too. No shortcuts – follow your instructions to the letter. It is amazing how many mistakes you can filter out this way. As a teacher, on a couple of occasions I set programming tasks to students which turned out to be INCREDIBLY hard, but I hadn’t done the full task myself so I had failed to spot the problem.

When you test your workshop, make a note of how long it takes you to do the task. I once ran a workshop for Year 4 girls which involved making a badge by sewing an Arduino GEMMA and two LEDs onto some felt, then programming the lights to flash. I practiced the workshop myself, noted down how long it took and decided that 3x the time it took me was fine for the age group. It wasn’t fine – in fact it was probably the worst workshop I’ve ever run, because I failed to take something crucial into account. Almost all of the girls that young had no experience of sewing a basic running stitch. I wasn’t teaching a sewing workshop, but I did assume they could sew. The moral of the story is that you should mentally scan your workshop plan for assumptions that may be completely unrelated to what you are trying to teach, and then check your assumptions are in fact correct.

I ran the workshop again with Sixth Formers and it went much more smoothly 😀

This might sound like an odd thing to think about, but plan the questions you will ask, and also think about what participants will ask and when. Having an answer for a logical question ready at the right time is much nicer than shutting down inquisitive participants with “we’ll get to that later”.

On the day

If your workshop involves copying code, think about how the participants will do this. If you want them all to copy from a projected slide, is the font big enough to see? Are there any seating positions with a poor view? Have you considered colour blind participants? This strategy also forces everyone to move at the pace of the slowest person which might cause frustration, and makes it harder to fix typing errors once the slide has moved on. In general, I much prefer a handout or an online document participants can access at their own pace. (See also “Don’t make them type the hard stuff” in my resources post.)

Open the necessary files you need on your laptop before the workshop starts. Watching the presenter navigate their desktop (whilst craning their neck awkwardly because of the angle the laptop is attached to the projector) is not a fun workshop experience.

When you begin the workshop, take a few minutes to define some rules with the group. Usually you will be running the workshop in a fun setting so it’s not supposed to be like school, BUT as a participant there is nothing worse than people talking over or interrupting a workshop when you’re trying to listen. With adults you can usually skip this step, but on occasion it might become necessary to raise the subject. It’s a bit cringe having to do it but people will thank you – I remember one stressful Picademy where we were in a particularly small and hot room and I had to remind some participants not to talk over the session 😦

Within this, decide on a way of getting people’s attention so that you can transition smoothly from bits where you talk to bits where they code. Most kids will be familiar with a raised hand – this means everyone in the room raises a hand and waits, and eventually your signal for attention filters around the room without you even having to say a word. Nothing more stressful than trying shout over a noisy and enthusiastic room “um…uh…could you just listen a second please?”.

Think about the language you use and the way you present tasks. My workshop motto is “One does not simply” – don’t proclaim anything to be simple, and don’t skip over things you think are too basic to cover. There are also small nuances in the way you check understanding – it is much better to ask “Is anyone confused?” after your explanation than “Does everyone understand?” or you’ll end up with a response like this joke:

Three Computer Scientists walk into a bar. The barman asks “Do you all want a drink?”. The first Computer Scientist says “I don’t know”. The second Computer Scientist says “I don’t know”. The third Computer Scientist says “Yes”.

My last and final tip is probably the most important. Have a backup plan. This is a backup plan for better or for worse – the workshop might go stunningly well and you get through the content in half the time and need some more, or you might need to deal with an unexpected problem. You don’t need to have a fully inflated life raft waiting in the back, but you do need to have a rough idea of what a life raft looks like and know how you might Macgyver one up if the situation requires.

Good luck, you’ll be awesome!

One pseudocode to rule them all?

Well met, generous reader. It’s been a while.

As you can probably tell from the total lack of posts, I don’t have much free time. I now work four days a week, and then I work even harder the other three days, looking after my son. My free time is largely spent sleeping to survive, so time where I am both awake and not in charge of a toddler no longer exists. He’s the best thing ever, but having a child has unceremoniously shattered who I thought I was into a million pieces and I haven’t quite finished gluing them back together again yet. For the people who have encountered the jagged edges of this recently, I’m sorry. This is my attempt to claw back something that makes me “me”, and not just “someone’s mum”.

Reader: Oh Codeboom, it’s just you rambling on about life. We were afraid it was a blog post about something important. Yeah, you know like pseudocode – I just hear that word and I shudder.

Pseudocode

Reader: Oooooooh, do it again!

Over the last 9 months or so I have been spending an awful lot of time in dangerously close proximity to pseudocode (and earned the dubious title “Queen of pseudocode” – thanks Dave!) I’m talking specifically about pseudocode of the variety used in A level exams (post-16 for anyone not in the UK), although I’m sure everyone has their own special favourite variety. I should be very clear that I’m not aiming to pass judgement on pseudocode in any particular way in this post – I actually think it has both merits and flaws – but here are some of the things I have discovered.

What even is pseudocode?

Here’s a standard classroom conversation I have had so many times:

Teacher: In the exam, you can write in any pseudocode syntax you like, as long as it makes logical sense to the examiner.

Student: What, so we can just write anything?

Teacher: Well no, you have to make sure it’s sufficiently structured as pseudocode.

Student: OK so what’s the syntax we need to follow then?

Teacher: Well you can use any syntax as long as the structure makes logical sense.

Student: Um, what? I’m just going to write in Python.

Students need a computer science Simon Cowell in their head giving a big red X and “it’s a no from me” to avoid writing things that won’t get accepted. However, here’s the scary bit no one tells beginners – YOU ARE SIMON COWELL. To be able to decide when your pseudocode is sufficiently structured to be proper pseudocode and not what I call “rest of the F-ing owl” code (obviously not to students!), you already have to know what you’re doing. But you’re using pseudocode to…learn what to do.

Why are there so many varieties of pseudocode?

I know, I just said that any syntax of pseudocode is acceptable as an answer in an exam. That doesn’t mean that the people who write the exam will write in any old syntax – they obviously have to standardise so that students will know what to expect. In fact, the pseudocode syntax for the AQA and OCR exam boards is completely and utterly different.

WHY?!

This seems to me like a giant waste of resources – if one teacher creates a programming resource with pseudocode and wants to share it with their teacher friend who teaches a different board, someone has to spend hours re-writing the code so that students are able to practice using the format they will see in the exam. AQA pseudocode also has the symbol for assignment, which as a non-standard character is somewhat antisocial for people producing home made resources.

How does pseudocode cope with implementation details?

If you’re only familiar with one programming language (perhaps Python), you may not have realised that it’s really hard to make one pseudocode that accurately models the implementation details of every language someone might opt to use for A level. Take this example, where the aim is to extract “NN” from the postcode string.

Here it is in OCR flavour pseudocode, where the arguments are the starting position and the number of characters wanted:

postcode = "LLNNLLL"
area = postcode.subString(2, 2)
print(area)

Here it is in AQA flavour pseudocode, where the arguments are the starting position, and the ending position (inclusive):

postcode ← "LLNNLLL"
area ← SUBSTRING(2, 3, postcode)
OUTPUT area

…and here it is in Python, where the slicing operator takes the starting position and the ending position (not inclusive):

postcode = "LLNNLLL"
area = postcode[2:4]
print(area)

This specific situation actually caused me to write a question for students in pseudocode where my own answer to the question was wrong. I appreciate that it’s really difficult to model every possible implementation decision of every language with an exam specification pseudocode, but it’s this kind of thing that gets some people very hot under the collar about what is ‘right’ and what is teaching bad habits.

So should there be one pseudocode to rule them all?

I don’t know. On the one hand, if there was a standardised pseudocode (and yes, I have heard of HAGGIS) then resources could be written by authors in that pseudocode and easily translated into lots of other ‘real’ programming languages. On the other hand, if there is a standardisation of syntax, is it even ‘pseudo’ any more? This post is already long enough and I haven’t even mentioned the pedagogical side of pseudocode vs other methods, but maybe that’s a post for another day. What do you think?

Today I went to a food bank

Today is my last day of maternity leave, and I am really looking forward to being back at work. I have joked on Twitter about spending a large proportion of my maternity leave in supermarkets, but it is in fact not really such a joke.

As sad as it may sound, supermarkets have been pretty good mat leave entertainment – free to walk around, lots to look at for a baby and you usually end up picking up a few bits and bobs you need as you walk around. Or at least it certainly appears that casually buying groceries is an activity open to middle class ladies on maternity leave. The more I went to supermarkets and “picked up bits and bobs”, the more I started to think, and some of these thoughts were uncomfortable. Every time I bought a few groceries on a jolly with my son, it reminded me that some families couldn’t even afford basic food and necessities. I have found maternity leave pretty hard going as it is due to a few injuries (which are now fixed, cheers NHS!), but I can’t comprehend what life must be like if you have to worry about where your next meal is coming from.

Another thing I’ve done a lot of on maternity leave is loiter around on Twitter. I noticed a few times people I followed had retweeted @BootstrapCook talking about food banks:

Food banks are not really something I had paid much attention to before, but reading these tweets really caused my thoughts to coalesce, so I decided to spend some time on my last day of maternity leave buying some food and donating it to a food bank. Off I popped this morning to Asda expecting to buy some tins of beans and packets of biscuits, but I certainly did not expect the feelings that accompanied the food. I had a budget in my head, and a self-scanning machine in my hand. I began scanning Smartprice tomatoes and I had about 8 tins in the trolley before I realised my shop so far had come to approximately £2. That was not even the price of a latte – so many of which I have consumed on maternity leave I have lost count. I felt overwhelmingly sad that in 2018 people probably just down the road from me are having such a hard time that they are relying on food banks for survival while I’m sitting in Waitrose having a latte.

My boot completely full of food

In the end I managed to fill up my ENTIRE BOOT with food for the budget I had in mind. I chose to buy Smartprice food for the most part because I wanted to get as much as possible.

You might say “why are you writing a blog about this, you just want praise/you just feel bad and want to make yourself feel better”. I think it’s almost impossible to do something completely selfless – I did get pleasure from going shopping for this food in the knowledge I would be helping someone. However there is nothing whatsoever “feel good” about handing in food to a food bank. It’s the harsh coal face of life, handing in your bags of donations to be weighed whilst in the next room people are waiting to receive their supplies to sustain themselves for the next 3 days. Why am I in this room and they are in that room? Luck.

Food sorted and waiting to go at the food bank

So really the point of writing this blog (and sorry, because it has nothing to do with my usual blogging topics) is largely to bring this to a tiny corner of your attention, just like Jack Monroe’s tweets wormed their way into a corner of mine. I challenge you to set yourself a budget you can afford and then go to the supermarket and pick up some food to donate. Look on the internet to find your local food bank and it will tell you which items they are in need of and which they have lots of in stock. This is a good list if you want some other suggestions, or you could donate money if you are short on time.

Bonjour, tout le monde!

Did I ever tell you about the time I taught Year 7 French? The Head called me into his office one summer and basically said that they didn’t have enough to fill my timetable and could I please teach a class of Year 7 French as there was no one else to do it. He added that he knew I’d got a GCSE in it, been to Paris on holiday and had noticed I usually had a baguette for lunch, so I would probably pick it up quite quickly. “Bonnet de douche!” I thought – having to teach a bit of French is better than getting made redundant, so I agreed.

I bought a text book and some online materials. Everybody I spoke to said not to worry as there was loads of stuff available online for learning French, and the kids would probably pick it up from watching Youtube videos in their spare time. The first lesson arrived and I was feeling pretty nervous, but we learnt how to say “Bonjour, tout le monde” and some basic vocabulary and ‘voila’ it seemed to be pretty straightforward! I was feeling good, the vocab was flowing and I was able to keep just ahead of the kids by looking at the next page of the text book when I did my planning.

Then after a while things got a bit difficult. There were tenses to learn and the kids had to get the right tense along with the right form of the verb, as well as knowing the vocabulary. To be honest, I didn’t feel very ‘creme de la menthe’ about whether what they had written was right or not, but I had to keep ploughing on. There was one kid in the class whose mum was French, so that kid basically acted as a second teacher, showing the other kids what to do and fielding the tricky questions I wasn’t sure about. I tried really hard to learn more French at home during the evenings but to be honest I was completely exhausted from the day’s work already and it was so hard to learn a new thing with no head space or training for myself.

The weeks passed and we muddled through. A couple of people laughed at me because I asked what they thought was a stupid question in an online forum for French teachers. ‘Pas de Calais’ I thought, I won’t bother asking for help again. I learnt a lot alongside the kids but it was hard work. Eventually the end of the year came around and the Head called me into his office again. ‘Mon dieu!’ I thought, it’s the guillotine for me! However, he actually said what a good job I’d done, made me Head of French and asked if I could teach GCSE and A-Level next year.

And if you think this story is ridiculous, replace French with Computer Science and shed a little tear for the teachers for whom this is a true story.

 

Women and wearables

Last week I found out I was included on a list entitled “Top 100 Women in Wearable and Consumer Tech“, collated by Women of Wearables (@Women_Wearables on Twitter). I first met Marija from WoW at the BETT show last year and she contacted me to have a chat and do an interview shortly after. I had spent a large proportion of BETT showing people how to make LED robot badges and I had also just been working on two wearable resources for kids, for the Raspberry Pi Foundation – here they are if you want to try them out!

Last summer I was lucky enough to be able to attend Constructing Modern Knowledge in Manchester, NH (USA) which is unlike any other event I’ve ever been to. They have an absolute treasure trove of fabulous kit, knowledgeable facilitators and keen and enthusiastic participants. Mix those together and you end up with teams of educators collaborating to create…whatever their imagination permits! Here’s my wearable make from CMK, a colour sensing glove:

If you’re ever lucky enough to get the opportunity to attend CMK, go for it! You’ll also get to meet Gary and Sylvia, authors of Invent to Learn who are super friendly and run the event with (a very American level of) passion! 🙂 I had a fantastic time.

This is just one side of one room containing the kit available at CMK
This is just one side of one room containing the kit available at CMK

Anyway,  I am super happy to finally be “on a list” – I see lists of “Women in Tech” all the time, and I always wonder what it takes to be included. There is my name next to some pretty awesome women, but I can’t help but feel that I must have just have been in the right place at the right time. My style is more hacking together tutorials for kids with a bit of dodgy sewing than, I dunno, Senior VP at Apple Retail(!) – #5 on the list!  So, I wanted to share some work from other women who have done equally cool and hacky things with wearables at the maker end this year, in the hope that maybe next time their names will be on a list somewhere too! 🙂

First up, Rachel (@konichiwakitty) who I have been avidly following on Twitter. I particularly love that she runs wearable workshops at various events, and don’t miss her fabulous LED headbands – especially the one with donuts that was featured on the Adafruit website!

Secondly, Lorraine (@LMcUnderwood) who has a whole array of makes and tutorials for wearables and other cool physical computing stuff. I particularly like her sound sensing hoodie – check it out! She manages to make my nemesis (powering large quantities of LEDs from a microcontroller) look like a breeze.

Thirdly, Tanya (@tanurai) who made a fabulous LED dress for her works do, and whose feed is constantly filled with inspirational quick makes and fun things she’s put together. She’s also interested in making digital making accessible to as many people as possible, which is a huge plus in my book.

Of course, there are probably tons more cool projects I’ve missed and women who have created awesome wearables over the past year. If you’ve created something you’re proud of or you’ve spotted some maker wearable coolness, leave a comment below. Let’s celebrate the digital making end of women and wearables!

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! 🙂

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*