While I was out for my morning walk, it struck me that writing a story is like coding software. I used to be a programmer, so I see it in almost every aspect of life, but this time it was different; it was an epiphany. Because when we write stories, we're programming the reader's brain to conjure up images and trigger emotions. And this made me think about all the levels of programming involved when writing prose, everything from local variables (individual word choices) and expressions (sentences) all the way up to global variables (main character and story goal). Perhaps this is why I see story structure as being so important. The beats (to use Blake Snyder's word) in the plot are like the steps in the main loop of a program: gather data, decide what to do with it, try something and if that doesn't work, try something else. And when the solution is finally found, regather the data and bang on it until it either breaks (sad ending) or works (happy ending). Each scene is like a function. The reader comes in with certain expectations (entry conditions), watches while the MC and story goal (global variables) get mangled by the function (processing) and spit out the other end (end conditions). Sometimes the end conditions are not pretty. Each sequel (see Swain's book if you don't know what this is) is like error handling or error recovery code. Things went wrong in the scene (the data got mangled) so things need to be put right(ish) again before we can move on. Sometimes it can be like kicking the dents out of a fender after an accident, if I can bring in a whole other metaphor for a moment just for the imagery. The MC (global variable) has something new to try (another function) and so reader expectation is set up for the next scene. And the end product of a story will be satisfaction for the reader just as when a programme is finished and the user's data is all tied up in a bow... crashes not withstanding. And the epiphany? Structure makes storytelling easier just as it makes computer programming easier. It calls upon thousands of years of observation and practice by some pretty smart people from Aristotle and Shakespeare to the likes of Dwight V. Swain, Sid Field, Blake Snyder, Lajos Egri and Vicki King. Why wing it? It's like reinventing the wheel.