If it's not the simplest coding task, you should also test it

by andrei 14. November 2008 19:03

We are optimistic by nature, but sometimes we should just be professional.

 

Here is one situation I see repeating from time to time (to me, or my fellow developers). I have a coding task (small development, small bug, doesn't matter), and I know exactly what needs to be done in order to solve it. I know that functionality very well, I am familiar with that code, the confidence is high. I could make the change with my eyes closed, and it would solve the problem for sure.

I make the change, and for some reason I decide that nothing can go wrong and I don't need to test it. For me, some of these reasons are:

  • I have to get to something else quickly
  • I don't have enough patience to test it right now
  • the client needs this change right now

I quickly commit the change on SVN, move on and forget about it.

 

The result, a few hours or days later?

I can't believe it! I didn't realize that [something bad related to the change].

If I'm lucky, the person who observes the problem is someone from our testing team. Unfortunately, if I install the change directly on the production environment (due to client pressure) I can't be lucky.

But... if I'm lucky, the change does not break anything new. It just doesn't work, because it needs an additional change in order to work. Again, sometimes I am not lucky.

 

Here is why this happens: we are not computers, and we can't calculate all the implications in a situation unless it is very simple and without implications. Also, we sometimes forget things.

In software, actions generate effects. If you rely on your mind to control these effects, you will run into problems. In order to be efficient, you need to test the result in an objective way: the simplest (and usually slowest) method is to run the application and see what happened after the change, the sophisticated (and correct) method is to have automated tests.

So, unless you are changing the text in a label, resist the pressure / temptation and test the change before doing the commit.

 

 

Enjoy programming!

 

I am putting together a set of concept lists for the main programming techniques, which should help developers learning or using them to be more efficient. Here are the techniques in progress:

Please feel free to leave any comments or suggestions which could make these lists more useful for everyone.

 

 

Also, if you are interested in learning these techniques you can try the developer training modules.

Again, please feel free to leave any comments or suggestions which could make the training modules more useful for everyone. We are having great results with them at Akcedo (so they really work), but they can always be improved. Also, if you would like to use the modules or are already using them and you want to discuss about the process feel free to comment and ask questions here.

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.4.5.0