Programming is the art of working out the logic needed to obtain some desired behavior from a system, such as a computer. I’m so used to achieving this with symbols, variables, and control keywords that it hadn’t really occurred to me that the same process has been used since long before computers were invented. Mechanical devices are “programmed” by specifying their physical design, and their behavior is “executed” with physics, not a CPU.
This came to me while I was reading a children’s book describing how a toaster works. What is the job of a toaster? To lie dormant until bread is inserted, then heat up for an appropriate amount of time, then automatically turn off and pop the toast up for easy removal. If I were going to create my own toaster, I’d go at it from a computer-logic perspective: acquire a sensor to measure the current toastiness of the bread (perhaps just its temperature), and then program a tiny embedded chip to respond when the sensor exceeds the desired threshold, at which point the toaster would send a command to the release lever so that the toast would be ejected. But is that how toasters are designed? No!
Toasters are a complete marvel of physics-based programming. There is no embedded chip, no logic to specify, no commands. Instead, the toaster relies on a bimetal bar, which bends to the left or right depending on the temperature, because its two metals expand at different rates. (I first encountered bimetallics when I asked my dad how our thermostat worked.) The same current that heats the toaster coils flows through this bimetal bar, and it gradually bends to the side, until it nudges the “heat-up lever” out of contact and instead engages the “cool-off lever”; as it cools back down and straightens, it then releases the cool-off lever which allows the spring-loaded release to pop the bread up.
Got that? There is no timer in your toaster! (Unless you have some new-fangled version that does in fact use a computer chip.) The timer effect is achieved by simple physics. This is an entirely different kind of programming which must have originally required a lot of trial and error: how long should the bimetal bar be? How thick? Which metals should be used, to get the right differential lengthening? And then there’s the clever puzzle of how to set up the system of levers so that the bending of the bar triggers them in the right order, purely mechanically.
I had always wondered why toasters don’t let you specify a toasting duration, instead of trying to figure out what a unitless dial that goes from 1 to 10 really means in terms of toastiness. Wikipedia relates that early toasters did have timers you manually set, but this caused problems because the first piece of toast needs longer than subsequent ones to achieve the same done-ness. Using the bimetal bar as a toast-proxy works better because it reflects the thermal properties of the heating elements and naturally adjusts the toasting time to fit.
This cleverness isn’t just about toasters: it’s alarm clocks and vending machines and cameras and all sorts of other devices. This kind of “programming” reminds me of dominoes: setting up all the pieces so that they fall into the right places at the right time. What contraints under which to operate! What an interesting development environment!
Maybe I’ve been living in the computer world for too long.
Next up: The transparent toaster.