Saturday, April 09, 2005

How much code do we reinvent? Is this productive?

The problem

Many times, we have found ourselves writing a piece of program that in a way we felt, it would have been better just to get it somewhere and discover later that it was written, the problem was adressed previously, even more professional and that we have wasted important development time on a solution that just reinvented the "cold water".

The possible causes

Well, it seems that there are more perspectives:
- background
- didn't know
- I know better

Let's take each.

Background is the cause discovered by Alistair Cockburn, in Agile Software Development. He said that we are taught in each stage in school, not to copy from other but to come up with our own solutions. This is basically a good thing ... in school, but in the business of software, we are hired to deliver software on time. Reusing is a critical thing, so many times instead of reinventing is just better to look around for existing solutions and possibly use them.

Didn't know

Most of the times, we didn't know that the problem was already discovered and adressed by someone else. So, instead of looking around , we start direcly to develop the code, come up with our unique perspective, as taught in school and mentioned earlier. This combination of the two factors above can be damaging to the project as important time is missused.

Did know, but ignored as I know better

This is probably the most damaging behaviour of all. I believe people can come up with better solutions to particular problems but what I want is to take a good look at the alternatives, before deciding that they are not usefull. Just think that the chinese empire sent out on the sea some explorers on the beginning of the XV century, which had major competitive advantages to european expolorers (They built ships 4 times the size of Columbus's). But after 4 years, they were withdrawn from the seas, thinking the "the outside world doesn't have anything to offer to China". Well, it looks as Columbus just looked a little better before deciding, doesn't it?

Don't take me for a fan of "copy/paste" programming. I am a big fan of balance. I do not want to go into the extreme of copy/paste as probably this might be the main obstacle for invention. I am a fan of balance, a fan of getting the appropiate solution for the situation, which may be either "copy/paste" or write from scratch.

Conclusion

I believe that a solution would be just to take a closer look before making the decision of writing or reusing, and this must be made publicly known to every programmer. Every programmer must know that is it allright to copy/paste, but not make a purpose out of it. Every programmers must be told about the two alternatives and incouraged to use them, as in time he will get experience and will balance this choise better and better.

1 comment:

Dan Bunea said...

Thanks, that gives me the strenght to go further :)