One pseudocode to rule them all?

Well met, generous reader. It’s been a while.

As you can probably tell from the total lack of posts, I don’t have much free time. I now work four days a week, and then I work even harder the other three days, looking after my son. My free time is largely spent sleeping to survive, so time where I am both awake and not in charge of a toddler no longer exists. He’s the best thing ever, but having a child has unceremoniously shattered who I thought I was into a million pieces and I haven’t quite finished gluing them back together again yet. For the people who have encountered the jagged edges of this recently, I’m sorry. This is my attempt to claw back something that makes me “me”, and not just “someone’s mum”.

Reader: Oh Codeboom, it’s just you rambling on about life. We were afraid it was a blog post about something important. Yeah, you know like pseudocode – I just hear that word and I shudder.


Reader: Oooooooh, do it again!

Over the last 9 months or so I have been spending an awful lot of time in dangerously close proximity to pseudocode (and earned the dubious title “Queen of pseudocode” – thanks Dave!) I’m talking specifically about pseudocode of the variety used in A level exams (post-16 for anyone not in the UK), although I’m sure everyone has their own special favourite variety. I should be very clear that I’m not aiming to pass judgement on pseudocode in any particular way in this post – I actually think it has both merits and flaws – but here are some of the things I have discovered.

What even is pseudocode?

Here’s a standard classroom conversation I have had so many times:

Teacher: In the exam, you can write in any pseudocode syntax you like, as long as it makes logical sense to the examiner.

Student: What, so we can just write anything?

Teacher: Well no, you have to make sure it’s sufficiently structured as pseudocode.

Student: OK so what’s the syntax we need to follow then?

Teacher: Well you can use any syntax as long as the structure makes logical sense.

Student: Um, what? I’m just going to write in Python.

Students need a computer science Simon Cowell in their head giving a big red X and “it’s a no from me” to avoid writing things that won’t get accepted. However, here’s the scary bit no one tells beginners – YOU ARE SIMON COWELL. To be able to decide when your pseudocode is sufficiently structured to be proper pseudocode and not what I call “rest of the F-ing owl” code (obviously not to students!), you already have to know what you’re doing. But you’re using pseudocode to…learn what to do.

Why are there so many varieties of pseudocode?

I know, I just said that any syntax of pseudocode is acceptable as an answer in an exam. That doesn’t mean that the people who write the exam will write in any old syntax – they obviously have to standardise so that students will know what to expect. In fact, the pseudocode syntax for the AQA and OCR exam boards is completely and utterly different.


This seems to me like a giant waste of resources – if one teacher creates a programming resource with pseudocode and wants to share it with their teacher friend who teaches a different board, someone has to spend hours re-writing the code so that students are able to practice using the format they will see in the exam. AQA pseudocode also has the symbol for assignment, which as a non-standard character is somewhat antisocial for people producing home made resources.

How does pseudocode cope with implementation details?

If you’re only familiar with one programming language (perhaps Python), you may not have realised that it’s really hard to make one pseudocode that accurately models the implementation details of every language someone might opt to use for A level. Take this example, where the aim is to extract “NN” from the postcode string.

Here it is in OCR flavour pseudocode, where the arguments are the starting position and the number of characters wanted:

postcode = "LLNNLLL"
area = postcode.subString(2, 2)

Here it is in AQA flavour pseudocode, where the arguments are the starting position, and the ending position (inclusive):

postcode ← "LLNNLLL"
area ← SUBSTRING(2, 3, postcode)

…and here it is in Python, where the slicing operator takes the starting position and the ending position (not inclusive):

postcode = "LLNNLLL"
area = postcode[2:4]

This specific situation actually caused me to write a question for students in pseudocode where my own answer to the question was wrong. I appreciate that it’s really difficult to model every possible implementation decision of every language with an exam specification pseudocode, but it’s this kind of thing that gets some people very hot under the collar about what is ‘right’ and what is teaching bad habits.

So should there be one pseudocode to rule them all?

I don’t know. On the one hand, if there was a standardised pseudocode (and yes, I have heard of HAGGIS) then resources could be written by authors in that pseudocode and easily translated into lots of other ‘real’ programming languages. On the other hand, if there is a standardisation of syntax, is it even ‘pseudo’ any more? This post is already long enough and I haven’t even mentioned the pedagogical side of pseudocode vs other methods, but maybe that’s a post for another day. What do you think?

4 thoughts on “One pseudocode to rule them all?

  1. Hi Laura, a wonderful post. I completely empathise with the kid thing. Someone once asked me what my hobbies were or what I did in my spare time, when I told them, “I had a son”. He said “Oh ok”. He understood that spare time was not a concept that existed for most parents!!! My blog is also therefore somewhat sparse these days!

    I was showing my uncle the Little Book of Algorithms. His daughter was studying for IGCSE Comp Sci and she said she’s spent the last 4 months “forgetting Python syntax” and only writing programs in IGCSE’s Pseudocode. This was the most tragic thing we both heard. My uncle is a software engineer and he essentially said, Pseudocode is meant to make sense to the programmer and help them get their thoughts down quickly in their notebook or for their team. If you standardise it, it ruins the whole point; you might as well write your answer in Python. I concurred. In the end, she got an A*, having completed the IGCSE in 1 year but she said she won’t be choosing CS for A-Level. 😦

    We do OCR GCSE and A-Level Comp Sci. For the most-part, I tell my students to write their exam answers in Python. The only thing I teach them that is significantly different is the substring method you’ve mentioned and the For Loops (inclusive stop value in OCR Pseudocode, exclusive in Python).

  2. Nice article. Good to see a comparison of “flavours”. Cambridge flavour is particularly “chunky”. It reads much like old fashioned BASIC, which I expect it is based on. Overall, I’m not a fan of pseudocode – Python is so close to English anyway… (I agree that has pedagogical implications!)

  3. I prefer OCR pseudocode to AQA, but besides outline the algorithm, write a flowchart, and write some code in a language of your choice (likely Python or JS for my students), I think we can live without pseudocode in exams. It scares my students more than any of the actually scary stuff wjen gthey arrive from doing GCSE CS (those thst heave)

  4. Standardisation of pseudocode seems faintly ridiculous. If it’s standardised, we could write a compiler/interpreter for it and use it as an actual coding language.

    The whole purpose of pseudocode is to get your algorithm steps down in a non-ambiguous way. Who cares what ‘syntax’ you use, as long as it’s clearly stated, and there is no room for misinterpreting it. Would OCR / AQA accept Structured English as a loose pseudocode, or is their way the only way?

    Set postcode to the value "LLNNLLL"
    Set area to two adjacent characters of the postcode, starting with the third one
    Show the area to the user

    It’s not ‘code’ as such, but it’s 100% clear and unambiguous, and could be easily translated into any programming language.

    P.S. Good luck with the Laura re-build!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: