Lockstep

Mobile: +61 (0) 414 488 851
Email: swilson@lockstep.com.au

Programming is like playwriting

The software-as-a-profession debate continues largely untouched by each generation's innovations in production methods. Most of us in the 90s thought that formal methods, reuse and enforced modularity would introduce to software some of the hallmarks of real engineering: predictability, repeatability, measurability and quality. Yet despite Objected Oriented methods and sophisticated CASE tools, many of the human traits of software-as-a-craft remain with us.

The "software crisis" – the systemic inability to estimate software projects accurately, to deliver what's promised, and to meet quality expectations – is over 40 years old. Its causes are multiple and subtle, and despite ample innovation in languages, tools and methodologies, debates continue over what ails the software industry. The latest skirmish is a provocative suggestion from Forrester analyst Mark Gualtieri that we shift the emphasis from independent Quality Assurance back onto developers’ own responsibilities, or abandon QA altogether. There has been a strong reaction! The general devotion to QA I think is aided and abetted by today’s widespread fashion for corporate governance.

But we should listen to radical ideas like Gualtieri’s, rather than maintain a slavish devotion to orthodoxies. We should recognise that software engineering is inherently different from conventional engineering, because software itself is a different kind of material. Its properties make it less amenable to regular governance.

Simply, software does not obey the laws of physics. Building skyscrapers, tunnels, dams and bridges is relatively predictable. You start with site surveys and foundations, erect a sturdy framework and all sorts of temporary formers, flesh out the structure, fill in the services like power and plumbing, do the fit-out, and finally take away all the scaffolding.

Specifications for real engineering projects don’t change much, even over several years for really big initiatives. And the engineering tools don't change at all.

Software is utterly unlike this. You can start writing software anywhere you like, and before the spec is signed off. There aren’t any raw materials to specify and buy, and no quantity surveyors to deal with. Metaphorically speaking, the plumbing can go in before the framework. Hell, you don't even need a framework! Nothing physical holds a software system up. Flimsy software, as a material, is indistinguishable from the best code. No laws of physics dictate that you start at the bottom and work your way slowly upwards, using a symbiosis of material properties and gravity to keep your construction stable and well-behaved as it grows. The process of real world engineering is thick with natural constraints that ensure predictability (just imagine how wobbly a house would be if you could lay the bricks from the top down) whereas software development processes are almost totally arbitrary, except for the odd stricture imposed by high level languages.

Real world systems are thoroughly compartmentalised naturally. If a bearing fails in an air-conditioning plant in the basement, it’s not going to affect the integrity of any of the floor plates. On the other hand, nothing physically decouples lines of code; a bug in one part of the program can impinge on almost any other part (which incidentally renders traditional failure modes and effects analysis impossible). We only modularise software by artificial means, like banning goto statements and self-modifying code.

Coding is fast and furious. In a single day, a programmer can create a system probably more complex than an airport that takes more than 10,000 person-years to build. And software development is tremendous creative fun. Let's be honest: it's why the majority of programmers chose their craft in the first place.

Ironically the rapidity of programming contributes significantly to software project overruns. We only use software in information systems because it's faster to make and easier to modify than wired logic. So the temptation is irresistible to keep specs fluid and to accommodate new requirements at any time. Famously, the differences between prototype, beta and production product are marginal and arbitrary. Management and marketing take advantage of this fact, and unfortunately software engineers themselves yield too readily to the attraction of the last minute tweak.

I suggest programming is more like play writing than engineering, and many programmers (especially the really good ones!) are just as manageable as poets.

In both software and play writing, structure is almost entirely arbitrary. Because neither obey the laws of physics, the structure of software and plays comes from the act of composition. A good software engineer will know their composition from end to end. But another programmer can always come along and edit the work, inserting their own code as they see fit. It is received wisdom in programming that most bugs arise from imprudent changes made to old code.

Messing with a carefully written piece of software is fraught with danger, just as it is with a finished play. I could take Hamlet for instance, and hack it as easily as I might hack an old program -- add a character or two, or a whole new scene -- but the entire internal logic of the play would almost certainly be wrecked. It would be “buggy”.

I was a software development manager for some years in the cardiac pacemaker industry. We developed the world’s first software controlled automatic implantable defibrillator. It had several tens of thousands of lines of C, developed at a rate of about one tested line of code per person per day. We quantified it as the most reliable real time software ever written at the time.

I believe the outstanding quality resulted from a handful of special grassroots techniques:


  • We had independent software test teams that developed their own test cases and tools
  • We did obsessive source code inspections on all units before integration. And in the end, before we shipped, we did an end-to-end walkthrough of the frozen software. It took six of us two months straight. So we had several people who knew the entire object intimately.
  • We did early informal design reviews. As team leader, I favoured having my developers do a whiteboard presentation to the team of their early design ideas, no more than 48 hours after being given responsibility for a module. This helped prevent designers latching onto misconceptions at the formative stages.
  • We took our time. I was concerned that the CASE tools we introduced in the mid 90s might make code rather too easy to trot out, so at the same time I set a new rule that developers had toturn their workstations off for a whole day once a week, and work with pen and paper.
  • My internal coding standard included a requirement that when starting a new module, developers write their comments before they write their code, and their comments had to describe ‘why’ not ‘what’. Code is all syntax; the meaning and intent of any software can only be found in the natural language comments.

Code is so very unlike the stuff of other professions – soil and gravel, metals and alloys, nuts and bolts, electronics, even human flesh and blood - that the metaphor of engineering in the phrase “software engineering” may be dangerously misplaced. By coopting the term we have might have started out on the wrong foot, underestimating the fundamental challenge of forging a software profession. It won't be until software engineering develops the normative tools and standards, culture and patience of a true profession that the software crisis will turn around. And then corporate governance will have something to govern in software development.

Posted in Software engineering, Language, Culture

Comments

DarenWThu 9 Aug 2012, 4:51pm

Most thoughtful article I've read in a while on the nature of software development. Maybe parts of the overall process can be treated like an engineering project, but there is indeed something fundamentally different.

So, how _does_ one manage a major poetry project?

Stephen WilsonMon 13 Aug 2012, 8:04pm

After positing a long time ago that programming is like play writing, I didn't develop the theme any further. Now DarenW asked a good and stimulating question, and here are some quick (and very incomplete) speculations about how to manage the process.

Firstly I'd urge programmers to keep their drafts! So many software problems arise from not understanding why code is the way it is. Even the original authors often forget why they went down a particular path, and can introduce their own bugs when revisiting code when they're a bit rusty. I favor using revision control systems to retain lots of intermediate versions.

I understand that a great deal of wisdom is held in writers' rough drafts. Original manuscripts in literature and the theatre are treasured for all the corrections and the notes in the margins. They show what the author was thinking. Likewise we should probably out more emphasis on commenting code, and making better notes, so we know what the programmers were thinking.

Apart from that ... there's a noble "Slow Movement" in food, and I wonder if we should borrow from it in programming? As mentioned in my earlier blog, I think it was extremely useful to get my developers to slow down, using pen and paper at least one day a week. Good design takes time. We should internalise a more modest, deliberative pace of development.

Finally for now, what if we look at how a complicated theatre production is "tested"? We're all familiar with software Unit Testing and User Acceptance Testing. Can we compare them respectively with Technical Rehearsals and Dress Rehearsals of a play?

Why would we bother to look to new metaphors? Maybe it could illuminate even earlier stage software verification methods. As mentioned previously, I liked to have my team members do an informal preliminary design presentation just a few days after they started work on a new module. In play writing terms, this is a little bit like a writers workshop, or a "Script Read Through". My gut feel is these fresh comparisons might help expose and rejig the mechanics of software creativity. It may help us think more clearly about the software craft, consider new methods, and admit different sorts of work habits.

Post a comment

If you are a registered user, Please click here to Sign In

Your Name*

Your Email Address* required, but won't be displayed on this site

To help prevent spam in our blog comments, please type in "Programming" (without the quotation marks) below*