Software development and cooking. Two worlds apart or is it? Object oriented programming models software after real world objects, and in my opinion, models cooking rather well too.

Consider a recipe defined like this (ignoring visibility):

class MeatMarinade {
  MixingBowl mixBowl;
  MeatMarinade() {
    mixBowl = new MixingBowl(); //Get a clean bowl

  Marinated CreateBasic(M meat, int portionSize) where M is Meat {
    mixBowl.Add(meat * portionSize);
    mixBowl.Add(new SesameOil(2 * portionSize));
    mixBowl.Add(new BlackPepper(2 * portionSize));
    mixBowl.Add(new Salt(1 * portionSize));
    Thread.Wait(60000); //10 min
    return mixBowl.GetResult();

void Cook() {
  var mm = new MeatMarinade();
  var res = mm.CreateBasic(new Chicken(), 4);
  CookingMethods.Broil(res, 45/*min*/);

Hey…no wall of text there. And everything, the amounts and the process, are all written down in a straightforward way. So who in the right mind will do this? Then again, probably no one…

However, I don’t intend this to be how we record recipes either. I just want to put forward the idea that programming concepts can be applied to cooking, even concepts like parallel computing. Do you really want to do your cooking sequentially, even when you can do certain things concurrently? For example, boil the water while chopping up onions.

So how is this useful? We program for efficiency, to automate tedious tasks such that they can be done faster. Similarly, in cooking, the idea is to be able to churn out a proper meal in the least time possible. In my case, I aim for under 1 hour to make a complete meal.

Cross Discipline Concepts: (Sounds cooler than it is…really)

  1. Parallelism: Cooking can be easily parallelized. If the recipe requires several components, chances are each component can be prepared concurrently as the others. For example, when cooking pasta, we can boil the water for the pasta (~10 min) while we chop up whatever ingredients we need. Before the pasta is ready, stir-fry the ingredients. Add in cooked pasta to cooked ingredients when ready, turning down the heat if there is a need to wait. Or how about letting the rice cook while having the meat sit for marinating, while you are stir-frying the vegetables? If you can parallel-cook, you are efficient, no question about it. I bet you will look professional too…
  2. Templates: Using the example above, I will like to make a claim that many cooking recipes are generic in nature. The meat marinade I gave above with just black pepper, sesame oil and salt, works well with just about any meat I can think of. This is important because we only need to remember the recipe once, to apply it anything that once grew on an animal in your freezer. Don’t memorize the recipe, memorize the general process.
  3. Caching: Cooking while staring at your recipe book is like having an application read directly from the hard disk all the time. Slow and painful. For daily fare, use generic recipes that can be quickly applied from memory. Not following recipe books directly can also have its perk. For better or worse, your dishes will never taste the same. There is also the fact that slight variances can hardly be told apart.
  4. Inheritance (OOP): Many recipes are extensions of simpler recipes. Using the example above, a “SpicedMeatMarinade” can inherit from “MeatMarinade” and adds some spices to the creation process. Rosemary and Thyme works out great by the way. By appending ingredients to existing generic recipes, we subconsciously apply this concept to cooking.
  5. Abstraction (OOP): Do I really need to mention those packaged sauces are perfect examples? These can change the taste of a dish without the time cost of making them yourself.

And these are the little things that recipe books won’t tell you, at least not to a programmer.





Ok fine! I am nuts to make such a connection between the two.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s