varusword75 wrote:
Gbaji,
You shouldn't be so eager to take in the as*; at least make them take you out for dinner first.
WTF? How did a relatively uncaring "what's this?" question equate to me getting some hot **** sex? Seriously. A coworker's family member died yesterday right as some serious bugs in some production code he'd written became painfully apparent. As the only person somewhat familiar with what said code is supposed to do, I got to fix the bugs. But never fear! I've got said nifty thingie changing to the right colors and putting the right text in the right boxes when it's supposed to, and actually kinda doing the right thing. Of course, in order to support said fixes, I had to re-write sections of two other scripts I'd written (this is really more "rolling into production" code), so it was a busy afternoon.
And today, I discovered that some quick patch I'd written like 5 years ago finally ran into a situation in which it created a false test and ran some new beta software version off into the land of not-workingness. I'd long since written a more elegant way of parsing software versions for this tool, but had never gone back and applied it to that one line (mostly cause it had never broke anything until today), so not a disaster, but still "fun".
So yeah. I'm kinda like superman, even without the **** sex. Um... what were we talking about?
Oh. And for those vaguely interested, the "ugly" bit kinda didn't have anything to do with what I was directly working on. It just made the code ridiculously difficult to follow. The guy has a strange concept of "code base". He tends to write subroutines for doing various things for a number of similar programs, and then just copies and pastes them all into anything he writes so that they'll all be there (yeah. I'm boggled by that too!). Sadly, since he incorporated this after writing a half dozen very similar things, there's literally 2 or 3 slightly differently named routines which do slightly different things (or the same thing but in multiple places). And I don't mean that there's just a few duplicates. I mean that about 50 routines are each duplicated a couple times, each with slightly different logic to them. And good luck guessing which one is actually being called by the code you're trying to debug. It's pretty funny actually, when you aren't tearing your hair out.
And the arrays. He starts with a couple of files with some fields in them, each representing a piece of hardware. The fields contain things like vendor, type, name, location, etc. He then explicitly parses them into an array named for specific vendors and types and locations in order to present changing menu options to the customer. Of course, this means that he has to change his code anytime new meta data is introduced into the source files. Completely unnecessarily, since he could just pump them into generic arrays as needed, or just dump the whole thing into a hash and use that. Or... well... any of a number of better and more portable and scalable solutions.
I'd rewrite it from scratch, but my brain might just explode...