Every once in a while someone on any one of a number of forums I monitor asks the innocent question “how do I write a module to do?” Even I have given the answer “Check CPAN and you’ll find a module that does that already.” The answer I try to avoid is “Don’t reinvent the wheel!”
I have several thoughts on that statement.
Sometimes the wheel works fine.
To the left here is a stone wheel. I have my doubts that anybody actually made ox carts with stone wheels but that is certainly a popular idea. Even the TV cartoon series “The Flintstones” featured Fred Flintstone revving up his car that featured stone rollers fore and aft made of stone.
The one application I’ve seen for a stone wheel is at a grist mill. There are more modern replacements for aa stone millstone but I think that even today there is a charm and a quality that is lost with modern grinding wheels to mill grain.
That provides us with a very good example of a wheel that really doesn’t need to be reinvented, but someone decided to anyway and perhaps there were one or more advantages to using the modern version found.
Sometimes the wheel just needs to be improved.
One example of evolving improvements in wheels has been a really good thing. Like at the evolution of automotive tires over the last century. We are inventing better tires every years. Improvements in lifespan, tread wear, traction, foul weather handling and many others have been beneficial to all of us over the years.
Bicycle wheels are another area where the wheel has been improved over the years.
Sometimes the wheel won’t work at all.
Thinking about wheels I consider the lunar rover’s wheels. They are airless non-pnuematic wheels. Given that the Earth’s moon is an aireless environment this makes a whole lotta sense. I would imagine the stresses on an inflated tire would be a detriment and finding a way to eliminate the intrisic hazards of an air filled wheel is a good thing.
Other wheel designs I’ve seen aren’t even circles. I remember seeing a robot with “wheels” that consisted of three spokes each with a pad that was flat in one dimension and curved along its travel path. The wheels were installed in such a fashion that two pads were always in contact with the travel surface.
That’s reinventing the wheel in such a way that made sense of the application at hand which was to build a stair climbing robot.
Why code re-use?
I tend to be very lazy and can’t stand writing the same code over and over again. Similar to that line of thinking there are folks out there that have written modules (CPAN and other sources) that do the job very well. So “why reinvent the wheel” indeed. If I can plagiarize (with violating copyright or patent) I will. If a module does the job for me use it.
Summing my thoughts up I have to say that a knee jerk reaction doesn’t cut it. Use your common sense. If you need to build something to fit your needs do it.