Ada (the language), is not the big player on the programming block these days. In 1997 the DoD1 cancelled their rule that you had to use Ada when working for them. Developers in commerce had always found Ada hard to work with and often preferred other languages. There are hundreds of other languages used in industry and by researchers. How many can you name?
Here are some fun clues about different languages. Can you work out their names? (Answers at the end.)
A big snake that will squash you dead.
A famous Victorian woman who worked with Babbage.
A, B, __
A, B, __ (ouch)
A precious, but misspelled, thing inside a shell.
A tiny person chatting.
A beautiful Indonesian island.
A french mathematician and inventor famous for triangles.
Today, the most popular programming languages are, well we don’t know, because it depends when you are reading this! Because what is fashionable, what is new is always changing. Plus it’s hard to agree what ‘the most popular’ means for languages (and pop stars!). Is it the most lines of code in use today? The favorite language of developers? The language everyone is learning? In July 2015 one particular website rated programing languages using features such as number of skilled software engineers who can use the language; number of courses to learn the language; search engine queries on the language and came up with the order.
1) Java
2) C
3) C++
4) C#
5) Python
Where is Ada? 30th out of 100s! The same website had shown Ada (the language) as 3rd top in 1985! What a fall from grace.
But have no fear, Ada still survives and lives on in millions of lines of avionics2, radar systems, space, shipboard, train, subway, nuclear reactors and DoD systems. Plus Ada is perhaps making a comeback. Ada 2012 is just being finalised, heralded by some as the next generation of engineering software with its emphasis on safety, security and reliability. So Ada meet Ada, it looks like you will be remembered and used for a long time still.
Github is a place where lots of programmers now develop and save their code. It encourages programmers to share their work. A kind of modern day, crowd sourced ‘mass of shared facts’ but coders would probably not say they did this just to ‘amuse their idle hours’. Popular coding tools on this platform are JavaScript. Java, Python, CSS, PHP, Ruby, C++. Ada doesn’t really feature, well not yet.
What was Ada Lovelace thinking about when she wrote: “If amateurs of either sex would amuse their idle hours with experiments on this subject, and would keep an accurate journal of their daily observations, we should have in a few years a mass of registered facts to compare with the observation of the scientific”.
Yes, crowdsourcing science experiments! Now we call it Citizen Science. She had just read a book by a Baron von Reichenbach on magnetism in which he had suggested a whole host of experiments, such as moving magnets up and down a person’s body, showing people magnets in the dark, and holding heavy and light magnets and asking them if they felt any sensations. She could see that he had some great ideas, but she was not convinced by his examples alone.
Ada was not the only Victorian to ask the general public for help collecting data. Charles Darwin, the Origin of Species man, wrote to gardeners, diplomats, army officers and scientists across the world asking for information about the plants they grew and the animals (including people) they saw. This all helped him build up the concrete evidence that natural selection was the way evolution works. People even sent him gifts of live animals in the post. A Danish gentleman sent him a parcel of live barnacles. When they did not arrive on time, Darwin, desperate to dissect the species, panicked and got ready to offer a reward in the Times newspaper. Luckily they arrived intact, fresh and not too smelly!
Today we might take part in the RSPB’s Big Garden Bird Watch1, contribute to a blog, ‘favourite’ or ‘like’ a post on social media or vote for your favorite performer in a talent show. We participate, and ‘amuse our idle hours’ sometimes in the pursuit of science, sometimes not. Public research is a big new topic, with governments and companies looking to use people power. Innovations such as shared mapping systems ask users to upload details about a place, add photographs, rectify mistakes. Wikipedia is sourced by volunteers, with other volunteers checking accuracy. Galaxy Zoo volunteers even found a whole new planet that orbits four stars!
What would Ada be asking us to research? Test your own DNA and send in the results? Measure air quality and keep a record on a central database? Build your own ‘find a barnacle’ app? But rather than writing a journal or sending a parcel of barnacles, you would log it on line, click a link or design your own survey. Ada’s computers are in on the act again.
Why not find a Citizen Science project on something you are interested in. Sometimes called public science or science outreach projects they might be run by local universities, museums, your council, charities or through crowdsourced internet projects such as www.zooniverse.org. Share what you do with others and spread Ada’s word to be a modern day volunteer.
Jane Waite, Queen Mary University of London
23-25 January 2026: RSPB Big Garden Birdwatch – “Spend an hour watching the birds in your patch, between 23 and 25 January, and record the birds t allhat land.” You can also get your school involved in the Big School’s Birdwatch 2026. If you’re reading this after 25 January 2026 make a note in your diary to remind you to check next year! ↩︎
If, by Rudyard Kipling is an inspirational poem that was voted the UKs favourite poem in the 1990s. It consists of a series of lines that start with If. What If, by Benjamin Zephaniah is a more subversive poem modelled on the original.
If statements, of course, are a really core part of programs so are these poems, given they are all about IF, algorithms? The use of If here isn’t quite the same as a pure computational one as seen in programs. For a start, it doesn’t follow the structure of a computer science IF statement. Here are a few lines:
If you can keep your head when all about you
Are losing theirs and blaming it on you,
If you can trust yourself when all men doubt you,
But make allowance for their doubting too;
...
In programs, an IF statement has a specific structure. It consists of a test of something that is true or false but then gives a specific action to take when the statement is true. The lines
you can keep your head when all about you are losing theirs AND blaming it on you,
is more or less such a true or false statement. Either you can keep your head or you can’t. This though ignores the possibility of you sometimes losing your head and sometimes not. The poem presumably means to say that you must ALWAYS keep your head. What exactly does “when” here mean too? The reason we do not use English when writing programs is the lack of clarity of what is actually meant. Programs are mathematically precise in their meaning. They do only have one possible meaning (and that is the point). this is also a potential issue of writing programs by instructing AIs over what you want in English!
This boolean expression (something that evaluates to true or false) also uses a logical connective AND just like in a program – you must both be keeping your head AND people must be blaming it on you for the whole to be true. If they are both true then the action that follows is taken, but if they aren’t both true the poem says nothing about you!
Another issue in If, is that this test / boolean expression is not immediately followed by an action to do when it is true. The action comes right at the very end of the poem
... Yours is the Earth and everything that's in it, And - which is more - you'll be a Man, my son!
This comes after a whole series of these partial IF statements. To make it more clearly like a program you would add a more explicitly IF-THEN structure, which is the equivalent of putting ANDs between all the tests. In a program that would be written more like the following:
IF you can keep your head when all about you Are losing theirs and blaming it on you, THEN IF you can trust yourself when all men doubt you, But make allowance for their doubting too; ... ... THEN Yours is the Earth and everything that's in it, And - which is more - you'll be a Man, my son!
Only if all the tests are true does the final action get taken. Though it isn’t really an action, it is more an assertion that something else is true – “the Earth is yours”, rather than “we give you the Earth”. (Also that final And is no longer a logical connective!)
Poems like this could be made more explicitly computational though. For example, a slightly more computational version might be:
IF you can keep your head when all about you Are losing theirs AND blaming it on you THEN I will thank you, giving you a pay rise too ...
A love poem in this vein might start
IF you are a snail THEN I will become your shell. IF you are a ...
This leads on to the idea of pseudocode poems, that use other computational constructs. More of that to come.
To do …
Write your own poem in this style with true/false questions followed by specific actions, modelled on the computational version of IF. It could be a reworking of If itself or a completely different poem.
Back in 2005 we published Issues 1 and 2 of the CS4FN (Computer Science For Fun) magazine and there were two short articles in the 2nd issue – “Future proof” about the change from physical copies of music and films (such as CDs and DVDs) to listening and watching on streaming services and “What do you think is most likely to disappear next?” where we wondered which other technologies might still be around in the future.
Future Proof Bill Gates believes CDs and DVDs have had it. It won’t be long before the whole back catalogue of music fits on a device in your pocket: “It’s going even faster than we expected…Five years from now people will say ‘What’s a CD? Why did you have to go to the case and open something up and you couldn’t sequence it your own playlist way?’ That will be a thing of the past. Even videos in the future will either be on a disk in your pocket or over the Internet, and far more convenient for you.”
Bill Gates, Chairman and Chief Software Architect, Microsoft, speaking in 2005.
It’s certainly true that most music and films can be streamed but they may not feel as permanently available as physical copies. On the release of his film Oppenheimer film director Christopher Nolan said1 “There is a danger these days that if things only exist in the streaming version, they do get taken down”. Netflix UK recently told me that Star Trek: The Next Generation would disappear from its listings on the January 8th 2026. I’m sure it will return in the future, but perhaps I need to buy the box set of DVDs to catch up with all the adventures.
Though it does also depend on having the right technology to play a physical copy of the thing – would you know how someone could play a DVD, CD, VHS (video tape) or cassette (audio tape)? Records on vinyl have certainly been making a comeback too…
Our second short article was even shorter and asked readers to vote (in 2005)…
What do you think is most likely to disappear next? (Or which of the following items might survive into the future?)
Fixed phones (land lines)
Cables
Written signatures
Loose change
Wrist-watches
Paper
Physical shops
Calculators
Radios
Possibly 21 years since 2005 is not quite far enough into a future where all of these have disappeared but you can certainly see that the way these things are used has changed significantly.
Imagine it’s now 21 years in the future (or 42 years since 2005)… pick one item that you think is no longer in use. Click the blue button containing the item that you think won’t be around in 2047.
What other technology/ies are you using today that someone born now might not recognise in 21 years time?
– By Jo Brodie, Paul Curzon and Peter McOwan, Queen Mary University of London
Computer scientists and mathematicians can be poets too, even writing poems about computation. One of my favourite poems is about recursion and was written by the Victorian logician Augustus De Morgan who is famous for his laws of boolean logic that are a mainstay of reasoning about boolean tests in programs.
Great fleas Have Lesser Fleas, upon Their backs To Bite’em, And Lesser Fleas Have Lesser fleas, And So, Ad infinitum.
and Those great Fleas, Themselves, In turn Have Greater Fleas To go On; while Those Again have Greater still, And greater Still, And So on.
– Augustus De Morgan
Recursion, solving problems by breaking them into smaller versions of the same problem, is a way of writing programs that repeat just using function call (no while loops or for loops needed). It is a core concept of the programming paradigm, functional programming. Using recursion in a way that goes on forever as in the poem leads to non-terminating programs.
De Morgan was also Maths tutor of Victorian mathematician and computer scientist, Ada Lovelace. Her father was the great poet Lord Byron though (philistine that I presumably am) I like De Morgan’s poem better than Byron’s.
De Morgan made the idea of mathematical induction rigorous. It is the basis of how you prove recursive programs (and iterative ones) are correct.
Image by Paul Curzon taken at Tate Modern London at Olafur Eliasson’s “The cubic structural evolution project” exhibition, 2019.
My absolute favourite example of interactive art is Olafur Eliasson‘s “The cubic structural evolution project” back in 2019 at Tate Modern. It was “just” two piles of standard white Lego bricks piled on two tables (but a tonne of Lego between the two …so a LOT of Lego). Anyone visiting the exhibit was invited to sit down and help create a city by building a building … and it was joyfully creative. Kids and adults mixed together building great architectural wonders, big and small, out of the bricks. Sometimes intentionally, but often accidentally, an existing building was demolished, but that was just an opportunity for new amazing buildings to emerge from the rubble. We visited twice that summer, and each time a totally different city was there that had emerged from this constant evolution of building. On each visit we built something new ourselves to add to the ever changing city.
The exhibit took Lego back to its roots – no instructions, no specific creation to reproduce, just the bare building blocks of creativity. You can still buy generic lego sets of course (if not with the same scope as a tonne of bricks). However, the high profile modern Lego sets are now used to build a specific thing designed by someone else, like a Star Wars Tie fighter, a Death Star, a Ferrari, a parrot or perhaps Notre Dame. This is one form of creativity – you are definitely creating something, and doing so gives you an amazing feeling of accomplishment and well-being. I strongly recommend it and of doing similar activities whether doing a tapestry, or building a jigsaw, or … It is good for your happiness and mental health more generally. But you are creating just by following instructions. In computer science terms, you are acting as a computational agent, following an algorithm that if followed precisely guarantees the same result every time (an exact copy of the lighthouse on the box perhaps…). A computer (with a suitably good robotic arm and vision system) could do it. That is the point of algorithms! They take no thought just an ability to follow instructions precisely: the thing computers are good at.
There is another sense we mean when we talk about creativity though and that was the original Lego idea. You have the bricks. You can build anything. It is down to you. Create something new! According to an exhibition on the history of play I went to early construction kits like the original Lego inspired a whole generation of architects to do completely new things with buildings (if you know your architecture think especially Frank Lloyd Wright whose mother bought him educational blocks called the Froebel Gifts, or perhaps Denys Lasdun – I lived in one of his “Lasdun building” block like buildings for a year in my younger days).
This kind of pure creativity is what being a programmer is about. Not just following instructions to create someone else’s creation, but creating your own totally novel, wondrous things from simple building blocks (and you don’t have to be part of the Lego design team to do it either). That is the lesson that collaboratively emerged in Olafur Eliasson’s exhibit over and over again. Just as the inventor of Lego, Ole Kirk Christiansen, in creating the toy went to yet another level of creativity in doing so, Olafur Eliasson did so to in creating the exhibition. They both created the opportunities for others to be creative.
Programming languages are very much like Lego in this sense. They just provide the building blocks to create any program you want. Learn how to use them and you you can do anything if you have the imagination as well as having built the skill. The different constructs are like different kinds of Lego bricks. Put them together in different ways and you create different things. You can stick with the basics and still build amazing creations even without learning about all the libraries methods that act like specialist bricks designed for specialist purposes. And of course the early Computer Scientists who invented the idea of programming languages were being creative in the way Ole Kirk Christiansen and Olafur Eliasson were, creating the possibility for others. Creating possibilities for you.
The Arts are about pure creativity but so is Computer Science…(and when they are brought together by creative people even more amazing things can be created (by everyone).
Beetles are one of the most prolific species on the planet. As the famous geneticist J.B.S. Haldane is supposed to have said: God has an inordinate fondness for beetles. One of the reasons they are so successful is that, unlike us, their skeleton is outside their body, not inside! This kind of skeleton is called an exoskeleton. Humans are now trying to get in on the act. In the computer science version exoskeletons are robots that you wear.
Animal shells
All sorts of animals have evolved all sorts of different exoskeletons. We call the big ones shells. Many insects, like beetles, have exoskeletons. So do crabs, scorpions, snails and clams. Tortoises are particularly interesting as they have both an internal skeleton, like us, and a shell too.
Animals use exoskeletons for lots of reasons. Most obviously it protects them from predators. It can also help stop them drying out in the sun, and stop them getting wet in the rain. They are used by some animals for sensing the world, and help animals like locusts to jump. Some tortoises and armadillos use them for digging and other animals use them to feed. It’s not surprising, with so many uses that there are a lot of them about.
Human shells
Generally, exoskeletons seem like a pretty good idea! So it’s not surprising that we humans want them too. A suit of armour is actually just a simple version of an exoskeleton designed to protect a knight from ‘predators’. It’s not much different to a tortoise protected inside its shell. The difference to the ones humans make now is our modern exoskeletons are powered and controlled by computers. They really are a robot you wear. They react to your movements.
As with animals’ shells, powered exoskeletons help humans do all sorts of things, not just act as armour. By being powered they give us extra strength, allowing us to lift weights far heavier than we could otherwise, and can turn our small movements in to larger ones. That means they can, for example, help people who have problems moving about to walk (see ‘The Wrong Trousers’) or help nurses lift patients in and out of bed. They are used by surgeons to do operations when they are in a different place to the patient, removing the shakiness of their hands, and by rescue workers working in dangerous situations. There are even ones designed to help astronauts exercise in space. They make movement harder rather than easier to force them to exercise despite the lower gravity.
All in all, copying beetles, but with our own computing twist, seems like a pretty good idea.
The Knights Templar were a 12th century order of catholic warrior monks, more accurately if convolutedly called “The Poor Fellow-Soldiers of Christ and of the Temple of Solomon” though they weren’t exactly poor. In addition to their original role of protecting catholic pilgrims heading to Jerusalem from robbery and murder, they also acted as a kind of international banker to support their main role. They laid some important foundations of modern international banking in the process. In particular, they invented a way to move money (or gold) around safely, without ever actually moving it anywhere. That sounds like a magic trick! Did they use some supposed mystical magic powers to do this? No, they kept the actual money given to them in the nearest of their large network of 1000 or so headquarters and forts around the continent. The money didn’t have to move anywhere. They then gave the person a note to hand in at their headquarters in another country. It promised that the Knights there would give them the equivalent amount from their money store when asked and given the note. The Knights there just swapped them the money for that note. This worked as long as they had a suitable store of money in each location, which of course would be topped up each time someone wanted to move money from that point. This is a simple version of how international banking works now. A British 20 pound note just promises to pay the bearer an equivalent amount, and without that promise (and people’s belief in it) it is just a piece of paper. It is just a similar promissory note, except people now just swap notes, treating it as money in its own right. Similarly, the banks don’t actually move any gold or other physical form of money about when you pay a shop with your debit card or banking app. They just move information equivalent to those promissory notes embodied in the transaction, around a network (though a computer one rather than a network of forts connected by roads).
There is a problem though with moving money from one person to another in this way using notes. If someone steals the note then it is potentially as valuable to them as actually stealing the chest of gold left in the original fort (just as stealing a 20 pound note is). In the Templar’s time the thief would just need to take it to a Templar headquarters and swap it for money just as the original owner would have done (a bit risky perhaps, given how fearsome the Templars were, but potentially possible!). Worse though, without a system to protect from this kind of attack, a thief could copy the note and then ask for the money repeatedly!
However, the Templars are know to have used encryption in their communications. The notes may therefore have been encrypted too and if so that would have made them useless if stolen. Banks now encrypt all those messages that move money about computer networks for the same reason. If only the Templar’s could read their notes (as only the Templar’s knew the key to their code), then only they could know it even was promising money. That doesn’t fully make it secure though, perhaps a thief could guess it was such a note, and if so what is to stop them then trying to cash it in (apart from the risk of being wrong). You would need something more. A simple possibility is the person with the note would need to know the encrypted amount that was contained somewhere within it. If they didn’t ask for the right amount then they couldn’t have handed over the money in the first place. They would reveal themselves as a thief!
Modern banks have to deal with similar problems even though modern financial transactions are all encrypted. Simple encryption alone is still not enough, protocols (special algorithms) are needed to prevent wide ranging kinds of attack being possible. Banks also need to use better ciphers than those from the Middle Ages, as today we can quickly crack ciphers as simple as the Templar Cipher. Banking is all done differently in detail today, but the ideas behind what is done and why are the same.
Can you crack the Templars’ cipher and decrypt the message below? One way might be using frequency analysis. The most common letters in English are likely (if not definitely) the most common in the message. E is most frequent in English, so which symbol might stand for E? Frequency analysis had been known for several hundred years before the Templars used ciphers (at least by the Arabs, though the Templars weren’t exactly their friends!), so it is actually possible even then that the Templars’ messages might be cracked, unknown to them. It was an Arabian scholar called Al Kindi, who actually invented frequency analysis (or at least was the earliest known person to write about it in his manuscript “On Deciphering Cryptographic Messages”.) Another way to crack the code might be to look for cribs – what words might be included in the message if it is a promissory note? Using both together may give you a good chance of decrypting the message. If you can’t crack their code (there is a big clue in this article), the key is given at the end if you scroll down. Use it to then decrypt the message.
Following algorithms to draw nature can lead to natural looking pictures of all all sorts of things: from trees to snowflakes. It is one way computer generated imagery (CGI) scenery is created for films and games. You can write computer programs to do it if you have programming skill, but it can be just as fun (and more stress-relieving) to just doodle algorithmic pictures by hand – you act as what computer scientists call a ‘computational agent’ just following the algorithm. Here is an example Doodle Algorithm to draw a snowflake.
The DoodleDraw Algorithm
1. Draw a Black rectangle
2. Draw a SnowflakeHex in the middle of the black rectangle.
3. DoodleDraw a.Hexagon Snowflake
To Draw a SnowflakeHex:
1. Draw a white hexagon with white lines sticking out from each corner (as shown).
To DoodleDraw a Hexagon Snowflake:
1. IF happy with the picture THEN STOP
ELSE
1. Pick an existing SnowflakeHex and pick a line on it.
2. Draw a new smaller SnowflakeHex on that line.
3. DoodleDraw a Hexagon Snowflake.
Image by CS4FN
The doodle this led to for me is given below… does it look snowflake-ish? Now follow the algorithm and draw your own, just like snowflakes every drawing should be different even if following the same algorithm as we include random steps in the algorithm.
Image by CS4FN
Different algorithms with different starting shapes give different looking trees, grasses, ferns, snowflakes, crystals,… Often nature is following a very similar recursive creation process, which is why the results can be realistic.
Try inventing your own doodle art algorithm and see how realistic the drawings you end up with are. First try using a slightly different starting picture to ours above (eg a hollow hexagon instead of a filled in one, or skip the lines, or have more lines, or have a different central image to the one that is then replicated…and see what you end up with. Find lots more ideas for doodle draw algorithms on our DoodleDraw page.
Next time you find yourself doodling in a meeting or lecture, invent your own doodle draw algorithm, draw an algorithmic doodle, develop your algorithmic thinking skills and at the same time explore algorithms for drawing nature.
Programming languages have lots of control structures, like if-statements and while loops, case-statements and for loops, method call and return, … but a famous research result in theoretical computer science (now called the structured program theorem) says you can do everything that it is possible to do with only three. All those alternatives are just for convenience. All you need is one way each to do sequence; one way to do selection, and one way to do iteration. If you have those you can build the structure needed to do any computation. In particular, you do not need a goto statement! We can explore what that means by just thinking about instructions to build Lego.
What do we mean by a control structure? Just some mechanism to decide the order that instructions must be done for an algorithm to work. Part of what makes a set of instructions an algorithm is that the order of instructions are precisely specified. Follow the instructions in the right order and the algorithm is guaranteed to work.
Goto
First of all, Lego instructions are designed to be really clear and easy to follow. The nice folk at Lego want anyone to be able to follow them, even a small child and manage to accurately build exactly the model shown on the box.
What they do not make use of is a Goto instruction, an arbitrary jump to another place, where you are told, for example, to move to Page 14 for the next instruction. That kind of jump from place to place is reserved for Fighting Fantasy Adventure Books, where you choose the path through the story. They jump you about precisely because the aim is for you to be lost in the myriad of potential stories that are possible. You just don’t do that if you want instructions to be easy to follow.
The structured program theorem provided the ammunition for arguing that goto should not be used in programming and instead structured programming (hence the theorem’s name) should be used instead. All it actually does is show it is not needed though, not that its use is worse, though the argument was eventually won, with some exceptions. For programs to be human-readable and maintainable it is best that they use forms of structured programming, and avoid the spaghetti programming structures that goto leads to..
Sequencing
The main kind of control structure in a booklet of Lego instructions is instead sequencing. Instructions follow one after the other. This is indicated by the pages of the booklet. On each page though the instructions are split into boxes that are numbered. The boxes and numbers are the essential part of the control structure. You build the Lego model in the order of the numbered boxes. The numbering provides a sequencing control structure. Programming languages usually just use the order of instructions down a page to indicate sequencing, sometimes separated by punctuation (like a semi-colon), though early languages used this kind of numbering. The point is the same, however it is done, it is just a mechanism to make clear the order that the instructions are followed one after another, i.e., sequencing.
Parallelism and time-slicing
However, with lego there is another control structure within those boxes that is not quite sequencing. Each box normally has multiple pieces to place with the position of each shown. The lego algorithm isn’t specifying the order those pieces are placed (any order will do). This is a kind of non-deterministic sequencing control structure. It is similar to a parallelism control structure in programming languages, as if you like building your Lego model together with others, then a different person could choose each piece and all place the piece together (parallelism). Alternatively, they could place the pieces one after the other in some random order (time-slicing) and always end up with the same final result once the box is completed.
Is this necessary though? The structured program theorem says not, and in this case it is relatively easy to see that it isn’t. The people writing the instruction booklet could have decided an order themselves and enforced it. Which order they chose wouldn’t matter. Any Lego instruction booklet could be converted to one using only sequencing without parallelism or time-slicing.
Iteration
Image by CS4FN after Lego instruction iteration
Iteration is just a way to repeat instructions or sub-programs. Lego instructions have a simplified form of repetition which is the equivalent of a simple for loop in programming. It just says that a particular box of instructions should be followed a fixed number of times (like 3 x meaning make this lego sub-build three times). With only this way of doing iteration lego instructions are not a totally general form of computation. There are algorithms that can’t be specified in Lego instructions. To be good enough to play the full role in the theorem, the iteration control structure has to have the capability to be unbounded. The decision to continue or not is made at the end of each iteration, You follow the instructions once, then decide if they should be followed again (and keep doing that). Having such a control structure would mean that at the point when you started to build the lego construct to be repeated, you would not necessarily know how many times that Lego construct was to be built. It’s possible to imagine Lego builds like this. For example, you might be building a fairytale castle made of modular turreted towers, where you can keep deciding whether to build another tower after each new tower is completed. until the castle is big enough. That would be an unbounded loop. An issue with unbounded loops is they could never terminate…you could be eternally damned to build Lego towers to eternity!
Selection
The final kind of control structure needed is selection. Selection involves having a choice of what instruction or subprogram to do next. This allows an algorithm to do different things depending on data input or the results of computation. As most lego sets involve building one specific thing, there isn’t much use of selection in Lego booklets.
However, some lego sets do have a simple form of selection. There are “3 in 1” sets where you can, for example, choose to make one of three animals by choosing one of three instruction booklets to follow at the start.
To be fully computationally general there would need to be choice possible at any point, in the way repetition can appear at any point in the booklet. It would need to be possible for any instruction or block of instructions to be prefigured by a test of whether they should be followed or not, with that test and arbitrary true/false question.
Again, such a thing is conceivable if more complex Lego builds were wanted. Building a fairytale castle you might include options to choose to build different kinds of turret on top of the towers, or choose different colours of bricks to make rainbow towers, or… If this kind of totally general choice was provided then no other kind of selection control structure would be needed. Having such instructions would provide a level of creativity between those of fixed sets to build one thing and the origianl idea of Lego as just blocks you could build anything from (the sets would need more bricks though!)
Sequence, Selection and Iteration is enough (but only if powerful enough)
So Lego instruction booklets do include the three kinds of control structure needed of sequence, selection and iteration. However, the versions used are not actually general enough for the structured control theorem to apply. Lego instructions with the control structures discussed are not powerful enough to be computationally complete, and describe all possible algorithms. More general forms are needed than found in normal Lego instructions to do that. In particular, a more general version of iteration is needed, as well as a verion of selection that can be used anywhere, and that includes a general purpose test. All programming languages have some powerful version of all three control structures. If they did not they could not be used as general purpose languages. There would be algorithms that could not be implemented in the language.
Just like programming languages, Lego instructions also use an extra kind of control structures that is not actually needed, It is there just for convenience, just like programming languages have lots of extra control structures just for convenience too.
Sadly then, Lego instructions, as found in the normal instruction booklets are not as general as a programming language. They do still provide a similar amount of fun though. Now, I must get back to building Notre Dame.