The best way to teach text-based programming?

If you had been challenged to develop a rock, paper, scissors game using a text-based programming language in less than 10 minutes starting from a blank screen – how far would you succeed? Next question – what would be the best way to teach the necessary concepts to a class of 15 year olds?

If you had an additional hour available to build this game, how many of the following features could you add:

  • a means of checking whether the computer or player won in each round?
  • a scoring facility that kept track of computer and player’s scores?
  • a variety of message responses from the computer telling the player they had won or lost?
  • a means to store all the results in a separate datafile?
  • a bias which meant that the computer had an unfair chance of beating the player?

These programming challenges formed the basis of a workshop I led with teachers in Norfolk on Monday this week. I’ll explain why we were doing this and how successful they were with links to their solutions below.

Learning text-based programming at an Exa Foundation Roadshow

Since September I’ve been visiting schools around England who invite me in to host the Exa Foundation Roadshow. The roadshow is my latest endeavour to support the teaching of Computing in schools targeting locations most in need of support. These events have proved popular for a variety of reasons; they’re offered free to teachers, they’re presented in small bites lasting 2-3 hours each so they can attend for part of a day rather than a whole day and they’re fairly local. The teacher feedback I’ve received indicates that the quality has been outstanding, the content highly relevant to their needs and in the days following, teachers tell me they have successfully tried and refined the ideas, strategies and resources in their own classrooms.

A Key Stage 1 and 2 workshop from exa.foundation

On Monday, the morning workshop offered teachers of GCSE Computing support with controlled assessments (CAs) worth 60% of the current GCSE. This group of teachers represented those teaching GCSE Computing for the first time, some starting later this year and those for whom it may become a reality in the future. While I’m in the habit of sharing all my resources online in an effort to make it easier for teachers to access, unfortunately a draconian internet filter in the host school coupled with paucity of WiFi made this more of a challenge than usual. Despite the host teacher’s best efforts to request access to the online materials, it required a wait of nearly 2 hours before the filter allowed access to these!

Scratch Website getting blocked

The afternoon workshop was designed to provide teachers of Key Stage 1 and Key Stage 2 with a range of free resources to support their Computing curriculum. On discovering that Scratch was not installed, I turned to the online version instead but was astonished to discover that this was also blocked by the school’s internet filter because it was deemed inappropriate by the filtering policy! It’s a harsh reminder of the obstacles that my less fortunate teaching colleagues encounter in those schools where they have few privileges and limited autonomy as far as the school network is concerned. At this point, I feel obliged to make clear that this host school does not use Exa Education for broadband provision or content filtering.

Programming a Rock, Paper, Scissors game

The rock, paper, scissors activity formed the basis of the programming workshop which took place after school. I had been requested to share ideas and strategies for teaching text-based programming and demonstrate approaches to differentiation, ie. teaching in a way that considers the needs of individual learners. I chose to run a Coding Dojo style hands-on workshop based on those that I’ve attended in London, Preston and at PyConUK (not to be confused with CoderDojo) and some events I’ve organised in the same spirit, for example the #CASconf2015 HackJam.

At the beginning of the workshop, I asked the teachers to discuss what the simplest possible model of a rock, paper, scissors game would look like. Some models were proposed, but I felt, still too complex. After further discussion, we agreed on a model in which the computer would simply choose rock, paper or scissors and output this choice. Then, using comment lines only in an editor – I asked the teachers to describe the various blocks or sections required.

Previously, I had organised the teachers in pairs (Driver & Navigator) and positioned them so that the partners that I felt were slightly more confident programmers were sitting on the right of each pair. I used a timer on my phone to give the impression that each partner had equal amounts of time driving and navigating, but in reality I skewed the time intervals (eg. 6 mins and 4 mins) so that the stronger partner had more time navigating than driving to compensate for the other partner’s lack of confidence navigating.

After a few minutes, when each pair had developed a solution, I asked each pair to send one partner to visit another pair to share their solutions and provide feedback, suggesting strengths and areas for development. Then the next whole group discussion asked how the game could be developed with an unlimited amount of time available. From this list of possible outcomes, I asked each pair to develop their simple rock, paper, scissors game to include these features, saving each development as a new version number. Throughout the subsequent development we continued to rotate driver/navigator roles and mix up the pairings too.

Pictures from an Exa Code Dojo

Finishing the Code Dojo session

Later, I presented the group with a list of the programming requirements for GCSE Computing and somewhat akin to a game of Bingo, asked them to identify the components that they had already made use of in their solution. This led to a interesting discussion which raised and helped clear up some misconceptions. Next I asked each group to consider where and how they might use the remaining components in their solution.

As the workshop drew to a close, we shared the solutions online using a code sharing tool that wasn’t blocked by the internet filter. I’ve included some solutions below in resources. We also reflected on the practical applications of this style of teaching and some group members said they were inspired to try it in their classrooms.

Of course, the title question is misleading; there is more than one “best way to teach text-based programming” and the most appropriate teaching strategy depends on a range of factors including the flexibility to adapt the teaching style to fit the current circumstances. This question prompted an interesting debate on social media and I’ve curated some of the responses below.

I think there is a lot of learning potential in the Coding Dojo model that still remains to be explored. It’s something that I’d only started using fully in the last two years within my teaching. I do find it tough to describe it fully in words and believe it’s easier to understand it’s potential when you’ve actually observed or taken part in one. If you’d like to explore the possibility of organising one at an event, conference or school – get in touch with me.

Some Helpful Feedback on an evaluation form

Resources