Haggis – Verification Round 2

  • sturnbull

    Feedback for the Coursework Assessment in the Verification summary for round 2 states – “SQA Reference Language (Haggis) should not be used as a design notation” (Top of page 3)

    Why? Why would this be? Did anyone know to make sure our pupils did not use haggis? Haggis was originally introduced as a pseudocode and in spite of it’s re branding as a ‘reference language’ it’s still an excellent tool for teaching language independent concepts and therefore an excellent pseudocode. it’s remarkably similar tothe way i was taught to pseudocode at University so I’m totally scunnered as to why it can’t be used. Can anyone shed some light on this?


    Ronnie Ross

    I would hope that pupils are not penalised for using it as pseudo code.   Do we know if this is or isn’t the case?


    There’s nothing to say in the Higher Haggis Spec (Sept 15 ) that it can’t be used as a pseudocode. Has anything been issued since that would contradict this? From the Overview (p1&2).

    “Although the idea of a clearly-defined reference language may seem daunting, it is not in fact so different from the ‘pseudocode’ that has been used for years in
    SQA question papers. It has simply been regularised…

    “Note that assessors and candidates may choose to use this reference language
    as a tool to support program design, but this is not its primary purpose..”


    Enrico Vanni

    I suspect the reasoning for this statement is because SQA have had to backtrack on ‘Haggis’ (or rather their loose and incomplete version of it), rebrand it ‘SQA Reference Language’ and acknowledge that it is not a pseudocode as they originally purported it to be but is in fact a programming language with precise syntax.  Therefor a candidate producing a solution in SQA RefLang would be going straight to code and missing out the design stage.  Irrelevant that they would then rewrite and implement the solution in another language (Python, VB or whatever).

    Just another of the unintended consequences of the mis-managed implementation of National CS courses.  Those still calling it Haggis and referring to it as a pseudocode have to just get out of that mindset.

    The real elephant in the room is that the ability to understand the syntax of SQARefLang is a requirement of the N5/H/AH CS courses but there is no acknowledgement of this (and therefor not time given for the teaching of it) in the CAS documents.  This halfway-house situation we are in is what leads to cock-ups like question 19 of the 2016 N5 exam.


    Agreed, there was some sort of revision of purpose for HAGGIS. Why? I don’t know. However it seems there’s a whole pointless chicken/egg thing going on with HAGGIS. There are those who may want it to be well defined syntactically and those, such as myself who may simply see it as a very good template to communicate the key concepts before we look at them in (whatever)code we use and hat to me makes HAGGIS a very good and consistent pseudocode. I just don’t see why the former should disqualify it from being the latter.

    Enrico Vanni

    Yeah, but the thing is Haggis wasn’t repurposed – its purpose was fudged by the SQA.  Quintin Cutts and Greg Michaelson developed it from the beginning to be a neutral language to be used for program interpretation questions in exams and nothing else.  It had a specific syntax from the outset, and needed to in order for questions using it to be fair and unambiguous.

    SQA adopted a subset of Haggis initially for N5, still calling it Haggis and bizarrely referring to it as a pseudocode (which by definition it wasn’t), and people picked up on this and ran with it as if it was to be used as a design language, incorporating this ‘purpose’ into their texts and teaching materials.  SQA then backtracked on their error, but the damage was done.

    The situation has been fudged further by the exam setters’ persistent failure to adhere to the syntax of the language when writing exam questions (a separate issue, but symptomatic of the failure to be clear about SQARefLang from the outset).

    There are plenty design notations in the wild – SQA RefLang isn’t one of them, and this is one of the ambiguities that needs to be sorted as a higher priority than the tinkering with the CAS contents that we’ve had.

    I have no doubt though that like just about everything that is wrong with National CS courses this issue was a consequence of actions that were carried out with good intention but lack of foresight.


    I agree but why is it bizarre to use/call HAGGIS a pseudocode? That’s what i don’t understand here. If the shoe fits then wear it. It works perfectly well as a pseudocode regardless of it’s initial purpose or name. It even has elision <>. I’m sure the SQA must have a better reason for telling us not to use it other than confusion about its origin. I’m sure time will tell.

    Enrico Vanni

    Wikipedia – “Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. …. No standard for pseudocode syntax exists, as a program in pseudocode is not an executable program.”
    Haggis (and the SQARefLang subset) does not meet the above criteria.  Sorry to be pedantic, but the fact that Haggis was specifically not a pseudocode but a formal language was essential to its original stated purpose of allowing exam questions to be set that tested a candidate’s ability to interpret an executable program.  It is no more a design language than any other formal programming code.  By all means incorporate SQARefLang like commands in your own version of pseudocode, but do not refer to it as ‘Haggis’ unless you want to confuse your candidates and fall foul of this new directive.

    As I said, the reason for not using SQARefLang for design is because it isn’t a design language, so by definition the design stage is being missed out and the candidate is skipping straight to implementation.


    Haha…don’t apologise for being pedantic, it’s what we do best! You’ve answered my point here though Enrico. I do in fact incorporated HAGGIS commands into pseudocode. That’s because it is simply a very good tool for doing it. Whether it was devised as such i find totally irrelevant. Each to their own of course.

    I’ve always taught constructs using pseudocode and like to get pupils to develop a consistent approach to design and use of ‘key’ words. I use HAGGIS as a starting point as there are documents they can refer to and discuss to help them identify how to notate a construct. I see it no more complicated than that. Cheers.

    Enrico Vanni

    It is a subtle but important distinction, and one that the SQA failed to make when they labled their standard language for exam questions a ‘pseudocode’, thus implying that one could be flexible in its use.

    One notable feature of Haggis (and the SQLRefLang) is that it absolutely does not use the ‘equals’ sign in assignment expressions.  Instead it uses the syntax SET x (data type) TO…, which was a decision made specifically to avoid confusion with the equal sign being used as a comparison operator.  The person who wrote Q.19 of this year’s N5 exam clearly failed to appreciate that (thus demonstrating why the distinction between a precise language and pseudocode matters!)

    Peter W Donaldson

    Enrico is right that Haggis was always designed to be a reasonably neutral reference language with a precise set of formal rules. The key difference was that informal language could also be included directly into the code using the < elison > triangle brackets. This was to allow details that weren’t directly relevant to the question, but needed for the code to make sense, to be included.

    Although code comprehension questions didn’t feature that much in the old Higher paper the ones that did were very inconsistent with three of four variations of even basic constructs between and within papers. If we’re asking students code comprehension questions in an exam then this is entirely unfair. You are effectively asking students to guess the mind of the question writer without being able to ask for any clarification. For the full details on how much variation there was in the older Higher questions you can read the paper Code or (not Code) – Separating Formal and Natural Language in CS Education

    The ideal solution is to use the programming language a pupil has learned in these type of exam questions. However the SQA wouldn’t set a specific language, or small set of languages, when they designed the new senior phase qualifications so a language with easily understood and readable syntax was required instead. Quintin and Greg, who were on the QDT, possibly understood the problem before the SQA really did and worked on creating a suitable reference language. However this was done pro-bono and I don’t think the SQA paid, or has paid, anything towards it’s development or still fully understands why it’s necessary.

    To be fair to the question writers and the SQA, pseudocode is poorly used within the wider CS community. In many algorithm textbooks they define their own language to precisely express an algorithm but then refer to it as pseudocode, not a reference language. Even Allison Elliot Tew, who recently developed a baseline programming knowledge test called FCS1 referred to the version of the questions in the more readable notation as a pseudocode. However this purpose and use of “pseudocode” is completely different from it’s use as a method of creating a program design.

    Pseudocode as a design notation is really a bridge between the real world problem and how it will be solved computationally. A design step in pseudocode should therefore be at the functional level of what the code’s purpose is not the specifics of how it will fulfil that purpose. If it’s not then it’s redundant and you’d be better just writing the code directly.

    For example

    1. Calculate the area using the length and the breadth

    is the purpose of the line of code and would also make a good comment

    1. SET area TO breadth * length

    is specifically how the area will be calculated however I could just have called a function instead like

    1. SET area TO calculateArea( breadth, length)

    Programming experience is a double edged sword because people tend to drift from writing design steps at the level of intent to the level of code once they learn the basics of a programming language. It often feels more natural just to think in code however it’s easy to get tied in knots because you need to be extremely detailed when writing a design that way. Professional programmers often say they don’t refine designs down to the level of lines of code for familiar problems for this very reason. It becomes an unnecessary extra step once they have worked out a high level design. They only do this detailed design for new problems where they don’t have as much relevant experience to draw on.



    Thanks Peter. Interesting stuff. I can’t help missing the point here though it seems. I still feel that HAGGIS can and is used very well as informal Pseudocode. What if a pupil were to write a design in what would essentially be HAGGIS but replace some key words? Let’s say ‘RECEIVE’ with the word ‘INPUT’ and the word ‘SEND’ with the word ‘OUTPUT’. The resulting design would not technically be HAGGIS but it could be a perfectly acceptable design solution. Retaining the original input/output keywords however would make it HAGGIS and therefore unacceptable to the SQA. I find this totally nuts.

    In short i find it a puzzle that this highly specified formal reference language cannot also be used informally as a pseudocode. It seems perfectly suited for it.

    I must admit its introduction excited me to the fact that it allows me to demonstrate constructs to pupils without being code specific. It has been great to be able to emphasize to pupils that they are not here to learn VB or Python or any other language, in fact i put very little weight on syntax. There are thousands of web tutorials to help them there. Rather they are there to learn Software Development concepts and that when they are able to identify which constructs they will need to solve a given problem then converting them into VB is the easy part. I’ll continue to teach my pupils the consructs using HAGGIS and encourage them to design with it as normal. They may have to change a word or two to get past this absurd technicality though but don’t we all?! Cheers Stu.

    Enrico Vanni

    On the face of it Stu (if you don’t mind me calling you Stu) that looks like a good and positive approach, but I would advise caution.  Being lax with the syntax of SQA Reference Language was the direct cause of several of the mistakes in the 2016 National 5 paper, and the revised code in the ‘corrected’ marking scheme issued recently actually made matters worse, again because the person who wrote the code has diverted from the syntax specified in the SQA documentation and incorporated features that may appear in other languages but not in SQA RefLang.


    Peter made the point that we have to have a clear and precise distinction between formal and natural language in program interpretation, with good reason.  If we don’t then these mistakes will continue to be made – every piece of SQA RefLang code that has ever appeared in an exam paper has had something wrong with the syntax, and in the 2015 Higher paper the SQA broke its own rules and used a random piece of formal language code not conforming to SQA RefLang in order to ask a question regarding program interpretation using formal and actual parameter passing.  I have to ask myself why, and the only reason I can come up with is that in the minds of many teachers and exam setters SQARefLang is Haggis, and because Haggis was originally incorrectly termed a pseudocode it is right and proper to play around with its syntax.


    The news that it isn’t a pseudocode and the consequences of treating it as one hasn’t filtered through, but with many of the teaching resources produced in the early months and years of the new Nationals (that are still being used today) referring to it as pseudocode many people feel vindicated in this approach.


    The paper Peter referred to in his post might seem heavy reading for some, but it makes the point very well that persisting with this approach will continue to lead to what are effectively unfair exam questions as a candidate’s ability to answer them depends more on being lucky that they interpreted the code writer’s intentions rather than they intepreted the code in front of them.  Never was there a more stark example of that than the 2016 N5 paper!


    Thanks Enrico. I’m certainly going continue teaching constructs in HAGGIS, this will prepare them for exam questions too.

    In reality when pupils begin to develop designs they will very rarely reproduce ‘perfect’ HAGGIS and i’ve never stressed the need for them to (or syntax for that matter). More often than not they mix HAGGIS with their own interpretation and if the concept is grasped then that is all that matters.

    The use of HAGGIS in this year’s paper was shoddy – the = instead of TO iirc. But that example in itself should not have changed the meaning of the code. Perfectly understandable what was meant.

    Q19 however was a total shambles. Not particularly a notation error, more a total failure to communicate what was required in the question and no matter what notation was used it was just plain wrong.

    Although i still feel that banishing HAGGIS as a design notation is a bit of an overreaction and totally pointless i can see a way round it without redesigning all our courses. Failing that i could just re-introduce COBOL and see if anyone objects to that! Cheers Stu.

    Sean Stratton

    My only concern with teachers using SQA RefLang is that we might end up with markers that expect SQA RefLang as pseudocode and mark as such.

    Things like

    • Expecting statements to have END statements ie FOR..END FOR, WHILE..END WHILE, rather than accepting indentation.
    • Not explicitly setting up a variable before using it
    • Using or not using line numbers
    • All the other little informal things you can do in a non formal language

    Now you could argue that pupils build good practice by using these practises but should they be penalised by not using them?

    Anyway to lighten the mood
     What programmers say

Viewing 15 posts - 1 through 15 (of 23 total)

You must be logged in to reply to this topic.