No comment...



  • Many years ago, at an employer that no longer exists, I was given a project, "Here it's all yours."

    It had been under development for many years and was now "nearing production".

     Being the sort of person that I am, my first task was to read the code.  Not all of it, but certainly key points and representative samples.

    I was perusing one file (C code) that was a few thousand lines long that was a key point in the system, when I found a 400 to 500 line function that was a very key point in system.  And in the midst of this, several levels deep in the code structure was the following line:

     /* Comments removed for clarity */

    Ok.  I had the expected reaction.  Now comes the real WTF, it was probably correct.

    Originally the system had a three level hierarchy for the data with identifiers at each level Volume, Chapter, Section (VCS) with a single number torn apart into variables named appropriately.  However, the VP who originally designed this thing (and fancied himself a cool coder since he had written [7 or 8 years before] some of the original product code [in Basic]) suddenly changed his mind on the hierarchy and added a Shelf level (SVCS).  Now he figureed that they could just smash the old Volume and Chapter stuff into where the Chapter was in the original id numbers and put Shelf at the beginning and not have to do much...

    So, the code was a mixture of "volume" with shelf numbers, "chapter" with volume and chapter information from the original code and "shelf", "volume", and "chapter" from the new code...  and all of the old comments would have referenced the wrong names.

    And fun was had by all... or at least me.

    PS: the system was never successfully sold (thank goodness), and I moved on to other projects eventually.



  • mod: deleted moderation note for clarity. -dh



  • @skane said:

     /* Comments removed for clarity */

    I find that this is a lot like The Game. When people start gabbing on about how their code doesn't need comments because it "speaks for itself", it starts to gradually lose clarity.



  • @Schlagwerk said:

    I find that this is a lot like The Game. When people start gabbing on about how their code doesn't need comments because it "speaks for itself", it starts to gradually lose clarity.

    Some of the code I've been privileged work on actually does speak for itself.  Mostly because it looks like:

    Logger.log("Got to start!");

    Logger.log("Read from database.");

    temp = db.Read();

    Logger.log("Read successful");

    Logger.log("Increment value.");

    temp += 1;

    Logger.log("Increment successful");

    Logger.log("Inserting into database.");

    db.Insert(temp);

    Logger.log("Insert successful.");

    Logger.log("Complete");



  • Shakespeare was wrong. "that which we call a rose by any other name would NOT smell as sweet".

    Names ARE important.

    Sorry for the yelling, but I am very strong on this topic, both in work and personal life.



  • @HighlyPaidContractor said:

    Logger.log("Increment value.");

    temp += 1;

    Logger.log("Increment successful");

    <snip>

    I have this theory that people who write this sort of code then do a tail -f on the log file and masturbate to the output


  • @Rick said:

    Shakespeare was wrong. "that which we call a rose by any other name would NOT smell as sweet".

    Names ARE important.

    Sorry for the yelling, but I am very strong on this topic, both in work and personal life.

    Well, you know what they say.  There are only two difficult problems in computer science: Cache invalidation, naming things, and off-by-one errors.



  • @DOA said:

    @HighlyPaidContractor said:

    Logger.log("Increment value.");

    temp += 1;

    Logger.log("Increment successful");

    <snip>

    I have this theory that people who write this sort of code then do a tail -f on the log file and masturbate to the output

    That's all the more disturbing because I actually know the people who wrote the code that I paraphrased.



  • @Schlagwerk said:

    ...The Game. ...





    why did you do that... i had been winning for like 2 years

    http://en.wikipedia.org/wiki/The_Game_(mind_game)



  • @HighlyPaidContractor said:

    @Schlagwerk said:

    I find that this is a lot like The Game. When people start gabbing on about how their code doesn't need comments because it "speaks for itself", it starts to gradually lose clarity.

    Some of the code I've been privileged work on actually does speak for itself.  Mostly because it looks like:

    Logger.log("Got to start!");

    Logger.log("Read from database.");

    temp = db.Read();

    Logger.log("Read successful");

    Logger.log("Increment value.");

    temp += 1;

    Logger.log("Increment successful");

    Logger.log("Inserting into database.");

    db.Insert(temp);

    Logger.log("Insert successful.");

    Logger.log("Complete");

    We have a developer on our team who thinks he's awesome. When he writes code like the above, he always makes sure to comment it. Then he copy-pastes and changes code for 500 lines to copy and set some properties, when a 10-line method using Reflection would do the trick. Then he chastises the competent developers for not putting similarly useless comments in our own code.

    He's been a bit quiet of late though. Might have something to do with his last salary review, at which half of our dev team essentially said that he's worthless and any code of his that goes live is a danger to the system. Karma, she's a bitch.



  • Do tell, what did the other half do?



  • @henke37 said:

    Do tell, what did the other half do?

    They were too busy building the effigy to fill out the employee review.



  • @blakeyrat said:

    @henke37 said:
    Do tell, what did the other half do?
    They were too busy building the effigy to fill out the employee review.

    It's harder than you might think to find appropriately sized pitchforks and torches these days.  My pitchfork is only 3 foot or so (including tines).


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.