K PRIDE: Tips for teaching programming so everyone can make progress

I was asked to deliver one of the National Centre for Computing Education’s bursary funded accelerator python courses at Fulford School this week and really enjoyed working with some great teachers who came along to learn and share their experiences.

I thought long and hard before the course about how to pull together all the mistakes I’ve made and the lessons I’ve learnt over the last decade of teaching Computing into some practical advice that can help make the teaching and learning of programming more accessible for learners of all abilities, interests and backgrounds.

K PRIDE is way of making the teaching and learning of programming accessible for all students that builds on the success of the PRIMM methodology.

K-PRIDE: Tips for teaching programming so everyone can make progress

I really admire Sue Sentance’s research and work on how to structure the teaching and learning of programming in a classroom environment.

Her PRIMM methodology has been really influential in making programming lessons more accessible and enjoyable. Programming can be both rewarding and creative but it’s definitely not an easy thing to learn.

There are so many mistakes we can make as teachers which can make learning to write, understand and debug programs frustrating for our students so I’m really grateful to Sue and others for addressing this and coming up with practical tips to make sure no student needs to feel left behind.

PRIMM methodology

Sue’s research shows that structuring teaching and learning using the PRIMM model can help support students who’d otherwise struggle as well as stretching students who make more rapid progress.

You can read more about PRIMM here.

I’d like to suggest that there are two additional but essential things that can build on the success of PRIMM in order to help make computing lessons more accessible and effective for helping students understand core programming concepts.

It’s hard to ready any programming resources without coming across a barrage of tier 3 (specialised) vocabulary which can act as an impenetrable barrier to students who just don’t understand either what they’ve been asked to do or how to ask for help.

The K of K PRIDE stands for keywords so that teachers are encouraged to explicitly teach key terminology so that students are empowered to talk about, understand and ask for support their programming learning journey.

Going through a glossary of key terms for a particular programming skill empowers them to be able to articulate what they want to achieve, search for how to solve the problems they’ll inevitably encounter and will help enable teachers and students to accurately discuss what their programs are actually doing at each stage of development.

Referring back to keywords and definitions after teaching programming concepts helps students identify and cope with the same terminology when they encounter it in reference, revision or assessment material.

Keywords

The PRI of K PRIDE are borrowed from PRIMM: Predict, Run and Investigate which are types of activity which gradually but actively build up students’ confidence understanding and experimenting with code.

The other new aspect of K PRIDE is D for Debugging. This is the part of learning to program which can be most infuriating for new beginners.

The temptation for teachers with limited curriculum time available is just to show students ‘how to do it right’. However, If students are only ever given code that works, they miss out on the opportunity to build up the confidence, experience and resilience they need to cope when their own code doesn’t work first time.

Debug

Deliberately creating opportunities for students to practice fixing common mistakes means that they can learn to interpret error messages independently and also provides a really valuable opportunity for discussing why certain common errors occur and how to avoid them.

Being able to find and fix errors in code can be very satisfying and a great way of remembering and understanding how code works.

The E of K PRIDE merges the Modify and Make aspect of PRIMM into Extend. I think it’s really important to give students a choice of how to apply their knowledge, skills and understanding with clearly defined but open ended challenges.

This allows students to feel a sense of ownership and pride in their work as they refer back to all of the support and scaffolding of the resources they’ve encountered so far (Keywords and definitions, Predict / Run outcome, Investigation conclusions and Debugging results) to Extend a code template or write their own related project.

Extend

It’s important that some of these activities are sufficiently challenging to stretch the most able students but it’s equally important to make sure that less confident students can choose at least one activity which they’ll also be able to find achievable.

Tips for differentiating programming challenges for less confident students:

1) Provide a small amount of code that can act as a starting point. Starting from scratch can be very intimidating until you’ve build up the necessary experience and confidence.

2) Provide a limited number of instructions (I’d recommend 3-5) as comments as part of the template code you provide. Make sure you only use specialist terminology if you’ve already covered it as one of your keywords. Ideally the challenges will be written in order of difficulty starting with the easiest.

3) Keep your examples brief and use whitespace (empty lines) to break up your code into ‘logical paragraphs’. Dyslexic students particularly find large blocks of code very difficult to process.

4) Use a suitable IDE. Many schools use IDLE because it comes bundled with most flavours of Python. I’d recommend Thonny or Mu because both show the line number next to each line of code which I think is essential for effective dialog between teacher and student. Thonny also does a great job of making suggestions on how to fix common error messages.

5) Carefully consider any assumed knowledge from other topics or subjects. Links to maths, science, geography or music can be a great way to motivate and engage some students, programming challenges that rely on those concepts can be significant barriers for other students. Equally, if your current topic is just about input and output, don’t expect students to write a program that requires a knowledge of iteration or functions/procedures unless you’ve already covered that. By all means use those cross topic / subject links to stretch some students but make sure you’ve got at least one Extend activity that is purely related to the concepts you’re trying to teach in that lesson.

For more details about each step of K PRIDE along with some example resources, download this overview and workbook:

I know how challenging it can be as a teacher to structure our programming lessons to enable every student to enjoy making progress. I don’t have all the answers but I’ve made enough mistakes to hope that this is useful. Let me know what you think and how you get on!

Create games with python: online PyGameZero simulator

I’ve been really impressed with @lordmauve’s PyGameZero module that makes it fun and easy to create games with Python.

This post contains three example python games that you can edit and play online as a showcase of growing PyGameZero support for create.withcode.uk.

Create games with python: Flappy Bird with PyGameZero
Flappy Bird made with PyGameZero

Many students love creating and playing games and most of them have made some really creative animations and projects using Scratch’s graphical programming tools.

One of the big challenges for students is to make the transition from graphical block based programming to text based programming.

It’s harder to make mistakes with blocks but it can also be frustratingly slow if you want to make more advanced projects.

One thing that really helps is creating visual projects rather than just messing with text and numbers, although this often adds extra layers of complexity and confusion.

PyGame allows you to create games with python but can be intimidating for beginners

PyGame is a really powerful python module for creating games but it’s not ideal for beginner programmers as there are all sorts of things you have to understand and write before you can get anything worthwhile up and running.

PyGameZero keeps the fun and features of PyGame but makes it much simpler for beginners

PyGameZero is a fabulous module which is an abstraction of PyGame to make it simpler to create games and animations with code.

Abstraction means removing necessary detail in order to focus on the most important things.

PyGame is very powerful and feature rich but complex to use. PyGameZero is a simplified version that is ideal for creating working games with minimal code

I’ve been working through some of the great PyGameZero examples online and thought it’d be really good if students could try the code out online without having to download anything.

So, I’m working on PyGameZero support for create.withcode.uk so that students and teachers can write, run, debug and share python games online on any device.

It’s a work in progress, which means that there are some features that don’t quite work as they should yet but it’s at the stage where it works enough for you to be able to create games with python on chromebooks / laptops / desktops / tablets.

The next page has a python Space Invaders game that you can adapt and run in your browser.

Online python tkinter simulator: 3 games to help you create python GUIs

I made create.withcode.uk to let teachers and students write, run, debug and share python code online a few years ago in order to try to make it easier for students to experiment with code on any device.

Because create.withcode.uk runs python code in your web browser, you don’t need to install any software or download the code before you run it. You just press Ctrl + Enter to run the whole code, or Ctrl + Space to run it line by line.

This makes it much easier to try out code, tweak it and share it as you’re learning, but it’s only a simulation Python: it doesn’t contain all of the features of Python 3 running offline.

One feature that teachers and students have often requested is Tkinter support.

Tkinter is the GUI (Graphical User Interface) module that comes bundled with python. It lets you create programs that have buttons, text boxes and windows rather than just a text console.

I’m in the process of adding some Tkinter support for create.withcode.uk. It’s a work in progress but I’ve implemented enough for you to get some simple GUI programs working.

There are some great website for running python code online such as trinket.io and repl.it. As far as I know, create.withcode.uk is the only one to have an online python tkinter simulator so that you can test out code to build GUIs in your browser.

Here are some of the programs I’ve been using to test out python tkinter GUI support on create.withcode.uk:

Snake game: Online python tkinter simulator
Game 1: Snake in python tkinter
Bounce game: Online python tkinter simulator
Game 2: Bounce in tkinter
Colour Quiz: Online python tkinter simulator
Game 3: Colour Quiz in tkinter

Note:

These games are examples I’m using to test tkinter support on create.withcode.uk. I didn’t write them: the original authors are credited for each game in the source code and description. Please get in touch if you created these and want me to change the way I’ve attributed your work.

Tkinter isn’t really designed for making games – it’s useful for simple GUIs but there are better python modules out there for creating games (such as pygame). You can find some great books and resources here if you’re interested: https://inventwithpython.com/

Tkinter is a huge module so there’s no way I can simulate it all accurately in a web browser but if you have some code that works offline in ‘proper’ python that doesn’t yet work properly on create.withcode.uk, please share a link to it as a comment on this page and I can use it to help add more features and support.

Have fun!