• Qrr (unregistered) in reply to airdrik
    airdrik:
    J:
    Rootbeer:
    TheSHEEEP:
    So.. other than the Gontractor not being able to write "Convert" correctly (which reminds of my predeccessor at work who always wrote "languarge")... where is the wtf?

    Illiteracy (and the lack of code comprehensibility and maintainability that come with it) isn't enough of a WTF for you?

    How about a programming language that doesn't short-circuit boolean 'OR' evaluation unless you use an operator called "OrElse"?

    Well, Or is equivalent to | and OrElse is equivalent to ||. They are exactly equivalent. Maybe you don't like the terminology, but syntactically, there's nothing weirder going on in VB.NET than any of the C-type languages.
    Fail! Yes the terminology is crap, no they are not exactly equivalent because "Or" doesn't perform short-circuiting (it can't because it is the bit-wise version) while "OrElse" does (because it is the logical version).

    Meant to quote this.

  • Garth Gaula (unregistered)

    Ghat Ghe Guck????

  • DavidN (unregistered)

    "OrElse" sounds a great command for avoiding that double minValue check...

    myValue = 94 if myValue = Integer.MinValue Or myValue = Integer.MinValue... //Just to make sure

    myValue = 94 OrElse! if myValue = Integer.MinValue... //Computer will be intimidated into setting the value properly

  • (cs) in reply to Ben Jammin
    Ben Jammin:
    Coyne:
    IsNothing() is the VB test for "== null". So it's even better than you thought, because first he tests the value (which will fail if the input is null) and then he tests to see if the input is null.

    ...which makes the IsNothing() test as valueless as the rest of this grummy gode.

    Not sure if trolling, or saying that you should check if the string is null before checking if it is empty....

    Not intending to troll, no. And you are right, that is exactly what I meant, because the way the gode is written, if IsNothing() were true, the gode would fail before it ever tested that condition.

    (...gondition?)

  • (cs)

    He was bitten by a siamese gat.

  • (cs) in reply to db2
    db2:
    He was bitten by a siamese gat.
    They don't look like they'd bite to me. [image]
  • daily (unregistered)

    TRWTF is VB.Net

  • iToad (unregistered) in reply to frits
    frits:
    db2:
    He was bitten by a siamese gat.
    They don't look like they'd bite to me. [image]

    I used to raise goats. They bite. They also butt and kick. Also, unfixed males smell really goaty, and they reproduce like rabbits.

  • (cs) in reply to QQ
    QQ:
    Made in Bangalore??

    Or possibly Galgutta.

  • (cs) in reply to LANMind
    LANMind:
    ubersoldat:
    GIRST which is better than FIRST!!!!

    See, I won't defend VisualBasic but for some reason, the most lame programmers end up using it and hence it ends up here.

    Exactly, because we never see any java, or PHP, or G#, or... whatever you are using...

    FTFY

  • (cs) in reply to Mike
    Mike:
    Am I reading the integer check right? Does it actually check twice to see if the value equals Integer.MinValue? I guess when you need to be double sure of its value.

    http://forums.thedailywtf.com/forums/thread/284561.aspx

    offcourse you do!

  • (cs) in reply to java.lang.Chris;
    java.lang.Chris;:
    QQ:
    Made in Bangalore??

    No, Galcutta.

    I think it's been renamed to Golkata a few years ago.

  • Gary Olson (unregistered)

    Although I have seen anecdotal evidence and heard rumors, this is the most compelling evidence of the existence of the Dept of Redundancy Department.

  • Sarcastic kebab reaper (unregistered)

    Where is Gotye when you need somegody that you used to gnaw?

  • Ross Presser (unregistered)

    Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone away.

  • (cs) in reply to ¯\(°_o)/¯ I DUNNO LOL
    ¯\(°_o)/¯ I DUNNO LOL:
    Making an int, and checking it twice... Gonvert find out if it's naughty or nice!

    You win!

  • Josh (unregistered)

    This is worse than the motor datasheet I read today that repeatedly referred to the "termistor" and associated "termal switch."

  • will (unregistered) in reply to Meta-Knight
    Meta-Knight:
    I hope you're joking (so many things wrong with this code) but if you're not:
    • The boolean version returns the same value as the boolean... that doesn't make sense.

    I would chalk that up to consistancy. Since they are creating a function for all types one for boolean just makes it easy to call the same function in all locations and not have to worry if the value is already a boolean.

  • (cs) in reply to Josh
    Josh:
    This is worse than the motor datasheet I read today that repeatedly referred to the "termistor" and associated "termal switch."

    Just don't turn up on the US border and, when asked what your profession is, answer "Terapist".

  • mrb (unregistered)

    This post made me gappy so I decided to gomment this.

  • (cs) in reply to Ross Presser
    Ross Presser:
    Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone away.
    Voilent Femmes, you sir, made my day.
  • Bro Brah Broham (unregistered) in reply to KattMan
    KattMan:
    Ross Presser:
    Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone. Cuz its gone daddy gone, The love is gone away.
    Voilent Femmes, you sir, made my day.
    Congratulations on having been a member of a fraternity.
  • (cs) in reply to TheRider
    TheRider:
    java.lang.Chris;:
    QQ:
    Made in Bangalore??

    No, Galcutta.

    I think it's been renamed to Golkata a few years ago.

    You should definitely watch Vidya Balan's Kahani picture. It is amazing storyline and very well worth watching.

  • Don L (unregistered)

    Please use your brains before posting here....

    It's clear that the purpose of the functions is to determine if the respective variables' values are sort of "neutral". And if they're "neutral", the functions should return TRUE.

    Yes, the code contains a lot of WTF's, but so do many of the comments added. And I don't really get why they wanna check this, but the code has been taken out of context.

    The biggest WTF, though, is those self-righteous jerks saying "TRWTF is VB.NET" or "C#" or "VB" or "JavaScript" or whatever. Don't you get that different languages are good for different tasks and different people? It's like saying "I think sports cars suck because they cannot pull a 10 ton trailer". I'd never be able to teach my 70-year old dad C++, but I'd easily teach hime some basics (pun intended) in VBScript.

    And to all those of you complaining about the Or-vs-OrElse-difference, saying that the programming language should short-circuit boolean evaluation all the time. Check this:

    ' Example. This has probably not any real-world use.
    ' Unless you're a sick bastard. Or a contractor :-)
    Dim input1, input2
    input1 = 10
    input2 = 42
    If f1(input1) Or f1(input2) Then
      ' Do whatever
    End If
    
    
    Function f(byval num)
      f = True
      If num = 42 Then
        num = 5000
        f = False
      End If
    End Function
    
  • phytax (unregistered) in reply to Andre

    exagtly what i was looging for

  • FuBar (unregistered) in reply to Andre
    Andre:
    You mean, despite the fact that he convert from Boolean to Boolean in the first function, checks if myValue equals Int.MinValue twice in the second, compares with both empty strings and string.Empty in the third and compares dates converting them to string in the fourth?
    Besides that, what have the Romans ever done for us?
  • @Deprecated (unregistered)

    What, nobody posted this yet?

    dilbert.com

    Akismet, no, this is not spam!

  • Raghu (unregistered) in reply to QQ

    Stop generalizing you dickhead!

  • Jay (unregistered) in reply to airdrik
    airdrik:
    J:
    Rootbeer:
    TheSHEEEP:
    So.. other than the Gontractor not being able to write "Convert" correctly (which reminds of my predeccessor at work who always wrote "languarge")... where is the wtf?

    Illiteracy (and the lack of code comprehensibility and maintainability that come with it) isn't enough of a WTF for you?

    How about a programming language that doesn't short-circuit boolean 'OR' evaluation unless you use an operator called "OrElse"?

    Well, Or is equivalent to | and OrElse is equivalent to ||. They are exactly equivalent. Maybe you don't like the terminology, but syntactically, there's nothing weirder going on in VB.NET than any of the C-type languages.
    Fail! Yes the terminology is crap, no they are not exactly equivalent because "Or" doesn't perform short-circuiting (it can't because it is the bit-wise version) while "OrElse" does (because it is the logical version).

    Umm ... VB "or" doesn't do short-circuiting. Java "|" doesn't do short-circuiting. VB "orelse" does do short-circuiting. Java ""||" does do short-circuiting. So where is the fail on equivalence?

  • Jay (unregistered) in reply to TheSHEEEP
    TheSHEEEP:
    Meta-Knight:
    I hope you're joking (so many things wrong with this code) but if you're not:
    • A method called "Gonvert" doesn't actually "gonvert" anything. Should be called "ShouldConvertToDBNull".
    • The boolean version returns the same value as the boolean... that doesn't make sense.
    • The integer version checks if the value is nothing... an integer cannot be Nothing, it's a value type.
    • Two checks for myValue = Integer.MinValue
    • String version checks twice for empty string (String.Empty = "")
    • myDate.ToString will never be an empty string
    • The proper check for the default date value would be "If myDate = Nothing", otherwise might not work for different culture settings.
    • Interchangeable use of Or and OrElse, no reason to use Or
    • The usefulness of these methods is questionable: why should an integer value of 0 be systematically converted to DBNull

    Almost all of these are language specific WTFs, so everyone not into that language that much will only get the illiteracy here.

    Well, if by "language specific" you mean that someone who doesn't know VB could not possibly be expected to figure out that "end if" probably marks the end of an if/then/else block, or that "or" might mean to perform a logical OR in a test, then I guess in that sense you could say that most of these are language-specific. But assuming someone with a reasonable knowledge of programming who can make plausible guesses about what a block of code in an unfamiliar language might do:

    • A method called "Gonvert" doesn't actually "gonvert" anything. Should be called "ShouldConvertToDBNull".

    The only language that that's specific to is English.

    • The boolean version returns the same value as the boolean... that doesn't make sense.

    Surely you can figure out what that function is doing without knowing VB. Not language specific.

    • The integer version checks if the value is nothing... an integer cannot be Nothing, it's a value type.

    Okay, that's language specific. One can certainly imagine a language where the "integer" data type can hold a null.

    • Two checks for myValue = Integer.MinValue

    Not language specific. Even if you can't guess what "Integer.MinValue" is, you can readily see that it is doing the same test twice.

    • String version checks twice for empty string (String.Empty = "")

    Language-specific. You might reasonably guess that String.empty=="", but you couldn't be sure there isn't some technical distinction without knowing VB. (Personally I don't see why String.empty exists. "" is unambiguous and less to type. But I digress ...)

    • myDate.ToString will never be an empty string

    Language-specific.

    • The proper check for the default date value would be "If myDate = Nothing", otherwise might not work for different culture settings.

    Debateable. I'd certainly be cautious about converting a date to a string to compare to a specific value in any language: Not only does this assume that there are no I18N issues, but you set yourself up for subtle errors, like are numbers padded, and if so are they padded with spaces or zeros? You could have a comparison that looks right but fails because the string conversion creates "am" but you wrote "AM", etc.

    • Interchangeable use of Or and OrElse, no reason to use Or

    language-specific

    • The usefulness of these methods is questionable: why should an integer value of 0 be systematically converted to DBNull

    not language specific

    So I count 4 language-specific, 4 not language-specific, and one debateable.

  • Jay (unregistered) in reply to jas88
    jas88:
    It's actually the "if blah==7 return true else return false" that really grates for me ... WTF not "return blah==7"? Someone being paid by the line?

    (OK, I suppose it might just come in handy one day to set a breakpoint on the exceptional case where some check is returning false and your debugger doesn't do conditional breakpoints, but still..)

    Yeah, that one always gets me, too. Especially in this case, where the first one simplifies down to "return blah".

    I just came across a line of VB recently that read -- oh, I should explain for those not familiar with VB, the "iif" function tests it's first argument, and if it's true returns the second argument and if false returns the third, so iif(blah, a, b) returns a if blah is true and b if blah is false, where blah can be an expression. Like ?/: in Java. So anyway, I saw a line of VB that read:

    flag=iif(blah=7, true, false)
    

    (I forget the exact expression.) So if it's true, he sets true, and if it's false, he sets false. Umm, why did he need the iif?

  • IceUck (unregistered)

    We used to have a guy that would never change something once he'd typed it in. If the variable started out as an index, but changed later on into a count-of-the-remaining-items, he wouldn't change the name. His rationale was that such changes could introduce errors, and the computer didn't care one way or the other what name was used.

    I also noticed that, walking out of a meeting with an empty soda can, he'd throw it in the trash bin, when the blue recycle bin was right next to it.

    Of course, I was the guy staying at work until 2AM some mornings, cleaning up in his wake.

  • SolderSlinger (unregistered) in reply to Dr. Smith

    You made me hurt myself!

  • bad_boy_bubby (unregistered)

    He must be dyslexic.

  • Gbuttius (unregistered)

    The real WTF is that he should be writing in G, G++ or G#

  • Sergey (unregistered) in reply to Qrr

    Was the contractor from Finland? The difference between sounded and unsounded consonants seems to be difficult for the people with the native finnish language.

Leave a comment on “The Gonvert”

Log In or post as a guest

Replying to comment #:

« Return to Article