Monday, January 6, 2014
Cooking and Coding
I’ve been playing around with this post in my mind for a while. See, one of the things I’m truly passionate about is cooking. I love to cook and I love to bake… each requiring a slightly different mentality. For those who do either, you understand the differences.
Cooking is oftentimes about getting into the kitchen, opening up the fridge and throwing some things together. There is tweaking that goes on along the way. You might add some more salt, or usually in my case a dash of cumin. You might substitute one ingredient for another. Sometimes the concoction is great. Other times, you watch it sit in the fridge because it didn’t turn out quite right.
Baking is a little different. There is a preciseness to baking. You need to measure and create the product according to the instructions. In baking, there are very few places where you can or should deviate from the given recipe. For example, my high school chemistry paper was on the chemistry of cooking. Even simply adding ingredients in a different order will give your product a completely different texture or volume.
For me, baking is my calm, happy place. It’s what I do when my brain is in overdrive and I just need to pound some dough, get my hands dirty with flour or batter, or just focus on bringing each of the pieces together.
The more I code, the more I think of how my journey mirrors that of me learning how to cook and bake, and how different parts of the coding process are exactly like cooking versus baking.
When I began learning how to code, it was hard. It was difficult to motivate myself to do something I wasn’t comfortable with. It was difficult to wrap my brain around all the pieces. I always wanted to see a picture of the final product and know what the final result was supposed to be before getting started. Furthermore, I only followed recipes. I had no ideas what spices went together or when I could substitute one ingredient for another. I followed the recipe to a T and if I didn’t have a spice or an ingredient… I gave up on the recipe and searched for something else to cook. Cooking also took me longer to get through because I wasn’t familiar with the process. The first time I deboned a chicken piece or roasted a squash, I needed to read the instructions a few times because I felt lost at the initial direction.
Once I started to become confident about my cooking, I was able to get better much faster. I cooked a few times a week and I didn't dread it. Cooking more often made my knife skills better and my prep time shorter. Additionally, it made me more adventurous. I was no longer afraid about something not turning out exactly like it should. I substituted ingredients based on what was in the fridge and created meals from my mind and not necessarily straight from the cookbook.
I’m still not a master chef. I never will be. I hope to continue to flex my culinary creativity muscle as I cook more and learn more. Each time I add a new ingredient or a new recipe into my repertoire, it teaches me about flavor profiles that belong together and how I can mimic that with other ingredients. Just like with coding, I am still honing my ability to figure out when something is just right… the right balance of flavors and textures.
Every code involves some cooking, some sense of does it taste right? Does it look right? Does the texture look good? Is it pretty? And what do others have to say about how I could improve the recipe in the future?
Now for baking. As I mentioned before, baking is precise. You need to have a gut feeling about baking. Do you add a little more flour? What happens if you throw a pinch of nutmeg into the mix? Does this dough feel right? And if it doesn’t, what alteration should I make? It has taken me a while to develop my baking gut feelings. When you screw up baking, it’s often a bigger disaster than with cooking. It’s easier to cover up mistakes with spices and other ingredients when you cook but when you bake, sometimes you don’t know something went very wrong until you pull it out of the oven. Other times, you know something doesn’t feel right but you’re not sure what the best way to make it feel better is. And sometimes, the best thing to do is to just punch and knead it for a little while.
I imagine I’ll develop my baker’s sense for coding as the years progress and in writing this, it makes me feel like testing and practice test driven development relate more to the baking side of coding than the cooking side, highlighting it’s importance.
Regardless of whether you’re baking or cooking or coding, all get better with time and practice. All give you raw ingredients that you intelligently mix together to make something better. And all provide you with challenges, problems, and hopefully, wonderful solutions.
Now, go grab a snack and get back to coding.