I’m passionate about software development, which is good since it’s something I do almost every single day. There are different approaches, methodologies and practices to developing great software, but the end goal is usually the same: create a tool that makes doing something easier or more enjoyable. The developer controls every aspect of the experience, and everything from the most complicated data management apps to one that lets you share cute cat videos with your friends is imbued with the distinct personality of its creator.

In the evenings, I go home from work and indulge in my other great passion: cooking. Over time I’ve noticed many similarities between the two disciplines. Both are rule-based, considered a science and an art form, and leave plenty of room for improvisation from the person doing it. Cooking and programming can also both result in either delicious and tantalizing outcomes or half-baked or overcooked ideas that leave a bad taste in your mouth.

In fact, software development and cooking are basically the same thing in my book. Here are the 5 things that cooking and coding have in common:

1. Code is just another word for “recipe

In cooking, a dish is broken down into lists of ingredients, like this example from my favorite recipe for fudge:

  • 8 ounces unsalted butter, plus more for greasing pan
  • 1 cup smooth peanut butter
  • 1 teaspoon vanilla extract
  • 1 pound powdered sugar

Apps are created in a similar fashion, with the programmer combining data structures instead of herbs and spices. There are many types of data structures used in software. For example:

  • Floating point numbers
  • Strings of characters
  • Custom data structures

Applications manipulate data in much the same way that cooking with heat alters the chemistry of the ingredients. It might be thousands of customer records, Instagram photos, or your smartphone’s app store — each can be broken down into basic lines of code that can then be recombined (aka cooked) to create complicated applications.

2. Cooking with code

Once you have collected the ingredients you can move on to cooking your dish, with the recipe acting as a set of instructions that need to be followed to get the desired result. That sounds a lot like a computer application, which is just a set of instructions that tells a machine how to execute a group of commands.

Recipes and computer programs both lay out steps that need to be done one at a time and in a specific order, though some applications and recipes require multitasking to be accomplished. In the kitchen, I may have a sauce simmering on the stove while I’m also chopping vegetables or browning meat. When writing code, I may set up a system where a background thread processes an image while the user types in metadata.

At the end of the process, a good coder will present an elegant application, while a good chef will serve a tasty meal. In both cases, the outcome will be determined by the skill of the person who drew up and executed the set of instructions.

3. There’s a world of code cuisine out there

There are so many types of food — a different style for almost every country on the globe. In cooking, we call those cuisines. If your city has even a half-decent restaurant scene, you have a pretty good idea of the differences between, say, Italian and Chinese cuisine. Yet despite their differences, both styles of cooking have the same key ingredient at their core — the noodle.

Methods for developing software can also be broken down into “cuisines” based on the differing approaches of developers. Object Oriented Design is one of the most commonly used patterns, and is useful in software development because it allows teams to work together seamlessly. Telling a new team member that a project is following the Model-View-Controller pattern allows them to join development more quickly, the same way telling your dinner date where you’re going allows you to avoid any uncomfortable food-related standoffs — like accidentally taking a vegan to a steakhouse.

4. When in doubt, consult a cookbook

For those not culinarily inclined, a cookbook is just a collection of recipes bound together in book form. For example, I’m a fan of the Five Ingredient Cookbook, which is exactly what it sounds like — a collection of recipes all using five ingredients or less. There are also cookbooks written for programmers, which contain “recipes” that solve common problems encountered when writing code. If a programmer runs into a roadblock they haven’t seen before, they can consult a code cookbook for a solution. One example is the C# 3.0 Cookbook, though it should be noted that both chefs and coders now typically search the internet for new recipes or code solutions.

5. Both cooking and coding are an art and a science

Screen Shot 2016-05-06 at 3.32.11 PM

Programming and cooking are both arts and sciences. Just look at the college majors to study it: “Computer Science,” for the coders, “Food Science” for the chefs. Cooking and coding also both follow the scientific method, another mark of a true science.

The first step in the scientific method is to form a hypothesis. In cooking, this may be the idea for a new flavor or combination of flavors, while in coding it might be a new algorithm for solving a problem. Up next is testing the hypothesis through experimentation. This is the easy part — make the dish or code the algorithm. After experimenting the results need to be analyzed, which means running the newly written application or, better yet, taste testing the food. The results of experimentation can be used to improve your work the next time.

As for being an art form, it’s easy to see cooking as such — take one look at Instagram and see how much food is artfully prepared — but it may be more difficult for some to see coding as art. Why? Just because you’re clacking away on a keyboard? It makes me think of William Shakespeare.

What does The Bard have to do with coding? Easy, he’s a writer, and coding is just writing at its core, albeit writing done in a unique language. By writing efficient, readable code, a programmer can guarantee their program runs smooth, and makes their job and the jobs of others easier in the future.

The end results — whether they be a stage play or smartphone app — have the potential to invoke the full range of human emotions. If that isn’t art, then I don’t know what is. I bet you’re hungry now. Hungry for fudge? Peanut Butter fudge? Here’s my favorite recipe. It doesn’t take long and look! It has fewer than five ingredients. You can totally do this.

Peanut Butter Fudge

Recipe by Alton Brown for Food Network

Ingredients:

  • 8 ounces unsalted butter, plus more for greasing pan
  • 1 cup smooth peanut butter
  • 1 teaspoon vanilla extract
  • 1 pound powdered sugar

Directions:

  • Combine the butter and peanut butter in a 4-quart microwave-safe bowl and cover with plastic wrap.
  • Microwave for 2 minutes on high. Stir and microwave on high for 2 more minutes. (Use caution when removing this mixture from the microwave, it will be very hot.)
  • Add the vanilla and powdered sugar to the peanut butter mixture and stir to combine with a wooden spoon. The mixture will become hard to stir and lose its sheen.
  • Spread into a buttered 8 by 8-inch pan lined with parchment paper.
  • Fold the excess parchment paper so it covers the surface of the fudge and refrigerate until cool, about 2 hours.
  • Cut into 1-inch pieces and store in an airtight container at room temperature for up to a week.