the Falcon team.
At some point we hit the "and why does that work like that?".
It was because of copy and paste, or as I think of it in code as
"evolution by the lucky". When code is well documented, encapsulated,
or just plain understandable one developer will copy and paste it to
another section of the code.
Now where does the lucky part come it? My description sound more like
survival of the fittest?
Well now let us insert reality. Sometimes someone copies and pastes
code because they believe it is doing what they want, and they don't
always get it right. Other times there is a flaw in the code that
isn't found for some time. Survival of code occurs because of luck.
In a single code base you can solve this with libraries. Instead of
copy and pasting code, reduce the logic into some reusable function
In the open source world, this may span projects. I remember years
ago looking at a problem in performance for a customer in their ftp
server and they were using Proftpd. What did I discover? They were
running into a similar problem that had been solved before in Apache.
What is the common denominator? Proftpd had copied the Apache
Copy and paste back in the code from Apache.
Easy fix :)
The good thing is that today the Apache malloc code can all be found
in a library that is a standalone component from Apache called the APR. So anyone who wished to adopt
the malloc calls today could just use the library.
But this is only one case, look around, you can find more.
I once used LibaryMagic because "everyone else did". I didn't realize
that it made a system() call to another application to do PDF's. That
turned out to be "no so good".
A resolution? Don't reuse code? No, do, but study it beforehand. Make
sure you know how the library or snippet of code works. Don't just
copy and paste and assume the last guy was right. When you find a
problem don't just solve it for your case, provide patches.
Find where the code exists and replace it there as well.
Make the code a bit more lucky.
Apologies to the memory of Stephen J. Gould to reducing his concepts
down to "survival of the lucky". If you haven't read any of his books
I would recommend them. I find that evolution as a theory finds its
way into many natural aspects of the world, including the creativity
found in developing code.