A Recipe the Machine Follows
A program is a recipe for a very literal cook. Meet the algorithm, with no code in sight.
A quick note on how we teach here. You won't find equations or numbers in this series, and that is on purpose. The goal is understanding, not arithmetic, so every idea is explained in plain words and simple pictures. When you want the math later, the rest of Internals Decoded is ready for you.
Welcome back. In the first piece we met a kitchen helper that can do exactly what it is told, no more and no less. Then we saw how tiny switches hold all kinds of information, from a simple note to a whole photograph. Now we have the pieces. The helper has a pantry full of on and off switches that represent anything we can imagine. But a pantry, even one full of perfect ingredients, does not make dinner. The helper needs to know what to do with all those switches. It needs a recipe.
A program is nothing more than that recipe. It is a list of instructions written ahead of time that the computer follows step by step. Every app you open, every website you visit, every game you play is, underneath, a long and carefully written recipe that the machine obeys without question. If we can understand a recipe card, we can understand what a program really is.
A recipe card for a very literal cook
Imagine you need to teach someone to bake a cake, but this person has never stepped into a kitchen before. They do not know what flour looks like. They do not know what “mix” means. They have no common sense and no judgement. You cannot just say “make a cake.” You must write down every tiny step in order: open the cupboard, take out the bag labeled flour, scoop one cup, level it with the back of a knife, pour it into the big metal bowl, and so on. If you leave out a step, the cake will be a disaster. If you write the steps in the wrong order, the cake will also be a disaster. The helper will do exactly what you wrote, no matter how silly, because following instructions is all it knows.
A computer is the same kind of helper. Before it can do anything useful, someone has to write down a recipe that is just as precise. The recipe cannot assume the computer knows the difference between a photo and a song. Every small action must be spelled out. The computer will then carry out each instruction in turn, from the first line to the last, unless the recipe itself tells it to jump somewhere else. That is the whole secret. A program is a recipe card for a very literal cook.
More than just straight lines
At first glance, a recipe might look like a simple straight list. Do this. Then do that. Then do the next thing. But the most useful recipes include two extra powers. They can make choices, and they can repeat steps.
Think about a real kitchen recipe. It often says something like “if the butter is melted, add the sugar. Otherwise, keep warming.” That is a choice built into the instructions. The cook checks something, and the recipe branches off in one direction or another. A program can do the same. It can look at a switch that is on or off, compare two pieces of stored information, and decide which page of the recipe to follow next.
Real recipes also ask you to repeat something. “Stir until the batter is smooth” means keep stirring, check the batter, and if it is not smooth yet, stir again. A program can wrap a set of steps in a loop just like that, doing the same few instructions over and over until some condition is met. This tiny idea, repeating a handful of steps many times, is what lets a computer sort through a whole library of books or draw every leaf on a tree without a person having to write out each leaf one by one.
Choices and repeats, stacked together, are enough to build astonishingly rich things out of plain instructions. A video game feels alive not because the computer is thinking, but because the recipe keeps checking what the player presses and repeating little routines to update the screen. An invoice or a receipt that fills itself out on a website is not magic. Beneath it, a recipe is checking numbers, repeating rows, and deciding what appears where.
Seeing recipes everywhere
Now that you know the idea, you will start seeing recipes everywhere in the digital world, even though you cannot read the ingredients. When you tap an icon on your phone, you are handing a recipe to the kitchen helper. That recipe might be small and simple, or it might be made of thousands of smaller recipes that all call out to one another like a cookbook full of well thumbed pages. The helper, remember, does not understand what a message is or why you want to send it. It only knows that some switches must be rearranged in a particular order, exactly as the recipe demands.
Everything a computer does rests on this idea. A website that streams you a video? The recipe reads the chosen video from storage, breaks it into tiny pieces, and sends them across the network one after another, following a plan written long before you pressed play. A search engine? A gargantuan recipe that scans billions of index cards, checks for matches, and lines them up according to a ranking plan. No thought. No feeling. Just a recipe, followed step by step.
The name for a precise set of steps
People who build software have a special word for a careful set of instructions that solves a problem. They call it an algorithm. It sounds fancy, and it can make people feel as if there is something mystical going on. But an algorithm is exactly what we have been describing. It is a clear recipe. A sequence of steps that says “do this, then if that, go here, otherwise repeat these three steps until the answer is clear.” Even the humblest kitchen recipe is an algorithm for making a cake, as long as it is spelled out with enough detail for a literal cook.
From now on, when you hear someone talk about algorithms, you can picture a recipe card in your mind. The word will appear again and again in these Groundwork pieces, and soon you will see how it connects to machines that learn on their own. But at root, it stays a simple idea: a list of instructions, written by a person, for a machine that will follow them to the letter.
Where this is heading
We have now seen how to turn the world into switches and how to hand a recipe to a helper that reads those switches. Until now, a person had to think through every possible situation and write down every single step. That works wonderfully for counting money, filling out a form, or drawing a button on a screen. But what about recognizing a friend’s face in a photograph? Or deciding whether an email looks suspicious? Those problems are far too messy to capture in a handwritten recipe. There are no simple rules that can say “if a pixel is this color and that shape, then this is definitely your dog.”
That crack is where the whole idea of learning sneaks in. It begins with a simpler question: what is a pattern, really? In the next piece, we will look at how patterns hide in the world around us, and why they matter so much for building machines that do not just follow a fixed recipe, but can adapt to what they see. You are about to step onto the path that leads from recipes to something that feels a lot more like learning. Let’s walk it together.