code – Cooking in Code http://www.cookingincode.com Software developer by day, chef by night Wed, 14 Jul 2010 02:16:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 214944756 Culinary Abstraction: The Story http://www.cookingincode.com/2010/07/13/culinary-abstraction-story/ http://www.cookingincode.com/2010/07/13/culinary-abstraction-story/#respond Wed, 14 Jul 2010 02:16:00 +0000 https://cookingincode.appspot.com/2010/07/culinary-abstraction-the-story.html Read More Read More

]]>
I would like to begin this post with an apology: first for not having written for a few weeks (I was in France…I’ll elaborate in a later post) and second for the nerdliness of this post (well, the name of this blog is Cooking in *Code*). Anyways…moving on.

I got the idea for this post from a discussion I was having earlier today in which I was vehemently disagreeing with the (somewhat preposterous) claim that a good way to improve one’s coding skills is to read books about writing code. In the process of ranting about how absurd this claim was I found an interesting connection between cooking and coding.

The term “abstraction” is commonly used by programmers. It means that instead of diving in and trying to write the whole program in one fell swoop, you break it down into little pieces, write and test each of these and once you have all the little pieces you need, and are (somewhat) certain that they work correctly, you assemble them into the bigger program you were initially trying to write. I rely on abstraction a lot to keep things from getting (too) complicated when I write code but what I realized this morning is that I also abstract my cooking.

In fact, I think culinary abstraction is a brilliant way to go if you (like me) tend to encounter timing and coordination issues when cooking multiple dishes at once. Here’s why: have you ever (bear with me here) watched Martha Stewart cooking some five-course meal and thought “well, yeah, its easy when everything is pre-chopped and pre-measured and layed out in nice little pastel-coloured ceramic bowls”. Well guess what, that’s culinary abstraction: get all the little things figured out first, then, all you have to do is assemble the pieces.

One could argue (lacking a staff of 20 like Martha has), that it doesn’t make a difference if you chop everything now, or just do it as you go, however, I will once again return to the code analogies to explain the difference.

The “holy grail” of code-writing is reusability: If you can write one piece of code, and use it for several tasks (rather than writing new code each time) you not only save yourself the time it takes to write the code but also to maintain and debug it.

Cut to the kitchen. Two nights ago, on my own, I made a three-course Indian meal (recipes to come in a later post). Sounds like a lot of work, but in fact, it didn’t take me more than an hour and a half to make. What I did was this: First I figured out the quantities of garlic, serrano chiles, ginger, onions etc. that were needed for each recipe and chopped them all (if you’re very Martha, and have a major surplus of bowls, you could divide each ingredient up into portions for each recipe…but I just left each one in a bowl and scooped out the appropriate amount as needed). Next, I measured spices. These I did do by recipe, putting all the spices for the fish curry in one bowl, the potato curry in another, and the cabbage in a third. Finally I prepared “recipe-specific” ingredient (cabbage, potatoes, fish).

At this point, everything is ready to be added to the pot, and its just a matter of timing, which, when you’re not distracted by last minute chopping/washing/mixing/measuring etc., is quite simple to manage.

The point here is that if you chop/wash/measure all the ingredients first, you know you have exactly what you need, so you’re free to focus on the actual *cooking* part, and, like coding, not only do you save yourself the pain of last minute surprises (“Crap, we don’t actually have any onions..”), you also save yourself having to wash the cutting board multiple times.

The point here is that a good part of cooking, like coding, is just getting your thoughts in order. And when you approach a new project in either domain, the best thing you can possibly do is fight the urge to dive headlong into it immediately and instead take some time to get organized (it will likely save you time in the long run).

]]>
http://www.cookingincode.com/2010/07/13/culinary-abstraction-story/feed/ 0 35