notfred wrote:I found several bugs in his code (which admittedly he did address) whilst looking at why some of the queries took 15 minutes, put some proper indices in and had them running in sub 15-seconds. I was branded a trouble maker for complaining about the extra complexity of his code which improved things from 15.1s to 15.01s.
Too true. All too true.
I remember my first job, straight out of university: we were writing a billing system (don't ask, or I'll have to go find some brain bleach.) Amongst other things, this system had to interface with other systems - passing details about financial transactions and the like, using delimited text files (sometimes fixed width, sometimes CSV, sometimes a brain dead abomination from the pits of hell.) I worked on a fair chunk of these interfaces; in fact, I wrote the first or second one that was implemented.
My colleagues copied and pasted the code into their work when they had to do their own interfaces. (Experienced programmers at this point will be laughing hysterically, if they aren't sobbing into their drinks.)
Cut to several months later. We discovered a bug in one of my interfaces, which I duly fixed. A week or two later, I was assigned another bug report. "Hmm - this looks familiar." Sure enough. So I went to management, and told them the situation; I wanted to move the duplicate code into the superclass, and use inheritance to override whatever behaviour varied between interfaces (which, for the functions in question, was very little), because I believed that there was a near certainty that the bug would appear in all
the other interfaces, and it would be easier in the long run to do that, even allowing for the fact that it would require running tests on all the interfaces rather than just the one affected. They knocked me back. "We don't have time, just fix the bug you've been assigned."
No prizes for guessing what happened next.
So when somebody asks me what makes a good programmer, my response is simple: knows when, and how, to reuse code (making it generic if necessary), rather than copying and special-casing it in dozens of different spots. Not the whole story, it's true, but it's definitely a big part of it.
For the record, it was that job that burnt me out on programming and had me head into the realm of systems administration, which brings its own unique headaches, but that's a tale for another time.