Thursday, September 13, 2012

Simple v. Complicated

I borrowed this from, so I kept the first word as a link to the original.
I hope that's okay with them.


  [sim-puhl]  Show IPA adjective, sim·pler,sim·plest, noun
easy to understand, deal with, use, etc.: a simple matter;simple tools.
not elaborate or artificial; plain: a simple style.
not ornate or luxurious; unadorned: a simple gown.
unaffected; unassuming; modest: a simple manner.
not complicated: a simple design.

My hot words are "simple" and "complex."

Most people who say "simple" don't mean simple. They mean "easy", with an implied "to think of" or "to type in" or "to do without researching."  Easy is a virtue, but it's not the same virtue as "simple."

Most people who say "complex" don't mean complex. They mean "not easy to read." A very simple piece of code may be hard to read or hard to understand. Clarity is a virtue, but it's not simplicity.

I would love to start a worldwide movement to make these words more specific in daily usage.  Please consider the code virtues as a starting point.  Here's what we say there:
We like to think of simplicity as a measurable attribute, consisting of the number of unique names and operators in a given code component (class, method, function, subprogram, etc.). Some people have suggested that we call this virtue “structural simplicity.” That works for us.
Simple, then, doesn't mean easy or easy to read. It means uncomplicated. It has the minimal number of concerns, terms, and operations. It could be inobvious and hard as hell to read, and still be simple.

A design could be complex (have several intertwined concerns) and yet deemed easy to understand by its developers, who are familiar with all the intertwined concerns.  Complexity is a measure of how many parts and concerns have been woven ("complected") together. It's not a measure of the programmer's understanding.

Likewise, a design might be easy to conceive or easy to implement, and not be simple by any measure. It might be another layer of cruft on the accumulated cruft of decades of maintenance coding.   Simplicity is a measure of the state of the code, not the effort of the developer.

Now, I know that popular use is muddled. Simple means "readable" or "easy to write" to various people, but I think if we help tidy up our use of the word, we can actually have measures of simplicity and complexity that can help us produce quantifiably better code.

Readability ("clear" v. "confusing") is subjective, but it might be a combination of real simplicity and good naming -- it might be decomposable to more measurable and objective concerns. Wouldn't that be great?

A little rigor here, at least in our use of words, might lead us to something really great.

1 comment:

  1. I would assume you have seen Rich Hickey's talks on the subject? As well as Stuart Holloway's talks?

    Adding links here for anybody who hasn't encountered them as well.

    Rich Hickey - Simple Made Easy ->

    Rich Hickey - Simplicity Matters ->

    Stuart Holloway - Simplicity Ain't Easy ->