Programmers Are Made In The Kitchen

Scott Venkataraman
Launch School
Published in
4 min readDec 4, 2023

Hey YOU!

I’m not scared of programming and you shouldn’t be either!

If you’re having a hard time wrapping your brain around algorithms, you’re not alone and it’s not a personal failing. I’m Scott. I’m a Physical Therapist transitioning to become a software developer. One thing I’ve learned when explaining medical concepts to non-medical people is that you have to start them on common ground before you dive into the complexity of a new topic. This can help us all learn faster and more effectively.

It was challenging to learn the technical aspect of writing code while also grasping the conceptual aspect of breaking down a problem, defining parameters and creating the process involved in solving it. I didn’t understand what “levels of abstraction” meant on my first pass (or my third). I eventually realized that every part of our daily lives uses algorithms and I didn’t have to use coding as the foundation to learn to think algorithmically. It sure didn’t feel like ground I was comfortable starting from.

Many of the algorithms of life are subconscious and automated for us, but we learned them at some point. Some are more obvious, like cooking recipes, workout plans, morning routines, or putting together Ikea furniture.

Let’s put it in terms we might be more comfortable with. Everybody eats.

Culinary Abstraction

One thing that helped me wrap my head around algorithmic thinking and levels of abstraction was to use the simplest cooking recipe as a mental model. Imagine you’re in the kitchen and you want to make a scrambled egg. You can break down the cooking process into a series of broad, high-level steps like:

  1. Get 2 eggs
  2. Crack the eggs into a bowl (you can add milk if you’re into that)
  3. Whisk the eggs in the bowl
  4. Pour the eggs into a hot pan
  5. Stir with a spatula
  6. And so on.

A (very) generalized flow chart might look like this:

Hold up. How do you know how to whisk the eggs? Or when they’re done cooking? More specifically, how do you know where to find the eggs, or how crack them?

This is where levels of abstraction comes in. You and I don’t think about all the details when making an egg, but they’re still happening. We’re subconsciously working through the smallest processes that involve finding the eggs, cracking them, removing the shells, repetitively whisking in the bowl, heating the stove, finding a pan, and every other tiny step along the way.

Conceptually, you can sum up these steps into abstract terms like “get two eggs”, “whisk the eggs” and “stir with a spatula”. These terms represent the series of sub-processes we have to complete for that step. Sounds an awful lot like a method or function, eh? We can think of summing up the details to each of these actions into the terms as the first level of abstraction.

If we go up a level of abstraction, we see all of these steps as part of the “make scrambled eggs” recipe, or algorithm. Let’s call that the second level of abstraction. Then, we can zoom out to the next level and consider making the eggs just one step in the process called “having breakfast” which might include processes like:

Make scrambled eggs => Eat scrambled eggs => Do the dishes

Let’s call having breakfast the third level of abstraction. Here, there are only three steps: making the eggs, eating the eggs and cleaning up afterward. But “making the eggs” contains all of the individual steps mentioned above. “eating the eggs” and “doing the dishes” each contain a TON of actions to take and decisions to make too.

What if we zoomed out one more time to the fourth level of abstraction. Let’s call that Eat Three Meals.

Make breakfast => Make Lunch => Make Dinner
Eat Three Meals contains three meals, with each meal consisting of several levels of abstraction. The number of sub steps involved in each of these actions is getting to be a lot, but you and I do it everyday. Each step is simple, but it can feel overwhelming if you look at it all at once.

At each level of abstraction, think about every verb used above as a method or function. Each verb/method has to complete a series of steps to accomplish the task you need it to do. You would probably define your verb/methods with names like “get_eggs”, or “stir_with_spatula”, etc. and their method bodies would contain the appropriate steps required to accomplish those tasks.

Sometimes those verbs require the use of other verbs. Making eggs requires the action of cracking eggs, beating the eggs, etc. The same is true in programming. One method may need to call a helper method, or some built-in methods that our programming language provides.

Get Cooking

Learning to write code is challenging. Learning to think in terms of algorithms can be just as hard. Learning both at the same time can be overwhelming, (like learning Greek History in Spanish and having no background in either).

Algorithms are everywhere, but code doesn’t have to be. Take them on one at a time, learn how to think algorithmically without having to learn it in coding specific terms. You can use an algorithm from your daily life to explore algorithmic thinking, abstraction, flow-charting and pseudocode without ever opening your code editor. Who knows, you might even get a meal out of the process.

--

--

Scott Venkataraman
Launch School

Physical Therapist transitioning to Software Developer, using mental models and analogies to aid learning.