Coding Is Like Cooking, or How Learning Works

The featured image of this post is the Hainanese Chicken Rice I made right after watching a Youtube tutorial

There are two “major” skills that I have (kind of) successfully learned since I decided to leave my parents’ home in Vietnam and come to a whole different country, thousands of miles away: One of them is definitely coding, and the other is cooking (of course, there are more skills I mastered, you’re not likely to survive independent life with just two new skills, but those two are the ones I am most satisfied with). From the look of them, the two skills don’t have many things in common: one deals with computers and sciences, the other with food and spices; one wrecks your brain out, the other helps nurturing it, etc., however, what I unexpectedly found out is that the experience I get in learning one thing turns out to be very useful for the other. In this article, I’m gonna point out these similarities of the two journeys, which hopefully can help you guys transform the experience you have in mastering anything else into the same experience with any new field you are trying to master (like coding). Without further ado, let’s start!

Both require that you know the very basic stuffs

If you look at how a professional chef learn a new recipe, you may notice that they catch up on it very fast. Gordon Ramsay can have a talk with a streetfood cook in SouthEast Asia and then replicate the whole dish that the other person has spent years mastering. Same thing goes for an experienced developer who learns to do something new, say, a new language: you may see that the developer skims through a book about the language for five minutes and starts coding immediately, and in about a day, he/she may have already mastered that new language.

How so? Because in the professional levels, people don’t really learn new stuff from the ground. As they have already mastered almost all the elements of the new process, what they really do is look for the really new elements which they don’t have yet known, and link them with what they have already have (kind of like putting a new furniture into a room, vs. building a room to hold that piece of furniture). In a modern (but less descriptive) language, they can learn things faster than rookies because they have the background. A professional chef may need to be explained what steps are needed for making that new dish that he/she has not known how to made, but since they have known how to do every of those steps, the amount of new knowledge they need to acquire is much smaller than if they had forgotten all their prior knowledge and start from the real scratch.

Think about how you would make a scamble egg. For those people who cook, the dish might be one of the easiest things on earth to do. It takes maybe five minutes, and contains only “simple” steps that “anyone” can read through and replicate in some minutes. Still, if you think carefully about every little detail of the scamble-egg-making process, you may see that it’s still very easy to screw it up: the eggs need to be broken with an appropriate force: not to hard that the inside of it might spread out every where, but also not too soft that they won’t crack opened. You also have to be careful not to leave any tiny piece of eggshell inside the yolk, not to put too much or too little cream, etc. The same thing happens with every other “simple” dish, there are always things that would take most of us several tries to do it right if we have never cooked before. However, once you have mastered some basic cooking skills, you will start to see that what constitudes scamble eggs making is simple a sequence of steps that are commonly seen in several different dishes, and that’s what makes it easy: you’re likely to know all the steps to make scramble eggs even if you’ve never made the dish.

Same logic goes with learning how to program: an experienced programmer picks up things faster because they can link what they’ve already known with the new things they are working with. An example can be seen when one has mastered one programming language and starts with the second one: while the syntax might be totally different between the two, there are concepts that they share: classes, functions, loops, data structures, etc. Most of the times, what the developers have to do before start writing real code is just figuring out how to do those things they have known in the new language; the mastering part may come much later.

You need fast feedback

Just like with learning to do anything, in both cooking and coding, feedbacks are really important. They help identifying most critical points, which required the least effort to solve but would improve the most in performance quality.

In the early stages, these feedback are quite easy to see: when you code, those will be the syntax or logic errors that the compilers will throw (They are sometimes quite hard to read, especially for newcomers, but it’s still relatively easy to detect errors if those errors are noticed by the compilers); when you cook, it’s likely that your food is too salty or spiceless (which means it needs more seasoning), over or undercooked, etc. However, when you reach a higher level, the errors you make will start to be more subtle, and the feedbacks will be less likely to be noticed. If you’ve ever watched the MasterChef show, you may have seen that the judges normally can point out several flaws of the seemingly flawless dishes, something most of us non-professional are not likely to notice. Same phenomenon happens when I code: sometimes I may have spent hours looking back and forth a piece of code I’ve written and find no errors, but once I submit the code, a more experienced colleague will still be able to point out pitfalls in the code that may harm the program’s performance in the future. All in all, no matter if the mistakes you made are pointed out to you by the computers, by someone closed to you, or by some guru you met on Internet, what’s important is that these mistakes are pointed out, and as you fix them, you learn one or two new things.

I want to emphasize this: making mistakes are good, but only if those mistakes are detected. That’s why I think it’s important to have some sort of mentors that you can turn to and ask for opinions, if you are really serious in becoming a professional developer (or if you’re serious in becoming a masterchef, though in that case I’m not sure I should give you career advice).

It’s perfectly fine to start with some Youtube tutorials

In my opinion, we are very lucky to be living in an era where we can learn almost everything on our own. It’s especially true for those fields like cooking or coding, where thousands of people have spent millions of hours making online tutorials for us (Of course, it doesn’t mean every tutorial is good, but let’s talk about how to select the best tutorial in another time). Those tutorials will serve you well at least up to the point of most basic skills and concepts, which everyone has to cover. Most of the time, those are enough for you to make a working solution (in coding), or an edible dish (i.e. a dish that tastes about 80% similar to what you want to make in the first place), and if you don’t intend to go professional, that’s good enough. Up to this day, I still haven’t had any training in cooking, except for those Youtube tutorials.

One thing to notice though: online tutorials are a good source of learning, but they will not work very well unless you make something following the instructions. As human, we sometimes enjoy watching other people doing things instead of doing those things ourselves (that’s why some of us spend hours and days and months watching livestreaming games), but I do, sadly, have to tell you that you will not likely to get good in anything if you don’t start doing it yourself.

So in short, what can we learn from all these similarities?

The purpose of this article is to point out some basic elements of learning, so that if you have mastered any sort of skill (driving, bycling, running, walking, etc.), you can apply your experience in learning something completely new (like coding):

  • The first step in learning anything is to detect some sort of basic skills to get you started. Though it doesn’t apply to every skill, watching (and following) some tutorials might help you covering this step (or at least some of it). (I will have a post about how to select your tutorials later.) One thing to keep in mind is that this step may take a while depending on your prior exposures with the field, so you may need a bit of patience. The need to cover many basic skills beforehands is also one of reasons for the non-linearity of learning, which I have mentioned in a previous post. It gets harder to stick to learning something when you can’t clearly see results of those learning.

  • Once you have a hang of what you’re doing, start making something and ask for feedbacks. The more feedbacks you get, the better your results will go. You are likely to find it most intimiating when you start cooking with no prior cooking experience, just like you won’t be likely to understand all the terminologies mentioned in your first “Hello World” tutorial. That’s totally normal (and fine), and I can guarantee that almost every great programmer starts off that way.

That may sound like I’m oversimplifying things, but in reality it goes exactly like that, though it’s not likely to be easy. Goodluck with your learning and see you next time!

Written by Huy Mai