Wednesday, June 13, 2007

Code quality

Computers are good at following instructions, but not at reading your mind
Dr. Knuth surmised this and the following snippet of a java code written by a professional programmer demonstrate this. What the programmer wanted was to find if the string value is empty. Look at the way computer is told to determine this:

// check for empty value
static boolean isEmpty(String value) {

Boolean isEmpty = new Boolean(false);
if ((value == null) || (value.length() == 0))
isEmpty = true;

return isEmpty.booleanValue();

}
Do you see, why I like to be in this profession and what I hate about it!
:-)

Thursday, June 07, 2007

Truth ...

Though leaves are many, the root is one;
Through all the lying days of my youth
I swayed my leaves and flowers in the sun;
Now I may wither into the truth.
 - W. B Yeats