If You Can Cook , You Can Code
This one is based on my interaction with one of my not very programming loving friend , struggling to choose between couple of IT courses .
With the fashion uprising in IT nowadays you have options to do plenty of such courses , some with language or business studies too . So if you ever get a second thought just consider this.
“I think that i wont be able to program , i am just not good at it . But i really don’t know” , she said .
To which i asked ,
“Can you Cook ? ”
Laughing she replied , “ just normal yeah ”
“ Voila ! So you can code too”
Puzzled , she asked me to elaborate it and tell her if this was a joke .
Programming and cooking has something in very common which we practice every time not knowing how simply it could be explained , or understood by someone who thinks coding is a very complicated task.
These both comprises of steps and procedures in sequence to get desired results .
Yes , and I will say that again but now in more simple terms and with an example .
Lets say i am learning to make an omelette for very first time , so i will take following steps to cook :
- Take all the ingredients required after deciding what to cook (eggs , salt, pepper, butter ,etc ) ; defining and initializing your variables for Class Omelette .
- Put a pan on the normal heat ; This is your main( ) which gets executed and cooks your code .
- Add butter to the pan ; function add (butter) in the main .
- Beat the eggs and salt/pepper according to taste ; function whisk (eggs) and add (salt , pepper) to it.
- add the mix in pan and cook ; add (mix) and cook while x < 4 minutes.
- flip the side of omelette and another couple of minutes ; function flip () and cook while x < 2 minutes .
- Serve ; End of Curly braces and exit with desired output .
Now many of you might be saying something like “I dont like pepper” or “I use milk with beaten eggs” or “I dont flip my omelette” or “this is not how you should code” (Im not talking any language specific or teaching to code , thats for some other day). Again its your code and you have hundred percent freedom to play around with it . Its all upto your taste .
Whats important noting here is the sequences and scopes . Just the way you cant make omelette without beating eggs first you cant code without defining and calling correct functions at right time for your ingredients or to cook your mix in some other pan/pot which is not in the scope of your uncooked eggs .
Saying all this there are plenty of ways i could think of , making it more robust or flexible using OOP concepts and i hope you catch my drift . But its your dish and the more you practice the better cook you will be .
Conclusion of the Story (Ramsay is not the best Coder)
The summary to draw from this is not , If you’re great chef then you’re great programmer . But the more you code the better you get , all it takes is some dedicated hours of practise .
The only reason why we often get confused with programming or think its tough is because we are not mentored correctly .
We are often taught how to code but never why to code and why not !?
Simple things are easiest to learn and hardest to forget , similarly if we could make programming easier to understand then it will be a one step forward for the entire IT industry .