I was working for a local company, brought in to do some consulting work in PHP. Now, the guy that was there was the lone programmer in a group of graphic designers, so his code was never seen beyond him. Source control was FTP, comments were nil, and of course there was no documentation at all (not even a database diagram).
This guy had gone and implemented a CMS system that half worked, and ran it through a template engine that he wrote that barely worked. This system was slow, glacially slow. As a sole user on a pretty peppy dual proc 1ghz machine (extremely fast at the time), every page would take 6 seconds to build. I worked there for a while, and put in my time on developing some new modules for their system. A few months after that, I saw the developer of that project, and he said he found out why it was taking so long, it was running a loop, and going through about 7 million iterations parse the template file, he said that he got it down to about 2 million, and was pretty happy with that. I still can't comprehend 2 million iterations of a loop to parse through a 20-30k file.
My other story is during the dot-com boom. It was a new team that had never worked together before. We were building an e-commerce system and associated website for a banner ad company. I had built some cool scripts in GIMP that used the very under utilized daemon mode that would allow users to click around on a webpage and build their banners. Well, the problem was one of the other team members, building some other part of the site. We were on a death march to finish this project, and were months behind schedule. So one day, I needed a piece of his code to work a little bit differently, so I went ahead on in and tried to make the change on my own. I was completely shocked to find the whole code littered with labels and GOTO's. GOTO's were pretty much the only method of error handling, and did a lot of the logic. The second tragedy I found in the code was the use of strcpy() to copy the CGI arguments directly in to the buffers he was using. No strlen() checks, just a direct copy into statically sized buffers. During the next team meeting, I brought this up (not mentioning the poor programmer's name, whom had a salary of just about double mine), and that programmer replied: "I didn't think we were supposed to be writing production quality code."
Five months into the project, two weeks from delivery, and "I didn't think we were supposed to be writing production quality code." It really made all of those nights I got home at 5am, just to be back in to work the next morning at 9am seem worth it.
|