Monday, June 1, 2009

Fishing in the Desert – 1


Hi Folks!!


I kept you waitin for a while abt the story... Lemme continue from where I ended in Fishing in the Desert- 0. They faced some sand dunes and now they were equipped with enough expertise to foresee that 2 major sand storms were inevitable.


It was time for combining the modules written by the two oor-coders – that means first sand storm had arrived. The code was so compatible that, it was giving every possible kind of error at random points in the code. Sometimes memory leak, sometimes bbiiiig error values and so on.


As they were expecting it, they were prepared mentally for the sand storm and had enough reserves of water (patience, test cases, innovation, etc.). Each of the guys were a lil doubtful of their own code (such confidence naturally accrues to professional coders like them). A sample discussion about the error between them loooked smth like this:


Oor : Something is wrong man!!

Stup-pid : (In his mind) Oh Really! I din't know...

(Aloud) Are u sure that there are no errors in the x.cpp file u've written?

Oor : (Fully Confident) Yeah man! Of course...

Stup- pid : Pucca??

Oor : (Doubt in mind starts dominating) Er! I mean.. it should be man!! where is the chance of error in such simple logic?

Stup-pid : (In his mind) Simple logic? Let's see when we find the bug...

(Aloud) But I've checked each and every line of my code and everything seems to be ok

Oor : (Shrugs) So is mine...


Everyone's code is fine. Then where is the f***ing problem? Careful design of test cases did not help. Changing some parts of doubtful code did not help. But they ended up fixing a lot of minor bugs and allocated memory efficiently. By this time, they have used all their innovation and were devoid of reserves. They started losing hope of finding any fish. Despite the use of all their intelligent efforts, it was the f***ing BUG that won all the time manisfesting itself in a different form each time.


Finally, one fine afternoon, when both were chasing a prospective bug, the real BUG presented itself before them like an angel. Oor-coding was the culprit. No wonder the logic was so perfect and everything seemed to be in place. Ok. The error was : Stup-pid was stupid enough to send a pointer to a crucial variable to a function which modifies it. He happened to ignore the insignificant fact that it was actually modified there and proceeded using that variable as if it had it's original value. Put in simple words, a simple const keyword while passing the variable would have avoided the sand storm entirely...


Yeah.. of course, they were able to find and fix some minor bugs in the process but - “Should they slog so much to learn so little..?”

No comments:

Post a Comment