Why Exploding Salsa Reminded Me of Software Development

Yesterday my wife was making salsa in the blender. She put all the ingredients in, put the lid on, and went to turn it on. Our blender has got a few extra buttons, and I use it more often, so I went to help. We got the blender going, salsa was looking great, but in a classic case of too many cooks in the kitchen, I gave the blender one extra pulse AFTER my wife had removed the lid.

Oh the carnage.

Salsa all over the countertops, on the wall, on the curtains, down our clothes, and covering our daughter. Salsa everywhere. It was a mess.

A great deal of clean-up later we managed to finish making the salsa, but what does that have to do with software development?

How many times have you called a method on an object before it was initialized? Or while it was in a bad state? Or before it was implemented? Or written to shared memory without locking your mutex? Or perhaps going the other way, what happens when an object isn’t updated when another one changes, and the whole system gets out of sync?

There are patterns to help prevent most of these errors, just like if my blender had a lid sensor, but I’ve seen so many related bugs over my career that the similarity made me smile.

And then I got out of the kitchen.