Here’s the first idea in programming:
We build incredibly complex results from combining lots of simple instructions.
Idea number two is that:
The order of those instructions is incredibly important.
So, imagine we're following a basic recipe with just 10 steps to it.
Fig 1.3.1: A basic recipe
It's simple enough. But supposing we take just two of these steps where we add four eggs and combine and then bake for 40 minutes at 350 degrees. We don't change anything about these instructions. We just put them the wrong way around, that is, bake for 40 minutes, then add four raw eggs and combine. One result is going on a plate and the other is going in the garbage!
So even though each instruction or step might be well-defined, they're also often dependent on each other. The right sequence is the difference between a result that works and a result that doesn't.
So, if you understand the idea that to write a recipe, one that other people could follow reliably, you would have to think it through. You'd have to focus on exact quantities. You'd have to break it into small steps and have those steps in the right order, and you'd probably have someone test it to make sure you didn't forget something.
It's the same process we need in programming: to think through a larger idea, break it into small steps (those individual instructions), make sure the amounts are correct, and the sequence is exact so we can tell the computer to do it again and again a million times a second if we need to.
Unlike a recipe where we do have some flexibility about how to phrase it for human beings to understand, we must now write our instructions in a way that the computer understands using a programming language. We have a lot of options for that. So, let's see a few them.