A plea for simplicity … in all things

October 11, 2009

My tolerance for complexity — in all things — seems to be decreasing with age. And I don’t believe it’s the onset of dementia. Quite the contrary, I attribute it to wisdom gained with considerable experience

Brian Kernighan, one of the authors of the ‘Unix’ computer language, wrote:

Debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?

Computer programs always have some degree and complexity, and usually are not exactly correct.  They are born with “bugs”, and the task of debugging is about finding those flaws of logic that lead to wrong behavior in certain — perhaps unusual — cases.  If the program is written in a clear straightforward manner, with visible structure, and an appropriate number of explanatory comments, the debugging process will be much easier.  But if the program is written with clever tricks — perhaps taking advantage of some esoteric facts about the number system — debugging will be difficult or, as Kernighan suggests, impossible.

I used to travel widely, delivering to computer programmer audiences a talk entitled “On being lazy, absent minded, and a great system developer”.  I explained that being lazy meant that once I’d developed some code that worked, I’d take time to document it carefully, and package it so that it could be re-used in other larger programs in a natural way.  Thus I would do something well, once.  Being absent minded meant that I’d often lose track of where I was in the coding or development process.  To compensate, I’d have to write a plan first, and document any changes to that plan as I proceeded.

With these definitions, all the developers and analysts in my audiences could affirm that my qualities of laziness and absent-mindedness — as I compensated for them — were excellent qualities!  In fact, what I’d spelled out are two best practices for writing code.  A program consisting largely of well written and already debugged small sub-programs will almost always be more reliable than one written as a new mass of virgin code, and intelligent comments are an important compliment to the code itself.

I asked my audiences for a show of hands, how many spent much or most of their time debugging or updating other people’s code.  Most raised their hands.  Then I  asked how many found that code to be unclear, unstructured, hard to read, and difficult to  modify in a safe reliable fashion.  Again, most hands went up.  Finally, I asked how many were rewarded in their performance review for writing such high quality code — instead of just for writing lots of lines of code that seemed to work.  This time the hands stayed down.

Evidently, although we recognize that complexity is almost unmanageable, we’re too often unwilling to invest in simplicity.  And simplicity is the product of good design.  I believe that the underlying issue is our reluctance to understand the importance of design.

I’ll have more to say about this in future posts on this blog.

5 Responses to “A plea for simplicity … in all things”

  1. Dave Mitchell said

    After visiting your office I’m undecided if it is complex or simple. Both you and Aaiyn are simple and complex at the same time. Simple seems such a nice idea but a difficult path to follow. ALL of our lives are much to complex to be made very simple. Possible but not probable —
    Aaiyn says you need a vacation. I think she needs one to. Get simple. Come visit us sometime.

  2. chris green said

    Very true. In science and engineering there is also an old saying which goes something like “what is done well with some effort, is done better with less, and best of all with the least effort possible”.

    In computer systems, this translates to the solution that achieves all the necessary requirements of the task with the least lines of deliverable code is the always the best. Extra superfluous lines of code can always be added to this optimal solution without changing the functionality, but lines of code cannot be removed without degrading it, because the optimal solution contains nothing superfluous.

    Mr. Chris Green MBCS CITP
    Honorary Treasurer
    British Computer Society (BCS)
    Birmingham Branch

  3. Carl Verbiest said

    “On being lazy, absent minded” is the best talk I ever attended at e PUG Challenge or Conference. I was already a strong advocate for the KISS principle “Keep It Simple (and Stupid)”, stupid so that you don’t have to be a genius to understand the code, the program, the documentation, … . Most of the time people, not just developers, are rewarded for getting things done on time. By the time internal flaws such as complex, hard to understand, coding poses a problem they are frequently no longer involved.

  4. Michael Wilber said

    This is something I wish they had covered in the Computer Science program I went through.

    Because programmers almost always work in teams, each programmer absolutely has to work with other people’s code. I agree that simplicity is extremely important so that other programmers can more easily understand code they did not write.

    When I write code, I frequently ask myself questions like “Does this code make sense?”, “Is another programmer likely to misunderstand what my intent was?” and “Is there any way I can make this simpler and easier to understand?”

    I wish more people placed a high value on simplicity.

    You might like the book “The Laws of Simplicity” by John Maeda. Although very short, it is an interesting examination of how to make things simpler


  5. Matt said

    Found your blog on Bing and was so glad i did. That was a quick read.

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: