About Us
Education and Training
Consulting
Gifts
Contacting Us
Employment
Journal
Journal

Home

The Pantheon Systems Journal
Falling into Patterns - Three Stories
Niranjan Ramakrishnan

The Gang of Four book on design patterns is one of the alltime bestsellers in the arena of object-oriented literature. It made its reputation by collating and codifying what several individuals had practiced and assembled over the years as programming idioms or strategies. It makes for easy reading, particularly if you have been doing OO programming for a while, because you can see many of the techniques you have used in the past now showcased with impressive names.  

The authors have done an excellent job of providing guidelines on when to use which design pattern, although the recommendations may not always appeal to every reader. They have also been fair to present the pros and cons of each pattern. 

In upcoming columns we shall explore some of the design patterns in the light of everyday examples. In this column, I just want to share something that has often struck me as odd - how we see everything else falling into a pattern, but somehow consider our own selves immune. 

Story 1 

Consider this old sufi tale - A friend, returning home late one night, finds Mulla Nasruddin, a sufi of yore, outside, apparently searching for something under a lamp post. He asks the mulla what he is looking for, and the mulla tells him he has dropped his wallet. After searching fervently for a good while without success, the friend asks, "Doesn't seem to be here - are you sure this is where you dropped it?" "No, it was over there", says the mulla, pointing some distance away. The friend, now aghast and not a little irritated, explodes, "Then why the *%&%^&* are you looking here?" 

"Because", explains the mulla patiently, "this is where the light is!" 

Chuckle all you want at the mulla's statement, but allow also that it is not that far afield from our own patterns of action. Which of us has not worked on something that's 'interesting', to the postponement of essential though boring chores? 

Story 2 

The second story takes place in a railway compartment. As the train begins to move, the four strangers travelling in the compartment get talking to each other.  

Passenger A asks Passenger B, "Where are you headed? 
B replies, "I'm going to Bean City".  
"How 'bout that", exclaims A. "I'm headed there myself".  
"Where in Bean City?", asks B.  
"Espresso Street", comes the answer.  
B is astounded. "Amazing", says he. "That's where I'm going too. Maybe we can share a taxi...What are you going there for?" 
"To attend a wedding." 
"That's bizzarre. Me too!"
By now two other passengers are thoroughly intrigued - what are the chances, on a transcontinental train, of two strangers in a compartment heading to the same street? 
    "Where are you from?" continues A. 
    "Raintown", replies the other. 
    "This is funny", comes the answer. "So am I!  Don't tell me you live on Oxford Street..." 
    "As a matter of fact, I do", says the other. 
     
And on it goes,  until one of the other passnegers can take it no longer. "But, dammit, you must have met...", he says. At this A and B chuckle.  "We're father and son", says A. "We always make this conversation to just to pass the time on train journeys."  Seem ridiculous? Then consider this. Six year old Johnny is invited to his friend's birthday party next door. A formal invitation card arrives by the mail, RSVP included. Johnny's parents write an equally formal acceptance note back. On the appointed hour, little Johnny reaches his friend's party, present in tow, which he formally hands over. At the end of the party, the birthday kid's mom hands over goody bags to all the young guests. On reaching home, Johnny calls to thank his friend for the lovely surprise in the goody bag...A day later, a letter arrives, thanking Johnny for his lovely present.  

Story 3 

The Olympic sprinter is awakened by a noise noise in the middle of the night. Creeping downstairs, he spots a thief just getting ready to slip out through the basement window. He yells, "Stop, thief", as he runs towards the intruder, who, now alerted, drops the booty and runs. The sprinter follows. A hot chase ensues, as the thief proves to be amazingly quick on his heels. It takes every ounce of effort for the sprinter to draw close, but draw close he does, finally, true to his Olympic credentials. "Gotcha" he exults, as he triumphantly overtakes the thief. 

Was it that long ago that you spent half the night tracking down that low-priority bug to satisfy your ego/curiosity, putting on hold the really important bug you should have been tracking? 

Patterns are good because they help us identify an approach for the problem as a whole. They are wonderful and useful and snazzy - no home should be without one and all that - but we do need to examine them periodically to see if they still apply to our problem - if they ever did.  Otherwise we run the risk of 'falling' into a pattern rather than using one.  The three stories above,  like the millions of others invented throughout human civilization, serve as gentle devices to snap the  mind out of what Rabindranath Tagore called the dreary desert sand of dead habit


Top
Journal Archives | Send Feedback

CopyrightÓ Pantheon Systems, Inc. All rights reserved.