Sunday, November 9, 2014

Coding hard boiled eggs

How would a software coder describe the recipe to make hard boiled eggs?




The procedural coder:


- Take a saucepan
- Put water in the saucepan
- Put the saucepan on the stove
- Turn on the stove to maximum
- Wait for the water to reach boiling temperature
- Put three eggs in the boiling water
- Wait 3 minutes
- Turn off the stove
- Take the saucepan
- Empty boiling water into the sink
- Take the first egg, be careful full it's hot
- Roll the first egg on the kitchen counter to crack the shell gently
- Remove completely the shell from the first egg
- Put the first egg on a serving plate
- Take the second egg, be careful full it's hot
- Roll the second egg on the kitchen counter to crack the shell gently
- Remove completely the shell from the second egg
- Put the second egg on a serving plate
- Take the third egg, be careful full it's hot
- Roll the third egg on the kitchen counter to crack the shell gently
- Remove completely the shell from the third egg
- Put the third egg on a serving plate
- Voilà, enjoy!


The object-oriented coder:


- On a stove, in a saucepan, put water
- Turn on the stove to maximum
- When the water is boiling, on the stove, in the saucepan, in the water, put three eggs
- After 3 minutes, turn off the stove
- Empty the water, from the saucepan, on the stove, into the kitchen's sink
- For each egg, in the saucepan:
- Be careful, it's hot
- Roll it on the kitchen counter
- When the shell, on the egg, is cracked, remove completely
- Put it on a serving plate
- Voilà, enjoy!


The delegate-oriented coder:


- You need a stove, a saucepan, water, a kitchen sink, a kitchen counter, a serving plate and three eggs
- Turn on the thing that can heat to maximum with the thing that was filled with stuff that can boil
- When the event where the result of boiling has been reach, add the items that can be cooked in the stuff that is hot enough to cook them
- After a while, set to 3 minutes, remove the stuff that was boiling and put it in the thing that can dispose of it
- For each item, in a container, roll it on the thing that is hard enough to crack the external stuff of the item. At the same time, be careful as a warning message and it has been set that it can be hot.
- In the event that the item is cracked enough, remove the outer thing completely and put the item in something that can be used to serve for a meal
- In the event that that everything is done, Voilà and at the same time, Enjoy!
- When the items are cooked, turn off the heat source





Which one are you?

Patrick Balleux