• Tsaukpaetra (disco)

    Oh syntax highlighter, how we love thee...

  • Fox (disco) in reply to Tsaukpaetra

    Those comments are pretty hilarious when read as code. Also,

    so instead of spending five minutes to clean it up, he spent 30 seconds adding another if statement.

    :doing_it_wrong:

  • Tsaukpaetra (disco) in reply to Fox
    Fox:
    :doing_it_wrong:

    Yes indeed. Perpetuating the :WTF: without even opening a new backlog ticket to note intent to repair.

  • Fox (disco) in reply to Tsaukpaetra
    Comment held for moderation.
  • DocMonster (disco) in reply to Tsaukpaetra
    Tsaukpaetra:
    Yes indeed. Perpetuating the :wtf: without even opening a new backlog ticket to note intent to repair.

    And then get reprimanded later for adding a time wasting ticket to the queue when there's "real work" to be done.

  • Quite (disco) in reply to DocMonster
    DocMonster:
    And then get reprimanded later for adding a time wasting ticket to the queue when there's "real work" to be done.

    If you're that chicken-scared of reprimands, you don't deserve your position.

    Seriously, TRWTF is perpetuating the vileness. This, of course, is probably what everyone else has done, and continue to do, which is why Apo has got another 300 urgent customer issue to attend to. They may well be caused by exactly such sloppy code.

    "I haven't got time to install a toilet, I'm too busy cleaning excrement off the floor."

  • RFoxmich (disco)

    Unfortunately, he was tackling the problem while juggling 300 other higher priority customer issues, so instead of spending five minutes to clean it up, he spent 30 seconds adding another if statement.

    TRWTF was not having the budget to prevent him from havnig to juggle 300 other high priority customer issues..therefore dangling the temptation of a quick 'fix'.

  • RFoxmich (disco) in reply to Fox

    Monsignor ...

    I do believe the monsignor's finally got the point.

  • dkf (disco)

    So does MGM represent a microgram, a milligram or a megagram?

  • CoyneTheDup (disco)
    Comment held for moderation.
  • Steve_The_Cynic (disco)
    Comment held for moderation.
  • FrostCat (disco) in reply to Tsaukpaetra

    I worked as a subcontractor on a government job once, and that was the policy. The project was really huge, and there was one guy who a large part of his job was to code review everything checked in to source control. He insisted that people do the absolute minimum of changes, and not touch anything else, because it made things like diffing changes more work for him. (I think the root of his reasoning was that we had to maintain multiple live branches for different customer and there was a lot of merging and this cut down on stuff he had to consider for potential merging to the various branches.)

  • FrostCat (disco) in reply to Fox

    It turns out that the idea that everyone ignored Kitty's screams for help is not exactly true, but I don't remember the details.

  • FrostCat (disco) in reply to dkf
    dkf:
    So does `MGM` represent a microgram, a milligram or a megagram?

    mu--it represents the filmmaker Metro Goldwin Meyer.

    <body isn't the same
  • Wukl (disco) in reply to dkf

    Or a megagram-meter?

  • ThingGuyMcGuyThing (disco)

    I honestly don't see the problem with leaving this. The stacked statements are a bit ugly, but it's readable and maintainable (assuming the number of values doesn't climb too high). I wouldn't write the original code, but I also wouldn't bother rewriting it if I came across it.

  • PJH (disco) in reply to Tsaukpaetra
    Tsaukpaetra:
    Oh syntax highlighter, how we love thee...

    Yeah; I found it highly distracting to read as well...

    [image]
  • kjordan2001 (disco)

    TRWTF is of course SAP...

  • PJH (disco) in reply to kjordan2001
    kjordan2001:
    TRWTF is of course SAP...

    As pointed out in the article:

    The Article:
    This might be a bit shorter than our usual CodeSOD, but this is a winner for WTFs-per-word, I think. No source control. Stupid code. Honest, but still stupid, comments. **And SAP**. Oh, and follow on developers compounding the problem. **And SAP**.
  • rc4 (disco) in reply to Steve_The_Cynic
    Steve_The_Cynic:
    **30 seconds** spent hacking in another if() statement **is** **five minutes** too long.

    :wtf:

  • kjordan2001 (disco) in reply to PJH

    Well, it can't be overstated on how much of a WTF SAP is ;)

    Also, that's in the HTML comments of the article which I didn't read.

  • Developer_Dude (disco)

    Welcome to my world of thousands of hardcoded string constants, used and not used (sometimes defined multiple times, sometimes also hardcoded in the logic, sometimes defined in a constants class), with multiple if/else statements, used in hashmaps to pass args, and so on.

    Always a mess and a hassle. And no, five minutes won't clean this mess up - maybe five months.

  • HardwareGeek (disco) in reply to kjordan2001
    Comment held for moderation.
  • boomzilla (disco) in reply to FrostCat
    Comment held for moderation.
  • PJH (disco) in reply to kjordan2001
    kjordan2001:
    Also, that's in the HTML comments of the article which I didn't read.

    That author is well known (well, sorta) for sticking stuff in comments in their articles.

  • Dragnslcr (disco) in reply to RFoxmich
    RFoxmich:
    > Unfortunately, he was tackling the problem while juggling 300 other higher priority customer issues, so instead of spending five minutes to clean it up, he spent 30 seconds adding another if statement.

    TRWTF was not having the budget to prevent him from havnig to juggle 300 other high priority customer issues..therefore dangling the temptation of a quick 'fix'.

    But if each of those 300 high priority issues can be fixed in 30 seconds, he should have no trouble getting through all of them in one day.

    </manager>

  • DCRoss (disco) in reply to Dragnslcr
    Dragnslcr:
    But if each of those 300 high priority issues can be fixed in 30 seconds, he should have no trouble getting through all of them in one day.

    And if he can't, then we can just assign two new developers to work with him and get everything done in a third of the time. Easy.

  • Sacr (disco)

    Actually, using a hash map where 4 trivial if-else statements do the job is neither more readable, nor more performant, so using a hash map would have been TRWTF.

  • dcon (disco) in reply to PJH
    PJH:
    That author is well known (well, sorta) for sticking stuff in comments in their articles.

    He's trained me to look at the source for all articles now...

  • PJH (disco) in reply to dcon
    dcon:
    He's trained me to look at the source for all articles now...

    He's the only one I bother doing it for - have any of the others been caught doing it?

  • dcon (disco) in reply to PJH

    I catch some once in a while... Can't remember exactly who - hence I just check all.

  • Jonathan_Harston (disco)

    Kelvin Gigabytes? Some sort of measurement of temperature-dependant memory storage?

    Mole Gigabytes? Some sort of mesurement of the number of molcules needed for memory storage?

  • NedFodder (disco) in reply to Jonathan_Harston
    Jonathan_Harston:
    Mole Gigabytes?

    That's 6.022 × 1023 Gigabytes.

  • Fox (disco) in reply to NedFodder

    602 Zettabytes :Q___

  • Alvaro_Lopes (disco)

    Implementing three comparisons as an Hash Map would be a performance and memory killer.

    Additionally, MGM stands for what ? MegaGrams (Tons) ? Milligrams ?

    Definitely, not an Hash Map. And a clever comparison would be searching first for "GM" at offset 1 and then compare the other three variants at offset 0.

    Apparently you all don't know how an hash map is implemented.

  • dkf (disco) in reply to Alvaro_Lopes

    If it's just 4 comparisons, and they're never going to change, what's here is reasonable, if rather soul-destroying. If the set of supported units is likely to change, or the mapping isn't fixed, then another solution is less miserable.

  • RFoxmich (disco) in reply to dkf

    None of those are acceptable scientific unit abbreviations involving grams.

    microgram: μg milligram: mg Megagram: Mg

    MGM as was suggested earlier must be a unit of movies - the Metro Golden Meyer. Which is also neither a CGS nor MKS unit.

    There is some non-scientific standard that says that MGM is obsolete mg and that the correct usage is now ME This, however is not science but some body calling itself the produce trace-ability initiative

  • Alvaro_Lopes (disco) in reply to dkf

    You have to weight the impact if more "replacements" are to be made, that is for sure. May be feasible for let's say more than 6 entries.

    Problem is TFA clearly suggests using an hash map on this particular case, which will only add memory usage, and processing will be about the same (that surely depends on the hashing function and how many other items exist [their size being most important]).

    Alvie

  • dkf (disco) in reply to Alvaro_Lopes
    Alvaro_Lopes:
    May be feasible for let's say more than 6 entries.

    For a small fixed set of values, whatever. Almost any technique works wonders when used with minuscule N.

    However, what really matters most of the time is the cost of maintenance, given that modern computers are actually incredibly fast (and would be faster if they didn't run monstrosities like SAP, but I digress…) Something slightly slower to execute might be justifiable if it makes it possible to do other things more easily. It is entirely possible that using a mapping table kept externally might make adapting to changing requirements simpler, or it might mean you can get rid of having special cases and instead keep a more generic processing engine.

  • CoyneTheDup (disco) in reply to Steve_The_Cynic
    Comment held for moderation.
  • prueg (disco)

    Are you all under the impression that the three if statements (four including the outside if) in the article represent the entire function and :wtf:, and hasn't been trimmed down from thousands of similar lines? YMBNH.

    Yeah, if there are three comparisons, what they have is perfectly fine and there's nothing to see here, move along. However, if they have hundreds of such comparisons, then using some kind of hash map (probably nested map / dictionary, based on the outside if statement) would make a lot more sense for maintainability, if not also performance.

  • Fox (disco) in reply to prueg

    All of this.

  • cheong (disco) in reply to Fox

    IMO, modifying the code to switch statement shouldn't need more than 30 seconds too, unless the "if" lines are more than what's shown here.

  • CoyneTheDup (disco) in reply to cheong
    cheong:
    IMO, modifying the code to switch statement shouldn't need more than 30 seconds too, unless the "if" lines are more than what's shown here.

    That's 30 seconds. Then there's the...

    • Work request
    • Customer engagement form
    • Project plan
    • Design document
    • Architecture review
    • (code change)
    • Code review
    • QA documentation
    • QA meeting to review the changes
    • QA testing
    • Implementation plan (including back-out)
    • Technical documentation
    • Installation
    • Post implementation review
    • Post implementation announcement document

    ...there's probably more; any good enterprisey company can come up with them by the dozens.

  • cheong (disco) in reply to CoyneTheDup

    Oh the bureau crazy... :cry:

  • herby (disco)

    Just for reference, a Mega Gram (Mg) is better known as a "metric tonne". No it isn't the element Magnesium in this context.

  • dkf (disco) in reply to CoyneTheDup
    CoyneTheDup:
    there's probablymany more

    FTFY :sob:

  • caffiend (disco)
    Comment held for moderation.
  • caffiend (disco) in reply to herby
    herby:
    Just for reference, a Mega Gram (Mg) is better known as a "metric tonne". No it isn't the element Magnesium in this context.

    You can also chain them together. I once had to fix some PLC code where the original author had obviously lost his mind. He defined a unit of energy known as MILLI_KILOWATT_HOURS, in order to store fractional kilowatt hours in a UINT32. Poor bastard.

  • caffiend (disco) in reply to CoyneTheDup
    CoyneTheDup:
    That's 30 seconds. Then there's the...

    You missed the FAT, EAT, SAT, CAT, UAT and any other acceptance test that hasn't yet used a letter of the alphabet.

    These are great, cause they create an opportunity to restart the entire process if any of them fail.

Leave a comment on “Leaving an Honest Comment”

Log In or post as a guest

Replying to comment #:

« Return to Article