To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Programming fundamentals tutorialAlgorithms & Pseudocode

Pseudocode is often used across the industry as the main method for writing program designs. Whilst it is fair to say it is also often ignored in a lot of software companies, many of the most successful programs have had some kind of pseudocode in their development lifecycle.

What pseudocode is

Pseudocode is a language with extremely loose syntax and yet strong emphasis on semantics. There are deviations from the concept of pseudocode such as high-level reference languages including Quintin Cutts (who read my undergraduate Honours Project) and Greg Michaelson (one of my former lecturers) formalised HAGGIS language for the SQA.

Pseudocode uses very high-level syntax very similar to the English languages (or in fact the native language of the writer such as German or French etc). It attempts to be written with a structure similar to that of a programming language but with syntax that does not bind it to one programming language (thus loose syntax).

Pseudocode
SET x TO 10
WHILE x < 30
  SEND x TO DISPLAY
  SET x TO x + 5
END WHILE
    

Since pseudocode has no actual syntax, this should only be interpreted as the programmer sees fit.

What an algorithm is

An algorithm is a mathematical construct for describing a set of procedures or steps to follow to solve a problem. Since programming can be seen as being a problem solving activity, algorithms are a large part of programming.

An algorithm can also be code itself, though it is often seen as being completely based on pseudocode, the actual fact is that a program is itself an algorithm.

Formal specification

It is often the case that programming languages also have their own formal specification (you can find the ZPE formal specification on the ZPE Documentation page on this website).

A formalised specification or reference specification can be written to ensure that the language compiles as expected - it allows us to develop a written set of requirements for the compiler that can be read easily by a developer and checked to ensure that it works as expected before writing the program.