This article is written like a manual or guide.(May 2017) |
Haggis is a high-level reference programming language used primarily to examine computing science for Scottish pupils taking SQA courses on the subject. [1] Haggis is used as a tool to bridge the gap between pseudocode and typical computer programming. [2]
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, imperative and object-oriented to suit this purpose. [3]
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. [4]
In Scotland, school-level computing qualifications are awarded by the Scottish Qualifications Authority. A decision was made for computing courses that a single choice of programming language 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 which encourages the teaching of reading and understanding code as a core discipline, which should therefore be examined.
Initially, a form of pseudocode 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 which 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 although, 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. [5]
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), Greg Michaelson (Heriot Watt University) and Richard Connor (University of Strathclyde). The aim of developing Haggis was to emphasise 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. [1]
Haggis was first introduced into the Computing Science examinations as part of the Scottish Government's Curriculum for Excellence development programme in the 2013/2014 session in National 5, 2014/2015 for the new Higher courses [6] and into the new Advanced Higher in the 2015/2016 session. [7] 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 form to enhance teaching delivered in another language. [6]
Haggis was designed with 8 core principles in mind [8]
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. [8]
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 to full programming. It was not created with the intention of asking pupils to write it in assessments but provide a uniform language in which to present code examples to students, ensuring that all pupils have a fair understanding and is not hindered by learning a different programming language different to the one exemplified in the assessment. [2]
Syntax and structure in Haggis are very similar to other programming languages and can be easily learned.
DECLARE
, FOR
, WHILE
, etc.(types are normally determined by inference except where this is not possible)
Arrays are included at National 5 level, Records at Higher, and Objects at Advanced Higher.
In some examples in examination papers line numbers are used to allow easy reference; this is not a part of the language however.
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 of who may be reading the code. Once again, this is not a part of the language definition.
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 should be written in lowercase or, if the name is complex, in lower camelCase. 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 capitalised.
For example, variables could be called:
number
meaningfulName
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 allows the user to set values to variables. The syntax is as shown.
SET <variable’s name> TO <value>
SET phrase TO "maybe"
SET number TO 23
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
Outputs in Haggis can be written similarly to inputs.
SEND <variable, value or text> TO <OUTPUT DEVICE>
For example:
SEND meaningfulName TO DISPLAY
SET
is used to assign the result of calculation.
For example:
SET number TO 32*6
This is another form of assignment.
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 <Procedure ID/Name>(<Data Type> <Variable>,<Data Type> <Variable>...) Haggis Commands END PROCEDURE
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.
For INTEGER
data types alone, the modulo is possible which is written as MOD
.
Comparison operators:
Logical operations:
Defining a class in Haggis uses the syntax CLASS <id> IS {<parameters>} METHODS <statements> 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 <Function Name>(<Parameters>) RETURN <Data Type> The users' '''Haggis''' code will then go here. RETURN THIS <Class Property> END FUNCTION '''“THIS” is used to reference the current object invoking the method.''' PROCEDURE <Procedure Name> (<Parameters>) The users' '''Haggis''' code will then go here. END PROCEDURE
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. [2]
Haggis was implemented in this way because research has shown the ability to understand programs is essential to developing further programming skills. [2] 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.
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. [2]
Haggis was observed by the creator and was found to be used in the following ways. [2] 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.
A computer program is a sequence or set of instructions in a programming language for a computer to execute. It is one component of software, which also includes documentation and other intangible components.
Eiffel is an object-oriented programming language designed by Bertrand Meyer and Eiffel Software. Meyer conceived the language in 1985 with the goal of increasing the reliability of commercial software development; the first version becoming available in 1986. In 2005, Eiffel became an ISO-standardized language.
In programming language theory, lazy evaluation, or call-by-need, is an evaluation strategy which delays the evaluation of an expression until its value is needed and which also avoids repeated evaluations.
In computer science, pseudocode is a description of the steps in an algorithm using a mix of conventions of programming languages with informal, usually self-explanatory, notation of actions and conditions. Although pseudocode shares features with regular programming languages, it is intended for human reading rather than machine control. Pseudocode typically omits details that are essential for machine implementation of the algorithm, meaning that pseudocode can only be verified by hand. The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications to document algorithms and in planning of software and other algorithms.
Scheme is a dialect of the Lisp family of programming languages. Scheme was created during the 1970s at the MIT Computer Science and Artificial Intelligence Laboratory and released by its developers, Guy L. Steele and Gerald Jay Sussman, via a series of memos now known as the Lambda Papers. It was the first dialect of Lisp to choose lexical scope and the first to require implementations to perform tail-call optimization, giving stronger support for functional programming and associated techniques such as recursive algorithms. It was also one of the first programming languages to support first-class continuations. It had a significant influence on the effort that led to the development of Common Lisp.
In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following:
In computer programming, a parameter or a formal argument is a special kind of variable used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are the values of the arguments with which the subroutine is going to be called/invoked. An ordered list of parameters is usually included in the definition of a subroutine, so that, each time the subroutine is called, its arguments for that call are evaluated, and the resulting values can be assigned to the corresponding parameters.
In computer science, a pointer is an object in many programming languages that stores a memory address. This can be that of another value located in computer memory, or in some cases, that of memory-mapped computer hardware. A pointer references a location in memory, and obtaining the value stored at that location is known as dereferencing the pointer. As an analogy, a page number in a book's index could be considered a pointer to the corresponding page; dereferencing such a pointer would be done by flipping to the page with the given page number and reading the text found on that page. The actual format and content of a pointer variable is dependent on the underlying computer architecture.
IDL, short for Interactive Data Language, is a programming language used for data analysis. It is popular in particular areas of science, such as astronomy, atmospheric physics and medical imaging. IDL shares a common syntax with PV-Wave and originated from the same codebase, though the languages have subsequently diverged in detail. There are also free or costless implementations, such as GNU Data Language (GDL) and Fawlty Language (FL).
In computer science, type conversion, type casting, type coercion, and type juggling are different ways of changing an expression from one data type to another. An example would be the conversion of an integer value into a floating point value or its textual representation as a string, and vice versa. Type conversions can take advantage of certain features of type hierarchies or data representations. Two important aspects of a type conversion are whether it happens implicitly (automatically) or explicitly, and whether the underlying data representation is converted from one representation into another, or a given representation is merely reinterpreted as the representation of another data type. In general, both primitive and compound data types can be converted.
Skeleton programming is a style of computer programming based on simple high-level program structures and so called dummy code. Program skeletons resemble pseudocode, but allow parsing, compilation and testing of the code. Dummy code is inserted in a program skeleton to simulate processing and avoid compilation error messages. It may involve empty function declarations, or functions that return a correct result only for a simple test case where the expected response of the code is known.
In some programming languages, const is a type qualifier, which indicates that the data is read-only. While this can be used to declare constants, const in the C family of languages differs from similar constructs in other languages in that it is part of the type, and thus has complicated behavior when combined with pointers, references, composite data types, and type-checking. In other languages, the data is not in a single memory location, but copied at compile time for each use. Languages which use it include C, C++, D, JavaScript, Julia, and Rust.
In computing, a procedural parameter is a parameter of a procedure that is itself a procedure.
S-algol is a computer programming language derivative of ALGOL 60 developed at the University of St Andrews in 1979 by Ron Morrison and Tony Davie. The language is a modification of ALGOL to contain orthogonal data types that Morrison created for his PhD thesis. Morrison would go on to become professor at the university and head of the department of computer science. The S-algol language was used for teaching at the university at an undergraduate level until 1999. It was also the language taught for several years in the 1980s at a local school in St. Andrews, Madras College. The computer science text Recursive Descent Compiling describes a recursive descent compiler for S-algol, implemented in S-algol.
In computer programming, an anonymous function is a function definition that is not bound to an identifier. Anonymous functions are often arguments being passed to higher-order functions or used for constructing the result of a higher-order function that needs to return a function. If the function is only used once, or a limited number of times, an anonymous function may be syntactically lighter than using a named function. Anonymous functions are ubiquitous in functional programming languages and other languages with first-class functions, where they fulfil the same role for the function type as literals do for other data types.
In computing science and informatics, nesting is where information is organized in layers, or where objects contain other similar objects. It almost always refers to self-similar or recursive structures in some sense.
SuperPascal is an imperative, concurrent computing programming language developed by Per Brinch Hansen. It was designed as a publication language: a thinking tool to enable the clear and concise expression of concepts in parallel programming. This is in contrast with implementation languages which are often complicated with machine details and historical conventions. It was created to address the need at the time for a parallel publication language. Arguably, few languages today are expressive and concise enough to be used as thinking tools.
Ceylon was an object-oriented, strongly statically typed programming language with an emphasis on immutability, created by Red Hat. Ceylon programs run on the Java virtual machine (JVM), and could be compiled to JavaScript. The language design focuses on source code readability, predictability, toolability, modularity, and metaprogrammability.
In computer programming, a function, procedure, method, or routine is a callable unit of software logic that has a well-defined interface and behavior and can be invoked multiple times.
PL/SQL is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database, Times Ten in-memory database, and IBM Db2. Oracle Corporation usually extends PL/SQL functionality with each successive release of the Oracle Database.
{{cite web}}
: CS1 maint: multiple names: authors list (link)