How I Teach Programming 4 – Make

The final stage of PRIMM is make. This is where students make the move to writing entirely their own code. The graphic below is a slide from my CAS presentation showing how PRIMM maps across to Rosenshine’s principles of instruction and the ‘worked examples & backwards fading’ techniques outlined in Tom Sherrington & Oliver Caviglioli’s Walkthrus book.

This means that I need lots of ideas for algorithms & programs for the students to create. Here’s are my main sources:

Parson’s Problems

Despite the more independent nature of the make stage, I still provide some scaffolding to give learners a route into these activities. Often I use Parson’s Problems – where I give students all the code for a solution but in the wrong order. The National Centre for Computing Education has a great pedagogy quick read about this approach. Here are two of their examples:

To develop this, I may give students a partially completed algorithm, which they then have to complete then write the code.

Complexity Of Task

When setting tasks, I’m very conscious of what programming techniques students will need to use to solve the problem. At first I might use a similar but different task with minor variations form the examples that students have worked with in previous PRIMM stages.

To increase complexity, I use tasks that require students to combine other techniques or use those learned in new, unfamiliar ways. For example, a guess the number task might be phrased like this:

  • Create a program that stores a ‘secret’ number of your choice in a variable.
  • The user must try to guess the number by inputting their guess. This should be saved in another variable.
  • The program should compare the guess to the secret number.
  • If they are the same, the program outputs ‘correct’.
  • Otherwise, the program outputs ‘incorrect’.

This task just tests input & if…else selection. To make it more complex I might build in features that require other techniques such as:

  • The secret number should be generated at random.
  • If the guess is wrong, the program should tell the user if their guess is too high or too low.
  • The program should loop while the user keeps guessing wrongly.

Complexity of Instructions

In the example above, my instructions were written in a very algorithmic manner. This helps to reduce the

cognitive load as students don’t have to do as much decomposition of the task into a step by step sequence. However, to develop algorithmic thinking skills, I ‘fade’ the precision of my instructions so that students have to do more of the decomposition. To achieve this, I would rephrase the task above something like this:

Write a program where the user has to guess a secret number that is stored in the code. The program should tell the user whether they have guessed correctly or not.

Variation Theory

William Lau introduced me to variation theory which comes from Maths but is brilliant for coding. Adapted for programming, it fits really well with the multiple ways you can find to solve the same problem. This one is good for loops & selection. Example tasks I might set for this are:

How many different ways can you create a program that:

  • Outputs ‘Old enough to vote’ if your age is 18 or over and ‘Not old enough to vote’ if it isn’t.
  • Outputs ‘Hello world!’ ten times.
  • Outputs the numbers one to ten.
  • Stores three items in your inventory (sword, shield, bow etc)

And there you have it, my approach to PRIMM across four blog posts. How are you using it in your classroom. Get in touch and let me know.

How I Teach Programming 3 – Modify

The modify stage is where students start to move from ‘not my code’ to partially my code’. As the name of the stage suggests I supply the starter code and the students adapt it.

As with all stages of PRIMM, it’s possible to build complexity through the types of modification tasks you set. The Block Model that I referred to in my Investigate post here is also really useful in planning the sort of tasks that you set.

It is also important to remember that the more complex the programming technique the harder each type of modify task becomes – I think of it like gymnastics difficulty multipliers. A modify task using just outputs has a low modifier, one using nested loops or linear searches a much higher one.

Mind Your Language

One of the simplest ways to build complexity into a task is through the level of detail that you include in your instructions. The more specific your instructions are, the more you reduce the cognitive load on students having to remember syntax, identify the correct place to make changes and alter the code. For example, with this code:

age = 16
if age >= 18:
  print("You are old enough to vote")

We can set the same task with varying degrees of cognitive load depending on how we phrase our instructions. For a new learner I might use very specific instructions such as:

Change the condition on line 3 so that it checks to see if the age variable is greater than 16.

Whereas I may give a more experienced learner the same task but with less specificity:

The voting age has been lowered to 17, alter the code so that it outputs ‘old enough to vote’ for all valid ages.

Parsons’ Problems

These are problems that give students all the code needed, but jumbled up. This helps reduce cognitive load needed for remembering the syntax (if you’re teaching Python then you can include the indenting too). It also lets students see the correlation between a written description of a problem and the code needed to solve it, as well as uncovering some of the ‘hidden steps’ that are hard for new programmers to intuit. This article from the Raspberry Pi foundation is an excellent starting point to learn about creating Parsons’ problems.

A simple Parson’s problem based on the code from above might look like this:

  print("You are old enough to vote")
if age >= 18:
age = 16

Again, here I would give new learners a description of how the code should work.

Minor Adjustments To The Way A Program Works

Take existing code and make simple changes to make it work in a different way. For example:

  • Output ‘Hello there’ instead of ‘hello world’
  • Output the contents of the num2 variable instead of the num1 variable.
  • Change the condition in selection so that the message outputs when score is more than 10 instead of 5.
  • Make a for loop repeat 20 times instead of 10.
  • Make the for loop counter increment by 3 every time instead of 1.
  • Change the calculation performed from addition to multiplication.
  • Use variables instead of numbers in calculations
  • Use input to assign to variables instead of data in the code.

Changes To Program Logic/Flow

This works best with selection and loops, and really helps you to get information about how well students understand flow. Tasks such as:

for counter in range(1,10):
   print("Hello world")
  • Alter the loop so that it repeats 20 times.
  • Use a while loop to achieve the same output
for counter in range(1,12):
   print counter * 7
  • Alter the program so that it outputs the 9 times table instead.
  • Alter the program so that it outputs the result as part of a sentence – ‘counter times 7 = answer
  • Alter the program so that it outputs the times table in descending order

Combining Techniques

Adding techniques from previous lessons brings an element of retrieval practice and lets students develop more complex programs. This increases the cognitive load so Tasks such as:

  • Get user input input the num1 variable instead of assigning the number in the code.
  • Add selection to the code so that it outputs ‘Hello Dave’ only when the userName variable contains ‘Dave’
  • Use a loop to output the contents of the list instead of outputting them one by one.

More Complex Conditions

Introduce Boolean operators and start to expose students to validation techniques with tasks such as:

  • Adapt the condition so that it only outputs ‘valid number’ when the number input is between 1 and 10.
  • Adapt the condition so that it outputs ‘invalid choice when the user does not input ‘Y’ or ‘N’.
  • Adapt the condition so that it outputs ‘number out of range’ when the number input is not between 1 and 100.

There are lots and lots more ways to set modify tasks, please comment and share your methods.

How I Teach Programming 2 – Investigate

This post covers the ‘I’ in PRIMM – the investigate stage. At this stage students are still working entirely with code supplied by me, as showin in the graphic below.

Source: primming.wordpress.com

Sue Sentance’s excellent site primming.wordpress.com describes the investigate stage as:

The third stage is Investigate, which should be varied – there are many, many lovely exercises that you can do to get into the nitty gritty of the code – annotate it, use Parson’s puzzles to get it in the right order, put errors into it and do some debugging, trace through it (use the PLAN C TRACS activities for this), label the variables, etc.

This is a key stage for me as it is a core part of checking for understanding – a core concept of Rosenshine’s Principles of Instruction and Lemov’s Teach Like A Champion approaches.

It gives me another chance to ensure that the predict & run stages have worked as intended – or not and I need to re-teach or mini teach bits again. It should not be rushed, some students spend significant amounts of time at this stage. The trick is to plan graduated questions that provide challenge, promote deep thinking and help uncover misconceptions. Easy eh?

The most useful model I’ve seen for planning investigate questions is the box model (explained in more detail in this excellent Hello World article). It identifies twelve zones of understanding.

Here are the sort of questions I ask at this stage. I’ve grouped them by zone, but there’s always overlap and I don’t agonise over including questions from each zone in each activity:

Text Surface – Atoms

What line does selection start on?

How many output commands are there in the code?

How many variables are there in the code? What are their identifiers?

Which of the following is not used in the code: assignment/output/iteration/integer division?

What line is concatenation used on?

What is the condition used in the selection?

What operator is used in the condition?

What is the start/end/step value for the for loop?

How many items are there in the array arr?

What is the third item in the array arr?

What item in array arr has the index n?

How many parameters doe subroutine x take?

Text Surface – Blocks

Which lines of code belong to the elif branch?

How many instructions belong to the loop?

Circle all of the code that is part of the subroutine.

Which lines have subroutine calls on them?

Text Surface – Relationships

What lines does variable x have scope between?

Is variable y global or local?

Text Surface – Macro Structure

Describe the purpose of this program.

Describe the purpose of subroutine z.

Program Execution – Atoms

What will be returned by x > 10 when x is n?

How many times will the for loop/definite iteration run (using the key term adds an extra layer of complexity as students have to identify that the for statement is an example of definite iteration).

Program Execution – Blocks

How would swapping lines x and y affect the way the program runs (sometimes it doesn’t – throw a few of those in too).

Which selection branch would run for the input x?

What would the input have to be for the elif branch to execute?

Program Execution – Relationships

Why is the i variable used in the for loop line and inside the loop?

What is the relationship between variable x in the subroutine call and variable y in the subroutine definition (parameter passing?

Program Execution – Macro

A nice time to introduce some variations here – how many different ways can you achieve the same result (eg output your name 10 times) – not strictly investigate but dovetails in well.

Function – Atoms

Explain why I have chosen to use selection/iteration etc on line n.

Why has the programmer reassigned the updated value back into to the score variable on line n?

Function – Blocks

Which order are the subroutines called in the main program?

Why does the subroutine x have to be defined before it is called?

Function – Relationships

What line of code runs first in the program? (Useful when defining subroutines at the top of your code.)

Function – Macro Structure

What would the program output/return if the input/parameters were x?

This list is very much a work in progress, please suggest and feed back in the comments. Here are a couple of examples of investigate tasks from my KS3 lessons:

Python ‘Maths With Variables’ – Y7/8 lesson
Scratch ‘Input’ lesson – Y7.

How I Teach Programming #1 – Predict & Run

Inspired by a recent chat with Tom Sherrington (@teacherhead) for the LearningDust podcast, I’m dipping my toe back into blogging for the first time in ages.

This post is based on my experiences using the PRIMM approach to teaching programming across key stages 3 and 4. It covers the the P and R (predict & run stages). At these stages we are entirely at the ‘teacher provides the code’ stage of learning.

This image has an empty alt attribute; its file name is primm-diagram.png
Source: primming.wordpress.com

This is my general approach, using the Rosenshine/Teach Like A Champion technique of breaking it down into small steps, checking for understanding and asking lots of questions. If you haven’t checked out these techniques yet then I’d highly recommend them.

  1. Introduce the key term/concept – for this example output. Give students the definition. Now make the definition real (check out William Lau’s superb Semantic Waves talk about this), give a few examples. Ask students to come up with their own definition and use cold calling/pair talk to check for understanding.
  2. Get the students to use the term in a sentence. If it’s a more complex term then use the full Frayer model to explore the vocabulary in a computing concept.
  3. Show students the code that creates the output (Scratch ‘say’ block, python ‘print’ command). If this is a more complex technique like selection then break it down into statement, condition, branching and explore each concept. Show examples of the code and get student to identify the different parts – I’ve found mini whiteboards are excellent for getting a high ratio and enabling me to check for understanding here.
  4. Show a simple example of the code in isolation. Students use mini whiteboards to predict what it will do when run. Get correct students to explain for the benefit of incorrect students – insist on use of key vocabulary here – use say it again better. Have at least 3 examples prepared and repeat until you get a high success rate.
  5. Now we add the run. Students move to independent practice with several examples. Give them the code, they write a prediction of what it will do. Insist on accurate use of vocabulary here.
  6. Then they create the code and run it. They write a comparison of what the code did versus their prediction. I get them to take a screenshot of the code running too.
  7. And repeat – I find that 3-4 examples is usually enough for a simple concept like output. You could build in some errors to later examples to check that they are really paying attention to the syntax. This gives quicker learners some overlearning whilst giving others a chance to achieve success. Here’s an example of one of my task sheets.

And that’s it.

Please let me know what you think, any ideas/suggestions/feedback is more than welcome. Next up in the series is Investigate.

#CASConf 2017

It’s been a while folks, but here’s a post outlining my workshop with the estimable @Mr_G_ICT for the Computing At School conference 2017.

Our session is based around a couple of practical ways to teach the theory content for the new networking GCSE specification.

Part One – Pick A Card

The first thing that you can’t get away from is content – there’s lots of it and many, many key terms to be learned. One of my favourite ways to do this is an idea from Paul Ginnis’ excellent Teachers Toolkit. Here’s how it works.

For the session I have prepared key terms game cards (Word PDF)for a mix and match activity – laminating and velcro on the back of each card is ideal here so that the relevant definition can be stuck to the back of each key term. If you prefer, the students can find and write their own definitions on the back of each card, this helps them learn how to use revision guide/textbooks more efficiently. Just make sure that you delegate out the job of definition checker. I’d also recommend using my banned list technique here to take thinking deeper.

The next stage is the revision game. Here are the rules:

  1. Display a large timer on the board – online-stopwatch is ace for this.
  2. Students work in pairs – one is the player and one the referee.
  3. Cards start key term face up on the desk.
  4. The player has to say the key term then give the definition on the back without looking.
  5. Referee checks – if they’re right turn the card over and move on. If not the ref reads the player the definition. They can’t have another go at that one until they have tried all the remaining cards.
  6. Run the timer for about 3 minutes – if players finish in that time then the referee records their time. If not then ref records how many they got right – they have to start with the ones they didn’t get right next time.
  7. Students swap roles and off we go again – now player twos have to try and beat their partners.
  8. Repeat as desired – I find that two rounds each is about right.
  9. Follow up with a quiz to assess what stuck.

Repetition, collaboration, competition, many brains working at once and, dare we say it – fun. All important ingredients for long term recall. You’ve also got a starter/plenary for future lessons!

Part Two – Rock & Rules

Protocols are a tricky one to get your head around. The tablets of stone activity helps pupils to act out the process of moving data around a network whilst following strict rules. It also really underlines the need for precision when devising their own protocols.

Students will act in several roles – senders, receivers & messengers. It’s a good idea to get them doing all roles to show them all sides of the process and to avoid some being left with nothing to do.

Messages must be written on a template(Word PDF) – however this is missing some key information.

Students have to send messages between each other, these are provided on the template doc. They’re designed to be awkward to send, eg:

  • They don’t fit on one message template
  • Words don’t make sense or aren’t common
  • There’s no way of identifying the order of the message.

After a few minutes students start to get frustrated – you might want to have an auditory aid here so that they can ring a bell (for example) when there’s a problem. If they ring the bell, they have to write the problem on a post it and stick it to the board. stop the class after a few minutes for a discussion about how to modify the rules to fix problems identified. All old messages that don’t obey the new rules have to be thrown away and re-sent with the new rules, emphasising the importance of getting the protocol right before starting the task.

 

That’s the basis of our session, if you have any questions please get in touch via CAS or by tweeting to @MrAColley and @Mr_G_ICT

The BBC micro:bit

I returned from the Easter break to find 4 huge parcels containing 280 BBC micro:bits (one for each Y7 in school.  This is tremendously exciting!  I’ve had my teacher bit for, erm, a bit and have loved playing around with it, as has my 6 year old daughter and her friends (a small plea – MORE of this sort of thing please BBC – lots of other year groups and especially primary teachers would LOVE these resources).

2016-02-16 09.16.24

Little Miss Colley and friends investigating the micro:bit.

The Y7 micro:bit pioneers club have been writing some excellent programs such as a compass, a real life snakes & ladders and a magic 8 ball too.

Now it’s time to start introducing all of Y7 to their new devices.  We’ve made the decision to keep the micro:bits in school whilst we work through the 4 lesson scheme of work and give them out at the end once pupils have become more familiar with the devices and (hopefully) some fires have been lit.

As usual, I’ve been busy creating resources, so here are:

My YouTube playlists:

My microbit website profile – basically all the scripts that I have written.

The scheme of work and lesson resources.

How do you actually teach programming?

Fab post about teaching coding.

Code? Boom.

This is a question which has been bugging me for some time now – how do you actually teach someone to program? I don’t mean which language, or what resources should I use, or what time of the day is optimal. I mean what is it in your teaching which switches on the little lightbulb that makes a student able to think through the logic of what they want to do and translate that into code? I have recently been working on my Spanish using Duolingo and I sense that my own language learning is a little like what I’m seeing in the classroom with students who learn to code.

Here are the stages I often see in the classroom:

Syntax wizard
This is the first stage where the student is confident to use familiar concepts such as input, print, if/else etc. The student can memorize syntax and fix any…

View original post 634 more words

Thursday 15th October 2015 – #EducationDay – A Day In The Life Of My Classroom

IB3 Classroom

This post is intended to show a day in the life of my classroom and share my lesson resources as part of Twitter’s international #educationday.  All of my resources are shared here using a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license – you are free to us and adapt but do not sell them on.  If you want to ask me any questions before, during or after the day then please comment here or tweet me (I’ll be able to respond at break and lunch).  Thanks, and here we go……

Period 1 – 8:50 – 9:50 – Year 9 (age 13/14) Computing

Year 9 are taking their first steps into text based programming by learning Java.  In this unit of work we take a programming skill (such as selection) and split it into three exercises – a worked example in Scratch, recreate the same program in Java then try an independent challenge based on what they have learned.

Today the class are completing the Java worked example and starting the challenge for selection (activities 5 and 6 on the ‘contents’ page).

You can see my tutorial website for the students here

Download all the resources for the scheme of work here.

Matthew talks about his Java program:

Period 2 – 10:50 – 11:50 and Period 3 – 11:05 – 12:05 – Year 10 (age 14/15) GCSE Computer Science

I have two GCSE groups in Y10 this year, so this is two separate one hour lessons, not a double with the same class.  This week we are learning about data representation.  Tuesday’s lesson was about ASCII and Unicode text representation and (if it’s all gone to plan – I’m writing this bit in advance) today’s lesson is about representation of images. UPDATE – Y10 P3 have had one lesson on this topic. They will be creating pages on the class Wikispaces wiki to summarise their learning.  P4 have completed this work as they have had 2 lessons this week.  We will be starting representation of images with a very early Christmas themed lesson!

I’ve planned these lessons in collaboration with my ace colleague @Miss_Noonan88 and based them on the equally fab resources available on @clcSimon‘s great website.

Representation of text lesson resources are here.

Representation of images lesson resources are here.

Hamza and Steve talk about representation of images:

Heather talks about ASCII and her revision Wiki

Period 4 – 12:05 – 13:05 – Year 8 (age 13/14) Computing

Y8 are refining their Scratch programming skills by creating a ‘Virtual Pet’.  Here’s my example of the finished product.

This project consolidates their knowledge of input, output and variables.  We then use selection, loops, lists and procedures (blocks) to add extra features to their pet.  Learners will be adding extra characteristics (thirst/happiness etc) to their pet or using random selection from lists to make it speak.

The project tutorial website is here.

Download all resources for the scheme of work here.

Awesome female coders Katie and Maddy tell us about their Scratch virtual pet.

Lunchtime – phew!

Spent fixing case sensitive <img> links on my project websites that didn’t show up until I uploaded to the web server!

Period 5 – 13:50 – 14:50 – Year 11 (age 15/16) GCSE Computer Science

Y11 are currently doing their Controlled Assessment, so unfortunately I can’t share examples of work in progress.  They are using Java to code a memory game which generates a grid of nine or sixteen words read in from an external file.  After 30 seconds, the words are randomised, with one word replaced with a different one.  The user has to guess the words that have been removed and added – they have three tries.  Here is the AQA exam board specification for the project.

We have finished coding on the project, the class are either completing test plans, testing or annotating their code listings to explain the programming techniques used.

The end?

So that’s the teaching part of the day done.  Next it’s a departmental meeting for about an hour and then home to see the family.  Once the kids are in bed then there are about 50 pieces of Y9 work to be marked.  Hope you’ve enjoyed a day in my classroom, it has served to remind me what awesome students I’m lucky to work with.  Until next time…

Andy

Knowledge organisers for GCSE Computing

A great post based on sound practice.

@mrocallaghan_edu

Always in the pursuit of doing better for the students I teach, two posts have made me reflect deeply on my practice this week.

1. Knowledge organisers by Joe Kirby.

In the post Joe describes how he specifies the subject knowledge required for a given topic in meticulous detail. This is useful for a few reasons:

– it clarifies for the teacher exactly what the students need to know and enables more precise planning.

– it serves as a good benchmark for students at the beginning of a topic. Seeing the required knowledge laid out in front of you on a side of A4 is extremely powerful and will enable students to highlight what they are already know.

– when it comes to revision, students have real clarity about the knowledge they need to know.

During my relatively short time as a teacher,  when starting a new topic I may have shared…

View original post 840 more words

Go on, Google me…..

“You’ve got a website Sir?”

Yes I do, and Facebook, Twitter and quite a few other social media outlets.  Some of which I allow to be public. However, before I go all Nathan Barley ‘self fulfilling media node’ then let me share with you the key line/learning point from all of my e safety lessons and staff training sessions.  Concentrate now, here comes the science bit…

When you post something online, it’s ACTUALLY ON THE INTERNET.

(Well, technically the World Wide Web, but I’ll put the Computing pedantry on hold just this once.)

There, sorry for shouting but it is quite important.  This story is the reason I’ve been compelled to post.  I’m also lucky.  I got to go to school, college and (especially) university pre-Facebook. Very dodgy hair.

The newest generation of teachers didn’t, nor did they have the benefit of learning from mistakes made in the digital arena by previous generations.  They are the pioneers/lab rats depending on your point of view.  It also seems increasingly easy to forget that the Web is only as private as you choose to make it, and even then less so than you think, so here’s my point.

We need to model digital citizenship for our learners.

There’s no point in being an ostrich, that horse is out of the bag, the cat is behind the cart etc etc…  Have a blog, tweet, be on Facebook but if you choose to make it public then be nothing but professional and positive.  Post your best stuff, celebrate successes, admit to failures in an ‘I’m going to learn form this’ manner and definitely definitely share resources and good practice.
Now for the really important bit – leave the arguments for non public arenas please. I’m absolutely sure that I don’t want to see my kids’ teachers engaged in a slanging match on social media. Think of how your 140 characters could look to others unaware of intended inflection, humour, or other underlying meaning.  For your own sake too, you’ll probably get Googled pre-job interview.

So I encourage my classes to Google me!  Risky, but I’ve taken precautions. They did once find a ‘Mr Colley’s fit’ Bebo group, but it was (predictably) about a different Mr Colley INA different school. However, it did spark some interesting chats about knowing what’s online about you.

I have a website (but you already knew that given that you’re on it!), I’m Mr Colley and it’s about teaching.  My Twitter feed is the same, an extension of my professional life. If I want my learners to take their place in a digital society then I should try to give them an example of how to behave and leave a trail of good stuff for others to find.  My personal online presence is well locked down, and even then I’m careful about what I post. Never the twain shall meet.  In the wise words of Egon Spengler:

“Don’t cross the streams”.

I know I’m probably preaching to the converted here, but if like me you’re involved in any form of pastoral role or ITT then please pass on the advice.  This needs to be more than an assembly and a few Computing lessons a year.