Haggis (programming Language)
   HOME

TheInfoList



OR:

Haggis is a high-level reference
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
used primarily to examine
computing science Computer science is the study of computation, information, and automation. Computer science spans theoretical disciplines (such as algorithms, theory of computation, and information theory) to applied disciplines (including the design an ...
for Scottish pupils taking SQA courses on the subject. Haggis is used as a tool to bridge the gap between
pseudocode In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actio ...
and typical
computer programming Computer programming or coding is the composition of sequences of instructions, called computer program, programs, that computers can follow to perform tasks. It involves designing and implementing algorithms, step-by-step specifications of proc ...
. Haggis is not based on any one language but a mixture that is intended to allow a pupil familiar with any of the many languages used in classrooms to easily understand the syntactic construct being used in an example. It has multiple programming paradigms of
functional Functional may refer to: * Movements in architecture: ** Functionalism (architecture) ** Form follows function * Functional group, combination of atoms within molecules * Medical conditions without currently visible organic basis: ** Functional s ...
, imperative, and
object oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impleme ...
to suit this purpose. There are three separate language definitions, one for each level at which computing is assessed by the SQA; these are proper subsets of each other, so, for example, any program contained by the National 5 level language is also well-defined at Higher and Advanced Higher levels. Higher includes the definition of procedures and functions and the use of record types and files, while Advanced Higher includes object-orientation. Online Haggis interpreters have been developed to provide a way for examiners and teachers to check their programs are correctly defined and behave as expected.


Overview

In
Scotland Scotland is a Countries of the United Kingdom, country that is part of the United Kingdom. It contains nearly one-third of the United Kingdom's land area, consisting of the northern part of the island of Great Britain and more than 790 adjac ...
, school-level computing qualifications are awarded by the
Scottish Qualifications Authority The Scottish Qualifications Authority (SQA; Scottish Gaelic, Gaelic: ''Ùghdarras Theisteanas na h-Alba'') is the Scottish public bodies, executive non-departmental public body of the Scottish Government responsible for accrediting educationa ...
. A decision was made for computing courses that a single choice of
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
for examination should not be mandated: this allows teachers to choose languages as appropriate to context. This, however, leaves the issue of how to examine programming, especially in the light of recent educational research that encourages the teaching of reading and understanding code as a core discipline, which should therefore be examined. Initially, a form of
pseudocode In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actio ...
language emerged among examiners, to avoid any such language dependency. However this led to the very undesirable situation that, while students are being taught about the importance of rigour of terms in a programming language, they can look back over previous years of examinations and see non-standard use of coding that varies from example to example. Haggis is the solution to this. Haggis is a formally defined reference language, but its purpose is to examine programming, not to write programs. A further requirement is that it must not be a mandatory part of the curriculum, so students who have never previously seen the language should be able to read it. These aspects, along with an attempt to conform as far as possible with the evolved pseudocode style, directed the specification of the language. So, while Haggis is in fact a programming language (even though, in general, not all Haggis programs are executable), it is not intended as a language in which to write programs. These concepts are more fully explained in an academic paper.


History

Haggis was commissioned by the SQA in 2010 to provide a uniform syntax and form in which to present questions to pupils in assessments. Its present form was jointly developed by Quintin Cutts (
University of Glasgow The University of Glasgow (abbreviated as ''Glas.'' in Post-nominal letters, post-nominals; ) is a Public university, public research university in Glasgow, Scotland. Founded by papal bull in , it is the List of oldest universities in continuous ...
), Greg Michaelson (
Heriot-Watt University Heriot-Watt University () is a public research university based in Edinburgh, Scotland. It was established in 1821 as the School of Arts of Edinburgh, the world's first mechanics' institute, and was subsequently granted university status by roya ...
), and Richard Connor (
University of Strathclyde The University of Strathclyde () is a public research university located in Glasgow, Scotland. Founded in 1796 as the Andersonian Institute, it is Glasgow's second-oldest university, having received its royal charter in 1964 as the first techn ...
). The aim of developing Haggis was to emphasize the core idea of ensuring pupils could view code and demonstrate their understanding of its behaviour in order to develop their computational thinking and programming skills. Haggis was first introduced into the computing science examinations as part of the Scottish Government's Curriculum for Excellence development program in the 2013/2014 session in National 5, 2014/2015 for the new Higher courses and into the new Advanced Higher in the 2015/2016 session. Haggis was not introduced as a language to replace other languages already used in education, nor was it intended that the language should be taught or used in the normal curriculum. However, some teachers have adopted it as a rigorous
pseudocode In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actio ...
form to enhance teaching delivered in another language.


Features and philosophy


Core principles

Haggis was designed with 8 core principles in mind *Not be based on any one extant programming language *Be adaptable to programming languages already taught in the Scottish Curriculum. *Provide enough complexity for Advanced Higher teaching while being appropriately useful for earlier teaching years. *Provide an instinctive element, e.g., variable types are self-specified. *Be concise in use but open to interpretation of multiple ways to solve a problem. *Allow different constructs to have different meanings when used in certain contexts. *Don't visualize the non-useful elements, such as memory being allocated.


Use within education

It was designed to be both functional/sequential and object-oriented based in order to be simple and complex for National 5/Higher students and Advanced Higher students simultaneously. Haggis was designed to allow pupils across Scotland to enhance the learning and understanding of computer programming through reading examples and aid the step of converting from
pseudocode In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages (like assignment operator, conditional operator, loop) with informal, usually self-explanatory, notation of actio ...
to full programming. It was not created with the intention of asking pupils to write it in assessments but to provide a uniform language in which to present code examples to students, ensuring that all pupils have a fair understanding and are not hindered by learning a different
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
than the one exemplified in the assessment.


Syntax

Syntax and structure in Haggis are very similar to other programming languages and can be easily learned.


Reserved words

*Reserved words are capitalized; this would generally be considered ugly for a programming language but makes the program structure clearer for a first-time reader of the language. Similarly, the language deliberately contains a great deal of syntactic redundancy. *DECLARE, FOR, WHILE, etc.


Data types

(Types are normally determined by
inference Inferences are steps in logical reasoning, moving from premises to logical consequences; etymologically, the word '' infer'' means to "carry forward". Inference is theoretically traditionally divided into deduction and induction, a distinct ...
except where this is not possible.) *Character (a single character type, from which strings are composed) *Integer *Real (including integers) *Boolean (true or false)


Structured types

*Array: Sequence of same data types. *String: Array of Characters. *Record: A labelled collection of values. *Object: as defined by class descriptors. Arrays are included at National 5 level, records at Higher, and objects at Advanced Higher.


Line numbers

In some examples in examination papers, line numbers are used to allow easy reference; this is not a part of the language, however.


Indentation

Code within other structures should be indented so it can be properly identified by the compiler and to make it easier to read for the developer and for anyone else who may be reading the code. Once again, this is not a part of the language definition.


Comments

Comments can be made using the “#” character for every line of commented text; this can appear either at the beginning of a new line or after a piece of code. Large blocks of text can be specified using the “<(COMMENT TEXT>” format; this is primarily implemented for educational use to provide larger context for students.


Variable names

Variable names should be written in lowercase or, if the name is complex, in lower
camelCase The writing format camel case (sometimes stylized autologically as camelCase or CamelCase, also known as camel caps or more formally as medial capitals) is the practice of writing phrases without spaces or punctuation and with capitalized wor ...
. Camelcase is when a name is concatenated together to form one long word; however, the first letter of each word (apart from the first) is capitalized. For example, variables could be called: *number *meaningfulName


Initialisation

Initialisation allows the declaration of a new variable. :DECLARE <variable’s name> INITIALLY <value> If the type cannot be determined from the initialising value, an optional type may be included, as for example :DECLARE myArray AS ARRAY OF INTEGER INITIALLY []


Assignment

Assignment allows the user to set values to variables. The syntax is as shown. :SET <variable’s name> TO <value> *If <value> is a string, it should be written within quotation marks, like this: SET phrase TO "maybe" *If <value> is an integer, it doesn't need quotation marks, like this: SET number TO 23


Input

Input in Haggis is similar to pseudocode in that you state the data type of the input the program is receiving and also where the input is coming from, like so: :RECEIVE <variable that will store input> FROM <INPUT DEVICE> The optional typing for a declaration may also be used, for example :DECLARE number AS INTEGER INITIALLY FROM KEYBOARD


Output

Outputs in Haggis can be written similarly to inputs. :SEND TO For example: *SEND meaningfulName TO DISPLAY


Arithmetic calculations

SET is used to assign the result of calculation. For example: :SET number TO 32*6 This is another form of assignment.


Procedures / functions

A procedure is a kind of sub-program within a program. It allows the sectioning of code to make it more readable and easier to work with. You must remember to end the procedure as shown below.
PROCEDURE ( , ...)
   Haggis Commands
END PROCEDURE


Operations

Haggis includes all the operations you would expect from a programming language to be able to carry out calculations and logical operations alike. For INTEGER and REAL data types, the following operations are possible. *“-” is subtract *“+” is add *“*” is multiply *“/” is divide *“^” is exponent For INTEGER data types alone, the
modulo In computing and mathematics, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another, the latter being called the '' modulus'' of the operation. Given two positive numbers and , mo ...
is possible which is written as MOD. Comparison operators: *“=” is equals *“≠” is inequals *“<” is less than *“>” is greater than *“≤” is less than or equal *“≥” is greater than or equal Logical operations: *“AND” is Conjunction *“OR” is Disjunction *“NOT” is Negation


Defining a class

Defining a class in Haggis uses the syntax CLASS IS METHODS END CLASS . There are various methods you can declare in Haggis such as:
    CONSTRUCTOR
        The users' Haggis code will then go here.
    END CONSTRUCTOR

    FUNCTION () RETURN 
        The users' Haggis code will then go here.
        RETURN THIS 
    END FUNCTION
    “THIS” is used to reference the current object invoking the method.

    PROCEDURE  ()
        The users' Haggis code will then go here.
    END PROCEDURE


Application and uses

Haggis was originally implemented and then expected to be used in the following ways. The students would be taught how to code in a programming language that the teacher has selected. The students would then make plans in a pseudocode format in a higher level of language than the code itself. Once the students felt comfortable with writing pseudocode they would then be introduced to Haggis as it is the language used in exam texts. Haggis was implemented in this way because research has shown the ability to understand programs is essential to developing further programming skills. Courses run by the SQA (National 5 and Higher) both include outcomes that require students to have this ability. Because Haggis is so easy to understand and pick up, it has been used in exam texts. It is noted that students were and never will be asked to write any code in Haggis during an exam, they are only required to be able to read and understand it.


Problems

There have only ever been a very small number of problems with Haggis. None are to do with the language itself but more to do with the way students view it. The first is that students had no idea why they were being taught to write a completed computer program in two languages. The other is that they were mixing up the two languages that they had been taught and were often getting syntax wrong because they were being taught the two languages at the same time which was causing some minor confusion.


Observation

Haggis was observed by the creator and was found to be used in the following ways. Haggis was being used as a planning language for the computer programs that students were being asked to create. After students had been asked to refine their code through several planning stages, a final plan was made using Haggis. After this final plan is made, the Haggis code would then be transferred into a real programming language that is specified by the teacher. This method is effective in increasing students skills as mentioned earlier to give them as much preparation as possible for the exam for when they will see Haggis applied in a context.


References

{{reflist


External links


Quintin Cutts Web PageSQA Online Haggis Parser
Programming languages Education in Scotland