Write an algorithm like a 5 y.o
How do you think a 5 y.o will prepare a sandwich ?
We are talking here about a basic sandwich. Let me define what I call a basic sandwich. A basic sandwich will be a sandwich with 2 slices of bread, a slice of cheese and peanut butter (don’t ask me why I mix cheese with peanut butter 😂).
Most of the 5 y.o I encountered in my life can handle this. How do you think a 5 y.o will handle this ?
At the begining, this will certainly be a mess. Peanut butter everywhere cheese on the floor, slices of bread eaten raw, 😅 don’t worry this is mostly for the “expressive” ones. What is happening on his mind may resemble this.
- Bread, eat bread
- Peannut butter yeah! Let me spread it on my hand and on daddy’s hand.
- Let me smash the cheese in my hand then eat it.
Ok, is true not all of them may react like that, but the point here is that there is actually a series of actions that they will do with the different ingredients. They will write an algorithm in their mind, a messy one, but it’s still an algorithm that works for them. They will eventually act it out if you let them do so.
But that’s not a sandwich!
Yes it’s true, at first trial, he may not do a sandwich. But that’s fine, because the 5 y.o now has a knwoledge of the different ingredients, all he needs to do is polish his mind to get the appropriate algorithm for making a sandwich. How do we polish his mind you may ask ? By training. Trying to get better en better at making sandwiches. The more he gets his hands on doing sandwiches with the right explanations, the more he will make better sandwiches. To finally get this:
- Place bread slice one to the right
- Place bread slice two to the left
- Spread the peannut butter on bread slice one
- Smash the cheese on bread slice two
- Put bread slice one on bread slice two with the peanut butter side on bread slice one facing the cheese side of bread slice two (😅 I know this may sound complex but is just one steps)
I’m proud of you my child! Your first algorithm!
I’m not a 5 y.o
Sure you’re not. But you can at least admit that if a 5 y.o can figure out how to make a sandwich you can figure out how to make one too.
What you have to understand here is that, in the begining, an algorithm is sometimes messy, unstructured and useless for the objectif it wants to achieve. Like the 5 y.o at the begining you may not be get the grasp of it, but naturaly you mind will start doing things with the ingredients. You just need to take time to polish you mind for it to find the right algorithm for the situation you are in.