Neal Stephenson: Programmer as a writer. Do it right the first time
lambda-the-ultimate.org
lambda-the-ultimate.org
There is plenty of bad improv: amateurish stuff, "gaggy" stuff (consciously aiming for cheap laughs), etc. But I've also seen amazing improv: entire plays and musicals, sometimes with serious themes, of such coherence and high quality that it doesn't seem possible that they could have been improvised. I once saw an entire Alfred Hitchcock "movie" improvised on stage, that somehow achieved Hitchcock's signature combination of eerieness and worldly elegance.
I've spent about three years training in improv, and it's actually a lot like Stephenson's tale of needing to keep the typewriter ribbon moving. Training in improv is mostly learning ways to tune into what is happening in a scene, let that trigger your spontaneous imagination, and trust that without judging it. There are some very specific techniques, like "very early in the scene, establish where you are," but mostly it's developing that skill of stoking your spontaneous imagination and taking what it gives you. You know after a while when you're tuned in and when you're not. A non-obvious but important element is to go s-l-o-w (like Stephenson with the fountain pen). That enables you to tune in.
If you don't have your imagination ready to go that way, cultivated by life experience and learning as well as by a feeling for how to tune into a scene, the good stuff just ain't going to happen.
My own experience with writing code is something like improv. Sometimes it sucks, and sometimes it's wonderful. There's no way the good stuff could ever have come about by continuous distillation and debugging. It had to flow. I debug very little. If code is buggy, I just throw it away and start completely from scratch. When the code is flowing, nearly all of the "thinking" is subconscious. I'm just tuning in, as if someone else is writing the code. When it's going super-well, it feels like I'm taking dictation. Just like in an improv scene, I'm writing the current line because I'm curious to know what happens next.
I never get it right the first time. I also never succeed in turning that ugly first draft into pretty code. Instead, revising for me means taking a look at what I was trying to achieve with that ugly first draft, throwing it away, and doing it right the second time. All this done iteratively, so I'm never throwing out a complete body of work, only the latest bits on top.
Small pieces, loosely joined, as they say.
But comparing writing a novel to programming a complex system seems pretty naive, to say the least. The first obvious difference is that a novel (generally) comes out of one person's head, but most larger projects end up far too large for any one person to truly keep it all in their head and understand all the interactions. That immediately makes it pretty much impossible to just do things right the first time; there are always things you don't understand or forget about when working on a larger project. There's also the fact that vagueness is tolerated and often desired in a novel, whereas it's not an option when programming; that just means there are more details to "get right", more decisions to make, and more interactions to worry about. In addition, a program generally has a definite purpose, and you can't re-define your goal as easily based on what it actually does (though sometimes you can; when writing, you often have an idea of where you're going or what effect you want, but if you end up with something different it might still be fine. There are a ton of other differences as well, of course; those are just the ones that first come to mind.
Frankly, I've loved Stephenson's works but they have gotten progressively looser. I've attributed this to his success relaxing his editors; this is much like a Senior Software Architect not being held to the same design and code review standards. The result is still impressive and functional, but may not be minimal.
Update: http://en.wikipedia.org/wiki/Mythical_man-month#The_Pilot_Sy...
Yet most people start with the most complex solution they can come up with, even though they don't know what they're solving yet.
Real scratch paper I use only for drawing angles and lines when dealing with geometry.
I recall Donald Knuth stating he programs by sitting next to a big trash bin and writing down all code in pieces of paper, most of which he discards.
A complicated story like The Baroque Cycle, 3000 pages, multiple main characters, taking place over about fifty years?
But a Lisp program (for instance) has multiple paths to its goal, so it makes more sense using non-linear tools when writing Lisp software.
But a novel (for instance) has multiple paths and plotlines, towards an indefinite goal, with the possibility of sequels, prequels, side-plots, and other ancillary matters, all of which can contradict one another in unpredictable ways -- and your debugger is an obsessed adolescent fan emailing you at 3 AM or asking about that musical mixup in 2F09.
I have never exactly 'made' a story. With me the process is much more like bird-watching than like either talking or building. I see pictures. Some of these pictures have a common flavor, almost a common smell, which groups them together. Keep quiet and watch and they will begin joining themselves up. If you were very lucky (I have never been as lucky as all that) a whole set might join themselves so consistently that there you had a complete story: without doing anything yourself. But more often (in my experience always) there are gaps. Then at last you have to do some deliberate inventing, have to contrive reasons why these characters should be in these various places doing these various things. I have no idea whether this is the usual way of writing stories, still less whether it is the best. It is the only one I know: images always come first. -CSL