Hesitate or Haste ( A developer’s experiences)


Developers are slaves of deadlines. In the pressure of doing things on time we make mistakes. Sometimes mistakes made to save few moments cause us loss of hours. Below are two of my such experiences.

First Case Study

Originally the code was like this

if(condition)
         callFunction(A);
else
        callFunction(B);

Due to some requirements I changed it and in haste forgot to change if on all function usages. Some days later it took me hours to figure out the problem.

if(condition)
         callFunction(A,newArgument);
else
        callFunction(B);// Forgot to add newArgument

Second Case Study

Originally it was coded in haste like this.

foreach(items as item)
      item->setValue(complexFunc(0));

The function complexFunc is iterating over the rows from a table. Initially when the data set was small the delay was not significant.

Months later the client started to complain about the delay in script execution. At this point of time the developer who originally wrote the code was unavailable so another developer was assigned the task to optimize the script. Again this developer took hours to understand the requirements, find the bottle neck in the code and fix it.

val = complexFunc(0); // complexFunc is now called once rather can calling it for each time
foreach(items as item)
      item->setValue(val);
Advertisements

I am a web developer working @ Gaditek

Tagged with:
Posted in Computer And Internet, Programming & Development
One comment on “Hesitate or Haste ( A developer’s experiences)
  1. Kevin says:

    I have made such mistakes as well due to pressure of deadlines. However I suppose such types of mistakes can be caught by code reviews. Both by self and by peers. Some time should be alloted before every commit to the repository to do a careful reading of the changes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: