• bvs23bkv33 (unregistered)

    to be or to be, that is a question

  • Quite (unregistered)

    A special case bodge while a problem was being fixed. The problem with HND was fixed, and the special case was partially removed by someone in a hurry who didn't have the headspace to tidy up properly. All unit tests passed for all country codes, and the harried deveoper moved onto the next urgent task.

  • LCrawford (unregistered) in reply to Quite

    All unit tests passed, but the code coverage report showed 50% coverage.

  • Appalled (unregistered)

    The IF legs are different. I can't decipher Regexes in my head. But if it's HND (Holland?) the THEN leg replaces "whatever" with a comma, everybody ELSE gets a period. So what's the problem? What's the WTF?

  • (nodebb) in reply to Appalled

    There is no country called Holland. HND is Honduras, which is definitely not the only country that uses a comma as thousand separator, instead of a period (if that is the functionality, I'm not sure).

  • Idort (unregistered) in reply to Appalled

    It says:

    if(a || a).

    Barely WTF, this is day-to-day tired-eyes inefficiency.

  • Niknelb (unregistered)

    The outsourced developer was probably based in Ireland - to be sure to be sure.

  • nah (unregistered) in reply to nerd4sale

    Indeed, this seems to put in thousands separators, such that:

    Honduras and Honduras gets commas All other countries gets periods

  • Appalled (unregistered) in reply to Idort

    Thanks Idort. Now I understand the WTF. My ("tired") eyes didn't pick up on the OR's being identical in the IF.

  • Church (unregistered) in reply to Idort

    Barely a WTF, yes, but the article size is appropriate to the size of the WTF, so I'll allow it.

  • Hasse the Great (unregistered) in reply to Appalled

    The country is the Netherlands. There are two provinces of North and South Holland. If you want to know more you can search on CPG Grey : the differense between the Netherlands and Holland .

  • my name is missing (unregistered)

    Technically the title should be This or This

  • Gummy Gus (unregistered)

    Way, way, way back my old CS professor told me that when he programmed a CDC 1604, the CPU was rather unreliable. So much so that it was standard practice to run all conditions twice just to be sure.

    This sounded nuts, much later I read that Seymour Cray bought the cheapest off-spec transistors for the 1604 and somehow got it to run, some of the time.

    With today's CPU's, you can simulate the same reliability by overclocking them lil they are on the edge of flakiness.

  • Quite (unregistered) in reply to Gummy Gus

    Run it twice as fast, and then, to make sure it works properly, run each command twice each? Mirth-inducing.

  • Idort (unregistered) in reply to Church

    Very glad this WTF has your holy approval, but I would disagree. It was allocated one weekday slot. That's the same "size" as every other TDWTF article (in terms of visitor attention).

  • Quite (unregistered) in reply to Appalled

    ... while my "tired" eyes didn't pick up the fact that the legs were different. So I was reading two identical alternatives to distinguish between two identical operations, which was entertainingly amusing.

    I still wonder whether it originally may have been "HND" and "HON" (both meaning Honduras, but one the ISO code and one the, er, not ISO code). This may have come about via the input data to be processed coming from two different 3rd party providers, one giving the country code as HON and one giving it as HND. Both are valid. Then one of the 3rd party providers changed their interface so as to give HND for Honduras instead of HON. Tired developer just hunted down the instance of HON and changed it to HND without noticing the other OR condition.

    A bigger WTF is hiding business logic in the code, where it makes better sense to do this sort of thing in a configuration file or something. One wonders how much more of this country-specific (or any other kind of case-specific) logic is hidden within the depths of the code.

  • DQ (unregistered)

    I think TRWTF is using a regex to insert thousand separators

  • snoofle (unregistered) in reply to Idort

    So if the same wtf is run again tomorrow...

  • Gummy Gus (unregistered)

    Many compilers would optimize away the double tests, unless either variable is marked "volatile". Also || is short-circuit, so if the first test succeeds, the second one isn't done. But still, probably a questionable snippet of code.

  • (nodebb) in reply to Quite

    "A bigger WTF is hiding business logic in the code, where it makes better sense to do this sort of thing in a configuration file or something. One wonders how much more of this country-specific (or any other kind of case-specific) logic is hidden within the depths of the code."

    I think the term you're looking for here is "Inner Platform".

  • Parts (unregistered)

    Parts is parts

  • kktkkr (unregistered)

    If you were wondering about that country code, now you'll Have No Doubt.

  • JJ (unregistered)

    You can't be too careful with Honduras. It's exploded under rough handling before.

  • Vic (unregistered) in reply to Gummy Gus

    In the mid 70's, a couple of the managers I worked for left and went to work for a startup which was building IIRC a computerized system for something which was something like a call center.

    I was invited over for a job interview as a programmer. They showed me the machine, and explained that they were doing hardware testing. I was told that this was the final tests; they were overclocking, and increasing the clock rate to see when the machine would fail, so they could decide how fast the clock would be set on the production machines.

    I slowly backed away.

  • Ulysses (unregistered)

    TRWTF is the ERV written by some dentist.

  • JC (unregistered)

    A case where the second IF becomes obsolete, but you keep it there so you know there were once two "IF"s and know that you can use multiple "IF"s there. Messy? yes. Useful? no. Unless you have no idea what you're doing.

  • Fernando (unregistered) in reply to Gummy Gus

    I think your CS professor may have confused redundant computing with reliable computing. Minuteman I missile silos included two redundant CDC 1604s.

  • Anonymous (unregistered)

    // We have to support both ISO 3166-1 alpha-3 and ITU codes because some idiots don't want to use ISO
    // -- Jack, 04/02/11
    String getCountryName(String countryCode) {
    if (countryCode == "ASM" || countryCode == "MSA") return "American Samoa";
    if (countryCode == "AGO" || countryCode == "AGL") return "Angola";
    // ...
    if (countryCode == "HND" || countryCode == "HND") return "Honduras";
    // ...
    if (countryCode == "ESH" || countryCode == "AOE") return "Western Sahara";
    }

  • Matt (unregistered)

    Now if they had proper unit tests and code coverage reports, they would have seen the missed code branch caused by the OR and possibly rectified it. :)

  • Sorry (unregistered)

    This was a required requirement by our redundancy department for redundancies.

  • Axel (unregistered) in reply to Vic

    In the early 80s I worked on an ECL (emitter-coupled logic) mini-mainframe. We designed for a 70nsec clock speed and verified it ran at 67.5nsec from 0C to 50C. For days. With no failures.

    They ended up slowing the clock to 75nsec before releasing to production. Very conservative company (and one whose name you would allrexognize).

    Back then, 14MHz sounded fast...

Leave a comment on “This or That”

Log In or post as a guest

Replying to comment #:

« Return to Article