Riddle me this! WTF



  • At one of our weekly meetings, the manager solicited volunteers for short and sweet code snippets to be used in interviews. The plan was to assemble examples and inject bugs into them for our interview candidates to chew on. Three of us, including a recent hire pseudo-named Dvorak, agreed to split up the work and come up with 3 (or more) samples each. The plan was to inject a wide range of bugs ranging from obvious to sneaky.

    The samples were submitted and subsequently used on several interview candidates. After a few days word spread around that a handful of the samples were unfairly taxing on our candidates. I didn't think much of it until one day I walked down the hallway found a few developers huddled in a circle with printouts in hand. They were laughing and giggling. I heard mutterings of WTF.

    I asked "Hey guys, what's up?"

    "You've got to see the samples Djvorak submitted."

    I checked out the samples and noticed an unusual number of bugs, convoluted logic, and just plain weird class design. One sample included a C++ class implementing a generic storage container for binary data, which included a public method returning a pointer to its internal buffer that stored the data--completely nullifying any sense of encapsulation. I noticed there was a put method but no corresponding get method. The class was supposed to store binary data, but the sole put() method expected a string so the driver code needed to serialize the data into a string. Another line of code freed dynamic memory by assigning NULL to a pointer. The comment on the side "// need to free memory" confirmed this was intentional. The list of bugs and weirdness simply went on and on seemingly having no end. It turned into a game seeing who could be the one to find the last bug.

    I said "OK, so this is the buggy copy. Where is the solution copy?"

    A developer blurted out, giggling. "That is the solution copy! Hah-hah-hah-hah!"

    Dvorak would later be dubbed the Riddler. He lasted a 2 years because he was the manager's pet. The rest of the team absolutely dreaded having to touch anything Dvorak worked on because it would become a torture sentence requiring days of your time burning up your brain cells figuring out how his Rube Goldberg contraptions worked. This resulted in him working alone on projects. After the manager who protected him quit, he was let go for quality reasons due to several production disasters involving his code.



  •  Sounds like someone switched his keyboard while he wasn't looking.



  • I remember we had someone who used to assign null to pointes to free them. The argument was that assigning null would inform the garbage collection that the memory was no longer referenced and thus freed. The only problem was that there was no garbage collection, it was Embedded C on an AVR micro which had 1KB of Flash.

    It didn't even have a heap !



  • @Mole said:

     I remember we had someone who used to assign null to pointes to free them. The argument was that assigning null would inform the garbage collection that the memory was no longer referenced and thus freed. The only problem was that there was no garbage collection, it was Embedded C on an AVR micro which had 1KB of Flash.

     Maybe he's just not used to working on embedded systems. That's a perfectly acceptable technique in normal C, since the OOM killer is a kind of garbage collector.



Log in to reply