• "U" (unregistered)

    primero

  • (cs)

    This looks like standard VB code to me.

  • joe (unregistered)

    secundero

  • justsomedudette (unregistered)

    Stupid American spelling it's cheque, thank you very much.

  • (cs)

    Erm, I may be missing something here (as I never wrote much VB, luckily), but apart from shoddy naming conventions and somewhat roundabout way of doing things, is this really WTF code?

    I mean, having a translation method that cannot parse 'zero', and doing it in the calling method, that's a bit silly. The redundant check on uppercase, well, that looks like it used to be a parameter but got rewritten, not really that much of a WTF either. The triple conversion from string value to cents, at least I see the logic behind it. All in all, the method looks to me like it does exactly what it needs to, without bugs, and without fun things like 100-item switch cases or using floats for money representation.

    I guess what I am trying to say, is that this looks shoddy, but hardly WTF level shoddy, at least to someone not familiar with VB; am I missing something?

  • Doctor_of_ineptitude (unregistered)

    Seeing "ByVal num As String" always makes me happy, even if it is snippet from a bank that may or may not handle my money and may or may not cause directly or indirectly cause economic crisis. It means work is still there for decent programmers.

    On topic, where is the WTF? A relative of the owner wrote a crappy piece of shit, which was caught at the first gate (there was code review for outsourced code by a competent authority). Where is the WTF?

  • (cs)

    Article probably left out the part where Adam was told that the code is good enough, just put it in production, because the boss's cousin's wife's brother's kid says he's a great developer and doesn't need his code reviewed.

  • AAA (unregistered)

    What's the WTF here? It's not great code, but it's not terrible. I'd hate to work with Adam. Judging by his comments, he's very passive-aggressive. Code review pro-tip: say what's wrong with the code ("convoluted control flow", "bug when converting", etc), make constructive suggestions ("Can be expressed better as [whatever]"), and leave out the rest.

  • (cs) in reply to AAA

    My code review comments always start with, "Have you thought about...". Start from the assumption of competence, no matter how much evidence you have to the contrary.

    And we all know TRWTF is writing code review comments directly into the code.

  • kpcrash (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    Article probably left out the part where Adam was told that the code is good enough, just put it in production, because the boss's cousin's wife's brother's kid says he's a great developer and doesn't need his code reviewed.

    Because it turns out that the boss's cousin's wife's brother's kid is the President's daughter.

  • Chuck Lester (unregistered)

    The WTF is that you don't say "uno peso", it's "un peso".

  • martin (unregistered)

    TRWTF is Adam is a flying dick.

  • Andy (unregistered)

    Maybe the guys not the best VB programmer in the world, maybe he's not up on the finer points of boxing and unboxing. If it passes the tests, and is fast enough, its good enough.

    The tests need tightening up on the point Adam noticed, fair enough, amend the tests and the make the code pass.

    Everything else is a matter of style, we might agree with Adam on most of the points, but there's no need to frame everything so negatively, Adam comes out sounding like a git with a superiority complex, by making the original coder look bad, he forces him onto the defense

  • (cs) in reply to martin
    martin:
    TRWTF is Adam is a flying dick.

    Succinct :D I like it!

  • (cs)
    ' Nice conversion from a string to an integer to a decimal. No reason
    ' to go straight to decimal. Yes, the purpose is to get just the
    ' dollar portion, but really?
      dollars = CInt(num)
    Dollars? In Mexican money? Surely "peso portion" would be better. And the function name is bad for another reason: it doesn't do anything with Spanish money (Spain uses the euro, and even before that it used the peseta, not the peso).

    The fundamental WTF here is that the unnamed (and only marginally identified) "coder" was left to hack something together, and so he did. The resulting code fails the desirability criterion on multiple grounds, while being nowhere desperately bad, but the WTF is in the management process by which the code was created, not in the code itself.

  • Bruce Johnson (unregistered) in reply to justsomedudette

    I translated it so that certain portions of the readership would be able to understand it.

  • Andrew (unregistered) in reply to justsomedudette
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Stupid British spelling. Americans don't have time to put extra vowels in their words; too busy making money and running the world from over there.
  • oppeto (unregistered) in reply to Andrew
    Andrew:
    Stupid British spelling. Americans don't have time to put extra vowels in their words; too busy making money and running the world from over there.
    Stupid Americans, for apparently taking a measurable amount of time to type one additional letter.
  • Dave H (unregistered) in reply to Andrew
    Andrew:
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Stupid British spelling. Americans don't have time to put extra vowels in their words; too busy making money and running the world into the ground from over there.

    Fixed that for you.

  • bored_again (unregistered)

    I thought it said SpanishMonkey at first.

  • bored_again (unregistered) in reply to FragFrog
    FragFrog:
    Erm, I may be missing something here (as I never wrote much VB, luckily),.......snip........ I guess what I am trying to say, is that this looks shoddy, but hardly WTF level shoddy, at least to someone not familiar with VB; am I missing something?

    You start off with a comment that makes VB sound inferior but then go on to ask WTF is. This is why poor code can be written in any language. If you cannot see a plethora of WTF's then I would wager that we will be seeing your code here soon, in whatever god language you code in.

  • QJo (unregistered) in reply to Andrew
    Andrew:
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Stupid British spelling. Americans don't have time to put extra vowels in their words; too busy forging money and ruining the world from over there.

    FTFY

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to justsomedudette
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Well I just chequed it on Google Translate and en Espanol it's comprobar!!!
  • Jim the Tool (unregistered)

    I thought this was going to be about Bitcoin. (The Real WTF is that the USA still uses cheques. And cotton/paper money (instead of plastic money).)

  • Mike (unregistered) in reply to Andrew

    Or more than the necessary number of teeth in their heads.

  • (cs) in reply to Dave H
    Dave H:
    Andrew:
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Stupid British spelling. Americans don't have time to put extra vowels in their words; too busy making money and running the world into the ground from over there.

    Fixed that for you.

    George Soros is Hungarian.

  • (cs) in reply to operagost
    operagost:
    Dave H:
    Andrew:
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Stupid British spelling. Americans don't have time to put extra vowels in their words; too busy making money and running the world into the ground from over there.

    Fixed that for you.

    George Soros is Hungarian.

    I think you'll find he's an American citizen.

    So, either you can disown EVERY immigrant citizen and take the view that all their great achievements are the product of other nations, or you can accept that he is in fact American (in which case you can claim some ownership on all that other good shit).

  • Ben Jammin (unregistered) in reply to justsomedudette
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    When some sales guy decides to branch out to England, we'll get the boss's cousin's wife's brother's kid to help with the translation to English.

    (In a weird coincidence the boss's cousin's wife's brother's kid turned out to be the Queen's daughter.)

  • (cs)
    Stupid British spelling. Americans don't have time to put extra vowels in their words

    They are our words not yours (the Language is ENGLISH) If you don't like the way our language is structured get your own :-)

  • (cs) in reply to ip-guru
    ip-guru:
    (the Language is ENGLISH

    Well, in the case of "cheque" the language is FRENCH. You're just borrowing it. At least Americans had the decency to Anglicize the word.

    And don't get me started on "colour". Latin and Old French (which are how the word entered English) both spelled it "color". Modern French has chucked a few vowels into it, turning it into "couleur", because that's what French does. They love their extra vowels.

    So I honestly have no idea what you Brits are doing, beyond imitating the French, and poorly, I might add.

  • (cs)

    But none of this is germane to Adam’s story.

    Or, in fact, happened at all.

  • amet (unregistered) in reply to Remy Porter
    Remy Porter:
    ip-guru:
    (the Language is ENGLISH

    Well, in the case of "cheque" the language is FRENCH. You're just borrowing it.

    If the English people say the English language works that way then it does, by definition. It doesn't matter where the inspiration came from.

  • neminem (unregistered)

    Yeah, I'm with people saying this doesn't really look all that terrible, and that while yes, it does have some bugs in it that should have been fixed, the real wtf is Adam's attitude.

    Who hasn't accidentally left in a few hardcoded values in things that were supposed to be localized?

    That said, the other wtf is specifically localizing for Spanish, rather than doing a general refactor for generic localization, which would probably not have been too much more work and would have left them with the ability to expand to other markets, too. (Just not rtl-using markets. That's a whole nother story, work-wise. RTL is a pain.)

  • Herr Otto Flick (unregistered) in reply to Remy Porter
    Remy Porter:
    ip-guru:
    (the Language is ENGLISH

    Well, in the case of "cheque" the language is FRENCH. You're just borrowing it. At least Americans had the decency to Anglicize the word.

    And don't get me started on "colour". Latin and Old French (which are how the word entered English) both spelled it "color". Modern French has chucked a few vowels into it, turning it into "couleur", because that's what French does. They love their extra vowels.

    So I honestly have no idea what you Brits are doing, beyond imitating the French, and poorly, I might add.

    Because the word is supposed to end with a soft o. 'colour' rhymes with 'her', if you spell it 'color' it rhymes with 'whore', unless you use arbitrary pronunciation rules.

    When that traitorous thunder cunt Webster wrote his dictionary, he arbitrarily changed the spelling of lots of words, in order to make his English less English. By dropping the u from colour, making it's pronunciation less clear, he was saving America from being in thrall to Europe.

    He also changed "women" to "wimmin", and "medicine" as "medicin".

    No, I don't get it either.

  • Thanatos Complex (unregistered) in reply to Herr Otto Flick
    Herr Otto Flick:
    Because the word is supposed to end with a soft o. 'colour' rhymes with 'her', if you spell it 'color' it rhymes with 'whore', unless you use arbitrary pronunciation rules.

    When that traitorous thunder cunt Webster wrote his dictionary, he arbitrarily changed the spelling of lots of words, in order to make his English less English. By dropping the u from colour, making it's pronunciation less clear, he was saving America from being in thrall to Europe.

    He also changed "women" to "wimmin", and "medicine" as "medicin".

    No, I don't get it either.

    To be fair, the pronunciation of the word "women" makes no fucking sense.

  • (cs) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Well I just chequed it on Google Translate and en Espanol it's comprobar!!!
    I won't bother explaining the joke for those who don't get it, but I will add that the correct translation to Spanish is cheque (which comes from the English cheque, according to the DRAE).
  • hrezs (unregistered) in reply to Jim the Tool
    Jim the Tool:
    I thought this was going to be about Bitcoin. (The Real WTF is that the USA still uses cheques. And cotton/paper money (instead of plastic money).)

    we're a very environmentally friendly nation.

  • (cs) in reply to pjt33
    pjt33:
    ¯\(°_o)/¯ I DUNNO LOL:
    justsomedudette:
    Stupid American spelling it's cheque, thank you very much.
    Well I just chequed it on Google Translate and en Espanol it's comprobar!!!
    I won't bother explaining the joke for those who don't get it, but I will add that the correct translation to Spanish is cheque (which comes from the English cheque, according to the DRAE).
    ¿K?
  • Indignant sheep (unregistered)

    The WTF is obviously a 29 peso limit. Using historical data from 1990 to today, 29 pesos equalled anything from $1.88 to $10.79 US - so not a large amount.

  • (cs) in reply to Indignant sheep
    Indignant sheep:
    The WTF is obviously a 29 peso limit. Using historical data from 1990 to today, 29 pesos equaled anything from $1.88 to $10.79 US - so not a large amount.

    The limit of 29 was because that is the highest number the dude could count to in Spanish. Presumably he couldn't remember the word for 30.

  • (cs) in reply to eViLegion
    eViLegion:
    Indignant sheep:
    The WTF is obviously a 29 peso limit. Using historical data from 1990 to today, 29 pesos equaled anything from $1.88 to $10.79 US - so not a large amount.

    The limit of 29 was because that is the highest number the dude could count to in Spanish. Presumably he couldn't remember the word for 30.

    And apparently he hadn't heard of Goggle Translate.

  • Thanatos Complex (unregistered) in reply to Steve The Cynic
    Steve The Cynic:
    And apparently he hadn't heard of Goggle Translate.

    Goggle Translate = "gafa"

  • (cs) in reply to Herr Otto Flick
    Herr Otto Flick:
    ...unless you use arbitrary pronunciation rules.
    English is such a mishmash of other languages. Our pronunciation rules follow suit.
    Herr Otto Flick:
    ...making it's pronunciation less clear...
    We do have spelling rules. That's not how you spell the possessive form of "it."
  • (cs) in reply to bored_again
    bored_again:
    If you cannot see a plethora of WTF's then I would wager that we will be seeing your code here soon, in whatever god language you code in.
    Try reading my comment again. I can see plenty of questionable approaches, but nothing that would make me go "WTF?!". Judging by some of the other comments here, I am not alone in this assessment.

    With my last remark, I merely wondered whether there might be a much bigger 'WTF' in there; for example, if VB.net has a build in localization library capable of doing the entire conversion, then I would consider this block a pretty big WTF. But a mere hard-coded constant barely raises an eyebrow, not after having seen horrors like 20 nested for-loops, or hard-coded strings for each amount of money the system could process.

  • Paul Neumann (unregistered) in reply to Herr Otto Flick
    Herr Otto Flick:
    Because the word is supposed to end with a soft o. 'colour' rhymes with 'her', if you spell it 'color' it rhymes with 'whore', unless you use arbitrary pronunciation rules.
    [Have you considered...] Either use proper IPN, or compare to commonly pronounced words which actually end in 'or' and 'our' respectively to illustrate your point.

    Also, this is English and American English of which we debate. Arbitrary pronunciation rules are the more common than naught.

  • Paul Neumann (unregistered) in reply to eViLegion
    eViLegion:
    The limit of 29 was because that is the highest number the dude could count to in Spanish. Presumably he couldn't remember the word for 30.
    It would be awesome if we could see the code which was actually in error. I spent the entire article trying to figure out how 29 was a limiting factor in any of the cited code.
  • ThatSlyQuarian (unregistered)

    Color is fine as it is since "our" is not pronounced the same as "er" which is why her and hour sound different. Color could get the same effect being spelled colar ar or coler borrowing from her. Thats why English phonetics are terrible. They are reliant on context clues, (read, reed, red, read), intonation (Hey someone put something in my drink!, Hey someone, put something in my drink?) and weird especially regarding the placement of I and E in words.

    Phoenettically ghoti is an acceptable alternate spelling of fish. This is why English is one of the harder languages to learn. But At least we don't give our words genders. (im looking at you French)

  • (cs)

    “English doesn’t borrow from other languages. English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.” ― James Nicoll

  • (cs)
    1. find Adam
    2. Wolverine has retractable claws
    3. make Adam a content editor on this site

    This code is definitely full of WTFs. They're all fairly basic WTFs, but they cause the code to fail at certain points (between 1 and 9 cents, inclusive), and there are a lot of poor designs. Nothing outrageous, but you can tell that Adam has seen a lot of it. When your company starts to hire people for cheap to write incorrect code, you know it's time to update your resume. It's half the reason why I left my last job.

  • PierreSimonLaplace (unregistered)

    The passive aggression hurts. Code comments should not be indistinguishable from Reddit comments.

Leave a comment on “Habla Currency”

Log In or post as a guest

Replying to comment #:

« Return to Article