Software code should read like well-written prose

I’ve long felt that well written software should not only be human-readable, it should be a good read. It’s a view held by Robert Martin who describes clean code as elegant, efficient, readable like well-written prose.

This came to mind when I finished reading a thriller, “The Lion” by Nelson DeMille. I’ve read several of his books, not least “The Charm School” which was brilliant. Now, The Lion didn’t have a great plot – in fact, having read a couple of his John Corey books already, I could pretty much predict the finale after the first couple of chapters. But it didn’t matter, because the story was so well told I enjoyed the journey. The next book I picked up is a science fiction tale set around the time of World War II but with a time-travelling twist – it has an exciting plot and I haven’t a clue what will happen. Yet it’s less enjoyable, the prose is stodgy and I’m struggling to get to know the characters.

Now, to me, the plot in a novel is analogous to software design, whereas the story telling is analogous to the implementation code. Whilst I’d prefer good story telling with a weak plot to a great plot with poor prose, the opposite is true of software – good design trumps good implementation code every time. That’s where software and fiction are so different – software is alive and will be maintained and extended throughout its life, whereas a novel is frozen in time the moment the author deems it finished. You can always re-implement badly implemented pieces of code – but it’s a much bigger task to re-work an entire design.

1 Comment

Filed under Programming

One response to “Software code should read like well-written prose

  1. Pingback: The Nuances of Well Named Boolean Methods | iBuildMVPs.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.