Sunday, February 07, 2016

What Shakespeare has in Common with Software Development

Shakespeare is widely regarded as the world's leading playwright in English, and perhaps any language. Such is his influence that phrases and ideas coined by him at the turn of the 17th century still live on in our colloquial speech today. Romeo and Juliet is shorthand for passionate, ill-fated love, and quotable lines from his works permeate our treasure trove of idioms and phrases.

What is perhaps less well known is that many of Shakespeare's plays have no definitive version. Take "Hamlet", for instance. There is the famous First Folio version, compiled and published seven years after his death, and there is the First Quarto version, a.k.a. the Bad Quarto, and then also the Second Quarto version. None of these versions are considered 100% definitive. Edited versions usually combine parts of each to present the modern reader with the most feasible "Hamlet", and even these are subject to change.

How did this happen? So many details about that time have been lost to history that it is difficult for us to reconstruct a real sequence of events from the remaining evidence. There are entire books written to argue one case or another, but consider that some people even dispute William Shakespeare's authorship, then it is clear that we are on shaky ground from the get-go.

Personally, I've come to a different view while mulling over an under appreciated ingredient of Shakespeare's genius, an aspect that has something in common with software engineering - especially agile development.

Shakespeare wasn't just a writer, he was also an actor and part-owner of the theatre company the Lord Chamberlain's Men (later the King's Men). I find it useful to think of his plays as a function not only of Shakespeare's maturing talents as a writer, but also of the needs of the company. Those needs were financial, like any company's, and were directly informed by the success or failure of a particular play in the eyes of the audience of the day, as well as the tastes of their influential patrons.

It is thus hard to imagine that Shakespeare would just write a single, finished version of Hamlet, tell the actors their lines once-and-for-all and be done with it. As part-owner he had a responsiblity and exposure that went well beyond writing. He would have wanted to make sure the play is as good as it can be, on a continual basis. The company would receive financial feedback, and the company's patron would have his say, and so the day-to-day operations would hone the way the play was performed - if it was performed at all.

As an actor of second-tier roles he would also have been in a unique position to experience feedback from the audience. I imagine him night after night, observing the audience's reactions, hearing them laugh at the funny parts (or not), seeing them moved or engaged during tragic or passionate moments, and smiling or bored as the case may be during the play or afterwards. He would be thinking of the various stakeholders, of the dramatic value of a particular phrase or scene, of the audience's reactions, and so he might choose to change the lines - add a bit more zing, create more drama, more references to current affairs - who knows?

Shakespeare's mind would have been working constantly to improve the play and I have no doubt that this is precisely what happened. His plays have a uniquely organic feel to them, as if the action is happening right there, and the actors could step off the stage and mingle with the audience at any moment. By assimilating his audience's emotions and interests he was bringing art closer to the audiences' reality.

It is this approach of continual improvement, of being tested night after night against a real live audience, that strikes me as being very much in the spirit of agile development. It's a bit like running continuous integration while already in production.

I would go a step further and suggest that Shakespeare was so canny and pragmatic that, even if he had a successful version of a play, should the political climate change he would be willing to adapt the play again, to cater to his audience and so prolong the play's financial success. If this is so, he may well have found a dramatic architecture that admitted of continual adaptation, just like good software architecture is flexible, and written with ease of maintenance in mind. That would certainly go some way towards explaining his plays' capacity to be continually repurposed for modern audiences.

To put that achievement into perspective, imagine writing software that is still in demand 400 years later!

If we take this view it is a bit of a shame that not more of our worthy literary works are "production tested" with a feedback loop that permits continuous improvement. There was a time when serial publication afforded authors some engagement with their readers, and thus to inform the next installment. Nowadays, authors are required to write once, for all time. But in software development we know that this is usually premature, costly, and occasionally disastrous.

This is the reason that many writers form reading groups with other writers, to permit them a trusted soundboard and source of feedback. But the General Reader is a different beast, whose tastes are not to be tamed so easily. Shakespeare wrote "not for an age, but for all time", and perhaps it's because he wrote not once, but all the time. He understood the value of his users.