Archive for October, 2005

"Premature optimization is the root of all evil." -Larry Wall, creator of PERL

amit October 22nd, 2005

I got a mail from Gent, my boss, reminding us (all developers at nSoftware) about the evils of optimization. The quote is originally attributed to C.A. Hoare, restated by Knuth, and I guess restated by Larry Wall. It reminded me of a bunch of quotes on Perl …


"Perl is the only language where you can bang your head on the keyboard and it compiles."
-anybody who has programmed more than 100 lines of perl can attest to that.

"Normally, Perl minds its own business about your programming habits."
Chapter 4 of Programming Perl

A good language should try (and I mean real hard) to make some sense of anything thrown at it and should not dictate programming style. Leave the readability, maintainability and all the other ..ilities to the programmer, sometimes we are high on weed, on most other occasions we know what we are doing.

A good example of this approach is the private members in python and perl, they are inaccessible by style and convention (they are named a certain way, and its uncool to access them from outside the class), not enforced by a NAZI compiler.


"Just because there’s more than one way to do it doesn’t mean that all ways are equally cool."
Learning Perl, Ch. 16

The compiler does not enforce indentation or naming conventions; I have seen few badly indented programs with bad variable names. It’s simply not cool to do so.


"Is there an ISO or ANSI certified version of Perl?"
Certainly not. Larry (Wall) expects that he’ll be certified before Perl is.

http://www.perldoc.com/perl5.6/pod/perlfaq2.html

Compare the IEEE specs with RFC’s. The former precise in their language, incomprehensible in their intent, the latter scattered with inaccuracies (“MUST NOT”, “SHOULD NOT” etc), yet easy to understand. Loose standards are good they foster interoperability; albeit with hacks. Rigid standards, even though precisely defined are evil.



"Many people, when confronted with a problem, will think, ‘Ah! I’ll use a regular expression!’ Now they have two problems. And then they think "Ah, well I’ll just read the documentation", and then they have three problems."
-perl

“Let’s say the docs present a simplified view of reality… -)
-Larry Wall

Documentation is simply a crutch holding up a lame API. Intellisense is the most documentation you can afford and for some of us (vi and emacs people) even that is a stretch. Why can’t you simply read my mind?

Dealing with Mr. Tima

amit October 10th, 2005

It is dark, gloomy and raining. I have nowhere to go, no one to meet, absolutely nothing to do. It’s the perfect weekend afternoon. It’s time to indulge, search for the path of greed and riches, comprehend the essence of capatalistic America. It brings joy to my heart and a smile to my face.

My quest – a get rich scheme; an easy way into the bulging pockets of the average American consumer. Initially my mind is clouded with strange ideas maybe I should travel, interact with diverse people, get a different perspective, hone my skills with a degree in management. Then I focus. First, I don’t want to destroy my pleasant afternoon with thoughts of activity, and second, its the twenty first century, quest means search and search means Google. Simple.

Google has never disappointed me, not only can I find anything, I can prove anything. It’s right there on The Internet. Sure enough within minutes I find this poll on The Internet.
What does an average American household spend more on?
a) Grocery
b) Gadgets
c) Pets
d) Traveling
This brings a knowing smile to my face. It has to be gadget’s and me being an engineer, it clearly sums up to millions in my bank. This is where things start heading south. I pick the obvious and check the results – 85% for (c). What the hell! “Pets! dogs, cats and monkeys – these stupid, callous Americans how can they ignore all the suffering in the world and spend their money on monkeys. Glad am not one of them.” Then to make matters worse, that dastardly Mr. Tima shows up. I just hate the guts of the guy.

Mr. Tima : “Aha! so the Americans do live up to their reputation, spending more on pets than even on traveling. One would think that seeing the world would help them be more cosmopolitan and understanding of world affairs.”

Me: A bit circumspect, one can simply not trust Mr. Tima even when he appears to be on your side. “Yeah! even if they don’t want gadgets they could at least spend on traveling. But No! that would make them realize how fortunate they are, and how insensitive they can be to those who have nothing. They would rather waste their money on a monkey.”

Mr. Tima: “Yup! if only someone would educate them of all the charitable and humanitarian aspects of spending money on jumping off planes, eating in restaurants even though you hate the food – just to avoid cooking, or to ..”

Me: (Thinking) Is it too much to ask for the simple pleasure of criticizing people without having fingers pointing back at you. I hate this moron.
(Loud) “Hold it. Hold it. No reason to get personal here. Besides you obviously haven’t heard of a certain Mr. Charles Darwin and his Theory Of Evolution. You can’t compare spending on monkeys and my higher tastes in life.”

Mr. Tima: Smiling and agreeable as ever. “Of course not. Thanks for educating me about the evolved human tastes of being lazy, indulging in activities like skydiving that benefit none, not even the doer and coveting more than you need. Now I know what they mean, when they say God made man in his own image.”

Me: “It may be true that we have our weaknesses but even you wouldn’t deny that humans are the most gifted of all His creations. We are not only the most intelligent of all beings, but exhibit the highest degree of higher emotions like love, kindness, generosity, joy and compassion.”

Mr. Tima: “I couldn’t agree more. Humans are gifted and intelligent indeed. All of God’s creation’s are imperfect, including man, just as you said. But man on the other hand has created the omniscient, omnipotent entity with absolutely no shortcomings.”

Me: (Thinking) Uh! Oh! I don’t like where this stupid conversation is going. Is he trying to shake my faith now.
(Loud) What do you mean? Man created who?
(Thinking) Damn it. Shouldn’t have said that.

Mr. Tima: “Oh! God of course. You do realize that there is not ONE proof of God’s existance that is bereft of human subjectivity. Be it the books Bible, Koran or Geeta, or the prophets Jesus, Mohammad or Buddha. But I must say a most wondeful and glorious creation. It provides strength, hope, a reason for virtue and convenient way to dismiss responsibilty.”

Me: (Thinking) God, a human creation. Have I been keeping my hands of the candy jar – even when nobody was looking – for nothing. My whole life, all those candies. Damn it! I want my freaking heaven. Of course there is God, and good things happen to good people and all those things. What does this moron know.
(Loud) “You !@#$. Bloody heretic. God will punish you. You will burn in the fires of hell – forever. In fact I am surprised why lightning hasn’t fallen on you this very moment. You should NEVER, EVER entertain such thoughts.”

Mr. Tima:
“I agree entirely.”

Me: “That you should burn in the fires of hell!”

Mr Tima:
Smiling, “No, that we cannot entertain such thoughts. Man needs God to protect him from his own shortcomings. He needs him till he is strong to virtuous by himself.”

Me: “Whatever. Let’s just step back to where we were. So you were saying that wasting money on those damn monkeys is comparable to spending or rather using money for our own enjoyment.”

Mr. Tima: “No! You are interpreting this all wrong. I am simply ‘suggesting’ that maybe you should teach these people worthiness of self indulgence over love for a pet or shall I say ‘monkey’ in your terminology.”

Me: “Mr. Tima I am going to be frank with you. You are an obstinate, moron with weird ideas. So instead of arguing I am going to offer a truce. Let me have my canopy, an airplane and the modest pleasure of a sky dive and you and all your monkey loving friends can have their monkeys .. err.. pets.”

Mr Tima: With that annoying all knowing grin on his face. “Ok!”

Me: (Thinking) Phew! I wish there was a way to get rid of Mr. Tima once and for all. The bastard spoiled an excellent afternoon. Now where was I, the get rich scheme. Maybe I should think of a product for the monkey loving crowd…

If you have never made your acquaintance with Mr. Tima, you are truly blessed. You should avoid running into him at all costs. He has many aliases, is easily found in the company of certain people, stay away from them. If you have found a way to get rid of him or at least wipe out that smirk from his face. Spread the word, there is no greater service.

P.S: Mr. Tima has since convinced me that heaven is not the goal. The goal is to realize the strength (which exists in all of us) to make our own heaven. I don’t regret keeping my hands of the candy jar. :)

Investing for Dummies from a Dummy

amit October 9th, 2005

Like most people I know little about investing in stocks and can spot good ideas only in hindsight. But this time I am going to predict my earnings based on just common sense and good feeling. No thoughtful analysis or recommendations from gurus and so forth.I am going to invest 300 (AM dollars*) in Microsoft (MSFT) and hope to make 400 AM dollars in 6-8 months. My reasons are:

  • It is close (24.59 at the close of the market on 7/10/05) to its lowest it has been in about 2yrs.
  • I have heard they have huge cash reserves (I personally have not verified this).
  • They are going to come up with new products next year, which knowing Microsoft are definitely going to create a huge hype.

There you have them. Now that you have been warned, you might want to rush to your broker early Monday morning. I assure you a bid worth 300 AM dollars is going to drive up the price.

* AM Dollars are Amit’s dollars which means the conversion rate is set by me. I prefer these than talking in terms of percentages.