I am growing suspects that the ubiquitous analogy between algorithms and recipes be not so well founded, especially for theoretically oriented students. I am wondering if this may contribute to the evidence of students having difficulties with even simple loops. I believe that bad analogies make more harm than no analogies, so I ask.
My wondering is that recipes, if superficially similar to the idea of sequential steps, do not really encode the logic that is sought to be explained: the logic of state transitions. Of course there are state transitions in recipes, but i do not feel they being the characterising properties, nor are they the target of attention (I also like cooking). State transitions in recipes (and similar physical operations analogies) seem to be not even caused by the "program" but just happening because of physics. And typically what we get from students struggles is exactly their inability to follow (or design) state transitions. Probably because a fundamental property of a real computer program is that of being the acting cause and not the observer of state transitions, and this is not captured by the analogy. Another issue is that computing systems are typically discrete while physical analogies tend to be continuous, both in time and measured (variables) dimensions.
What screams for attention in recipes are instead "data" dependency constraints (cannot throw in the spaghetti before the water boils), or a kind of "event-driven" situation, and i do not recall seeing students struggling with data dependencies, which might be because 1. the recipe analogy is good in teaching them or (I suspect more probably) 2. it's not what they need help for: data dependencies being more innate than state transitions, especially in a forcefully sequential environment (of course this is a hypothesis, any experiments known?).
On a more concrete side it seems to me that the real world software counterpart of recipes are those things that we usually call scripts: something I love and had made a lot of and which I know perfectly fit their niche problems, but not something that is known for exposing nice theoretical properties, which, I suspect, is what matters more when learning, in order to build a clear mental model of algorithms (and because my pupils are generic science students and not specialist computer developers).
Realistic programs, and especially subprograms if we want to divide et impera, are not sequences of operations but sequences of state transitions.
What do you think of this analysis? Have any empirical data? Does an analogy that takes more care of state transitions exist and I have missed it?