Monday, November 26, 2007

My New Favourite Analogy: Design Like Water


I am a big fan of analogies and metaphors. When I think of a good (or funny) one, it is often the very definition of a good day.

Well, I discovered a doozie. Influenced by positive reviews from several corners, I have been reading a bit of the book Getting Things Done. Though only mentioned in passing at the beginning, GTD mentions a beautiful idea.


Mind Like Water

The book describes an image from Karate: Mind Like Water. The idea is that, in Karate, a state of perfect readiness is having a "mind like water". Water (e.g. a lake) responds perfectly to a disruption; that is:

Water reacts appropriately and then returns to a calm state.

If one throws a pebble into a pond, there's a ripple, then calm. If one lobs a boulder, then there's a huge splash, then calm. The reaction fits perfectly, and the disruption is dismissed.

Design Like Water

For me, that is a beautiful analogy for all kinds of things in computer science. This is all very subjective, and hard to quantify, but consider this:

Shouldn't a software system (e.g. web application) be designed like water? i.e. A small number of requests should be a pebble; perhaps a Superbowl TV ad spawns a massive boulder. But in all cases, it should react appropriately and then return to a calm state.

Some real world examples include the Big Databases and the massive e-commerce sites. One doesn't hear of eBay or Amazon "being rebooted". They're designed like water.

What about computer languages? Though hopelessly whimsical, it strikes me as beautiful: a language should barely react to small things. It is allowed to require a big splash for big things, but ultimately it should shrug off the disturbance and provide calmness.

Specifying examples for languages is much more difficult, because the idea is so abstract. Long time readers will predict, correctly, that I'll offer Python as an example. It's a big pond of OO, functional capability, and brevity that seems to react appropriately to both pebbles and boulders.

What do you think? Do you buy the metaphor? If so, which languages resonate for you in this philosophy? Does Java or C# ?

6 comments:

  1. We programmers also like to dream about requirements frozen like ice...they're usually more like water, though.

    I'm pretty sure Google rebooted last Thursday, during Thanksgiving dinner, when nobody would notice.

    Bad jokes aside, I'm keenly interested in finding ways to make distributed apps more fault tolerant. I deal with outages every single day and it's very annoying. I want the "grid" to self heal when one particular node dies.

    ReplyDelete
  2. @eric: The latest episodes of Software Engineering Radio (http://www.se-radio.net/) are about "fault tolerance patterns." I find it really interesting.

    @code: I find your association of GTD to calm water interesting as I live my life in the opposite extreme of GTD---leaving things undone. And the water is the theme of the bible of leaving things undone, "Tao Teh Ching":

    8:1 "The highest form of goodness is like water.
    Water knows how to benefit all things without striving with them.
    It stays in places loathed by all men.
    Therefore, it comes near the Tao."

    Also, calmness is a property of "water in the small." Water in the large is never calm. Rivers flow, lakes and seas and oceans have currents.

    ReplyDelete
  3. Requirements like water, be serious it's more like vapor (or is that smoke). An interesting idea, for sure. I will give this some deep thinking... I think...

    As Always...

    ReplyDelete
  4. The Tao of Water is indeed a beautiful idea. If you want to learn and think more about it, I would suggest you look into precisely that - Taoism. Not the superstitious part of it, but the more philosophical sides. Pick up "The Tao is Silent" by Raymond Smullyan. Also, most books by Alan Watts talk about these kinds of ideas.

    GTD is really the last source I would go to to learn about this concept.

    ReplyDelete
  5. @Eric. That explains why Google uses fancy holiday banners: to distract us from the searches timing out.

    @Weiqi. Thanks for the thoughtful comment...

    I once took a class in world religions. That quote of "water being near the Tao" is cool and resonates with me as being quintessential Tao (per my modest, simple understanding).

    It's just a thought experiment but I think that "water in the large" works for the metaphor. Big systems, and water, can give the appearance of being calm but there are undercurrents and swirls of massive activity. Almost like a giant organism.

    @DES. Vapor = water. ha ha

    @Daniel. Thanks for the reference. Though certainly no one is suggesting GTD as a Tao introduction. It just mentioned the idea. I don't even remember how it ties it into the GTD mindset.

    ReplyDelete
  6. ps. I just realized that GTD, which essentially espouses "harmony through strict adherence to a system of rules and procedure" is actually much closer to Confucianism than Tao.

    It's ironic that the author mentioned the water analogy.

    ReplyDelete