Friday, April 10, 2009

Three principles learned from Coding Gurus

The practical lore of good coding is often passed down slowly in the ritualistic tribal dances of software architects, project leads, analysts, and more experienced programmers. However, these three handy principles serves all the programmers who want a comprehensive, easy-to-use guide to software development:
  1. Don't trust retellers, get hold of the original sources - Importance of Original Knowledge

    A new monk arrived at the monastery. He was assigned to help the other monks in copying the old texts by hand. He noticed, however, that they were copying copies, not the original books. The new monk went to the head monk to ask him about this. He pointed out that if there were an error in the first copy, that error would be continued in all of the other copies.

    The head monk said, 'We have been copying from the copies for centuries, but you make a good point, my son.' The head monk went down into the cellar with one of the copies to check it against the original.

    Hours later, nobody had seen him, so one of the monks went downstairs to look for him. He heard a sobbing coming from the back of the cellar and found the old monk leaning over one of the original books, crying.

    He asked what was wrong.

    "The word is '
    celebrate,' not 'celibate'!" sobbed the head monk.

  2. A real programmer always takes care of both "if" and "else" cases. So should we - The knowledge of What if "else"

    Before going to bed a programmer puts on his night stand two glasses: one with water and one empty. When his wife asked him "why?" he said:

    "One with water is there in case I wake up at night and I feel thirsty".

    "How about the other one?" - still not getting the point asked his wife.

    "Oh! This is in case I wake up at night and I am not thirsty!" - replied the programmer.

  3. Don't get trapped in infinite loops. Always provide an exit condition - Knowledge to know where to stop

    A programmer didn't show at work on Monday. After three days of not having any news from him his colleagues started to worried and have decided to go visit his place to see what could happen.

    After 30 minutes of ringing the bell and knocking the door, they broke into his house and found him in a bath tub, sitting in cold water, absolutely bold staring at an empty shampoo bottle that he held in his hand. He didn't reply any question his friends were asking him, nor even noticed their presence. He simply was continuing looking at the shampoo bottle label in a manner of zombie.

    When his friends managed to take this bottle out of his stark hands, they could read the following instruction: "Pour a small amount of shampoo on a palm of your hand, work through wet hair. Rinse.
    Repeat."

No comments:

Post a Comment