Posts Tagged ‘common’

Stupid Mistakes I made

August 9th, 2009

Well this is about the unbelievable but honestly UN-intentional mistakes I made during programming. It might sound funny but true that we programmers (Intelligent techie geeks) often make some stupid and illogical mistakes. I beg to differ from those programmers who didn’t agree with this generalization. However, I often hear about similar silly mistakes been made by my fellow programmers and friends.

When program don’t run as I expected, I start debugging the program rigorously, looking at each line of code to find out what went wrong. Seldom, despite of my best efforts and hours of frustration, I cannot figure out the bug. After that I have to keep my programming self respect at bay and call upon my co-programmers to rescue me. Here comes the most embarrassing moment. The error has been found and it happens to be a missing “+” sign. It was in front of me
and I had gone through many times, still cannot figure it out. I had experienced this situation many times during programming. Here are some of them,

After one year of programming in PHP, one of my friends asked me for help on some C++ program. I wrote the program and emailed him. Next day I get call from him, telling the program is giving lots of errors during compilation. I checked the program and soon I realized that I had mixed PHP in C++. I had declared variables as int $xyz = 0; which should be without dollar sign (int xyz=0;). When I told about this to my friend, he advised me not to do similar things in PHP.

Next one took almost 2 hours to figure out that it was just a spelling mistake. The PHP program I made generates results with link. Everything is fine in the page except for some links on left sidebar. Those are not appearing as link on browser besides having anchor tag. While other anchor tags were showing correctly as links on browser these are shown as simple text. I checked again and again just to find the code was correct in every way. I tested it on all
browsers but result was same. Then my senior programmer pointed out a silly spelling mistake in my code. I had written <a herf=”…

Recently, I was working a lot in JavaScript for one of my project. While programming backend for the project, I encountered a strange problem. I was returning some text from database through Ajax. On the browser it was showing a big zero instead of text. After all the regular debugging I have to call my colleague. He smiled when he looked at my code. Soon I know that it was one of those embarrassing moments. I had used plus(+) sign instead of dot(.) sign to concate the strings in PHP. Plus sign is used in JavaScript for string concatenation.

Obviously, these were not my best days and this post is its going to spoil my portfolio. Anyways, I surely will be updating this post till I become perfect in programming. Also I am expecting some contributions in this from honest programmers.