Haggis – what should it be used for?

There seems to be much confusion about Haggis. As one of the folk who argued for it and helped to develop it, I want to set the record straight on why it is necessary and how we envisaged it being used in teaching. I’ve also included a link to a web-based checker and run-time system, so you can check any Haggis code before letting your pupils see it. Please pass on this message widely to colleagues.

Observation

This is what I’ve seen/heard about how Haggis is being used:

  • Haggis is used as a planning language
  • After a problem is refined over a number of iterations, a fully-specified program written in Haggis is the result
  • This is then translated into a “real” programming language to execute it.

Pupils are reported to be confused on two counts:

  • they don’t know why they’ve been asked to write a full program in two languages.
  • they mix up the syntax of the two languages they are being asked to learn simultaneously.

Expectation

We expected Haggis to be incorporated into teaching as follows:

  1. Pupils learn to program in a “real” language of the teacher’s choice.
  2. Plans – that is, intermediate representations of the solution to a problem, at levels below the problem but above the final solution – are written in any pseudocode with which the teacher is comfortable. The key point is that a plan is written at a higher, more abstract, level than the programming language code itself. The final refinement is into the code of the real programming language, not into Haggis.
  3. Only when pupils have a secure understanding of one programming language, and can explain clearly what code in that language does, should they be introduced to Haggis – near the end of the course – with an explanation something like “You’ll see Haggis code like this in the exam, and be asked to explain it, so I’m going to make sure that you know how Haggis is different to what you’ve learned so far.”

Why did we expect/want Haggis to be used in this way?

  1. Research shows that the ability to understand programs is a key factor in developing computational thinking / programming skills.
  2. National 5 and Higher therefore include outcomes concerning the ability to read/understand code.
  3. Rigorous assessment of these outcomes requires code to appear in exam papers.
  4. SQA don’t specify one programming language of instruction – so, which language should be used to present code in exam papers?
  5. SQA adopted Haggis, a clearly defined pseudocode, as a way of presenting code in exams.

Note, crucially, the first paragraph of the SQA National 5 Pseudocode Spec says:

“Where candidates may be instructed using one of a range of languages, a clearly-defined pseudocode should enable code to be presented to them under closed assessment conditions such that they can reason about it.

Candidates are not expected to write code in the clearly-defined pseudocode, given that examiners should be able to mark solutions written in a range of languages commonly used for teaching — and so candidates can use the language of their choice”

This is the key: pupils should only need to know how to READ Haggis code – they are NEVER required to write Haggis in exams – all problem solving questions requiring the writing of code should include a phrase such as “In a language of your choice…”.

Seeing the same concept in two languages is good for embedding a deep understanding of those concepts – so showing pupils code in both your language of instruction and also in Haggis should be good educationally, as well as preparing them for the assessment. (Of course, to give them a sense of how much they’ve learned, you could see if they can explain a program they’ve seen already when it’s expressed in a third language too! Some pupils fear switching languages, but then when they have to do it, they often find it easier than they expected.)

Tools to help you with Haggis

As a teacher, you are likely to need to develop some examples and/or questions that make use of Haggis for your pupils. It is never easy to write accurate code first time which is why we need checkers. Haggis is no different, and a checker and run-time system are now available, developed by Richard Connor at Strathclyde University. These are publicly available at the following page, and for those of you interested, there is a link from the page to a formal specification of Haggis.

http://haggis4sqa.appspot.com/haggisParser.html?variant=higher

There are other tools out there as well – for example, Bill Buchanan at Napier University, Paul Cockshott at Glasgow University, and a pupil have all created implementations.

Any questions or comments about all this, please post them here or send them to me…

Quintin Cutts
School of Computing Science
University of Glasgow
Glasgow G12 8RZ
 
+44 (141) 330 5619
Quintin.Cutts@glasgow.ac.uk