…or how to take a bad analogy far too far; without any goal in sight.

Sometimes you just need a break from all the bits and bytes; all the integers and floats and strings. Sometimes you just want to step away from the keyboard and do something completely different, such as bake a cake. There's nothing so different from writing software as baking a cake, right?



When you cook anything, you're essentially executing a program. If you're the sort of person who follows the recipe slavishly then you're executing a defined algorithm for turning ingredients into something else; if you're the sort of person who thinks recipes are essentially a guideline, then you're still running a program in your head, but it's more of a heuristic than an algorithm.

In the process of running this program, you use tools, process inputs, and produce outputs. You even likely have (albeit small, simplistic, and likely poorly defined) a test suite to ensure that you produce the right outputs (that of simply tasting things).

What's even worse (assuming you were trying to get away from producing software rather than simply wanting dinner) as you go, even if you weren't expecting to, you likely are debugging and bugfixing your program as you learn more about how you want to transform inputs to outputs effectively and efficiently.

Okay, so if programming and cooking are just more of the same, then why this article at all?

In brief, everyone needs something to do when the code just doesn't flow. I sometimes switch to reading a book, watching videos online, or going for a walk; but sometimes cooking is exactly the right thing to do. At least a few other programmers must agree since there's any number of programmer oriented cooking-related tools out there, a yaml syntax or three for defining recipes, and some desktop environments which shall remain unnamed even consider recipe tools to be worth mentioning in their release notes :-)

All this applies to those of us who slavishly try and write articles for you to enjoy every week. As such, sometimes we just need to have fun. Thus, your homework this week, assuming you're not allergic to any of the following, is to:

  1. Take two eggs and weigh them (shell on)
  2. Sift the same mass of self-raising flour and set aside.
  3. Melt the same mass of butter and beat the eggs (shell off), butter, and the same mass of sugar together.
  4. Gently fold the flour into the wet mix, trying to not knock the air back out of it. (Or just use an electric whisk to keep it floofy)
  5. Divide the mix between two pre-greased and floured cake tins, and bake in the centre of a pre-heated oven at (approximately) 170°C for 20-25 minutes (check the centre with a skewer)
  6. Allow the cakes to stand for 10 minutes before turning out onto a wire rack to cool thoroughly.
  7. Beat 150g to 250g of butter until smooth and soft (I prefer slightly salted butter, but unsalted is fine too)
  8. Mix icing sugar into the butter, a spoonful at a time, beating it until smooth each time. Repeat until the icing tastes sweet rather than savoury.
  9. Spread a small bit of icing on the centre of a plate, and use that to stick one of your sponges down. Ice the top of the sponge and then pop the second layer on top. If you have enough icing left, smear it all over the cake, remembering that presentation is far less important than deliciousness.

Now serve slices of your delicious cake with cups of delicious tea or coffee.

Also, please do share your favourite recipes in the comments below, before you take your coffee and cake and get on with coding up your latest masterpiece.