• The Frister (unregistered)

    Frist? or Frist fail?

  • Severity One (cs) in reply to The Frister
    The Frister:
    Frist? or Frist fail?
    Depends on whether you gonvert it to a DBNULL.

    By the way, DBNULL is lacking the 'file not found'.

  • Pretendo (unregistered) in reply to The Frister

    The only Frist NON-fail is an actual comment about the article.

  • TGV (cs)

    Grilliant. That will gave a few gytes in the gatabase!

  • Todd Lewis (unregistered) in reply to The Frister
    The Frister:
    Frist? or Frist fail?

    The word you're looking for is "Grist".

  • QJo (cs)

    Gonvert to gomment.

  • anon (unregistered)

    So, TRWTF is that there's a website out there that's just pictures of a generic brands that I guess is supposed to be funny?

  • Stev (unregistered)
    Comment held for moderation.
  • frits (cs)
    Private Function ChouldGonvertToDBNULL
    
    .
    FTFY. Functions that answer questions chould be in the form of a question by convention.
  • JustKelly (unregistered)

    What a silly gunt.

  • Tom (unregistered)

    The real WTF is Visual Gasic.

  • TheSHEEEP (unregistered)

    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?

  • Mike (unregistered)

    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.

  • KattMan (cs)

    So GonverttoDBNULL is the same as ConvertToBoolean? Because it doesn't look like it is checking to see if we can convert to dbnull. So not only is Gonvert almost equal to Convert, in Maryland, but DBNULL = Boolean.

    No wonder my code never worked up there.

  • Anon (unregistered) 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.

    I noticed that too. Perhaps it's because they were worried that the value might change between the first check and the second check.

    [More likely they meant to check for MinValue and MaxValue and apparently couldn't even get that right.

  • Anon (unregistered) in reply to anon
    anon:
    So, TRWTF is that there's a website out there that's just pictures of a generic brands that I guess is supposed to be funny?

    The funny part is the people that spend extra money for the name brand when it the same damn stuff in the box.

  • Anon (unregistered)

    Gottle of Gear.

  • Tony (unregistered) in reply to Todd Lewis

    The word I'm looking for I can't say because there are preschool programmers present.

  • Andre (unregistered) in reply to TheSHEEEP

    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?

  • Rootbeer (cs) in reply to TheSHEEEP
    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"?

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered)
    myValue = Integer.MinValue Or _ myValue = Integer.MinValue Then
    Making an int, and checking it twice... Gonvert find out if it's naughty or nice!
  • ubersoldat (cs)

    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.

  • Meta-Knight (unregistered)

    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
  • QQ (unregistered)

    Made in Bangalore??

  • Melnorme (cs)

    This code gave me Conorrhea.

  • geoffrey, MCP, PMP (unregistered) in reply to Meta-Knight
    Meta-Knight:
    - myDate.ToString will never be an empty string

    If there's anything I have learned in this business, it is to never say never. Sometimes one has to check his arrogance at the door, and write code to check for a condition that he is "certain" can never occur.

  • LANMind (unregistered) in reply to ubersoldat
    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 C#, or... whatever you are using...

  • D-Coder (cs) in reply to LANMind

    Okay, everyone. Do the needful.

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

    No, Galcutta.

  • Coyne (cs) in reply to Meta-Knight
    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

    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.

  • State Your Name (unregistered) in reply to JustKelly
    JustKelly:
    What a silly gunt.

    Grap - someone beat me to the Monty Python reference

  • Meta-Knight (unregistered) in reply to Coyne
    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.

    The list of things wrong with this code is longer than the actual code.

    geoffrey:
    Meta-Knight:
    - myDate.ToString will never be an empty string

    If there's anything I have learned in this business, it is to never say never. Sometimes one has to check his arrogance at the door, and write code to check for a condition that he is "certain" can never occur.

    I understand your point, but it doesn't make sense to convert a date to a string to validate it anyway. Especially when ToString is culture-sensitive and might yield different results in different contexts.

  • Ben Jammin (unregistered) in reply to Coyne
    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....

  • TheSHEEEP (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:
    • 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.

    And to answer the other question: No, that alone is not a WTF. I see code of people that are unable to write proper (or even halfway proper) English far too often to be bothered by that anymore.

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

    No, Galcutta.

    No, Hyderabad...

    My first thought looking at this is that it is Welsh, and we have the standard mutation creeping in.

  • Anon (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:
    • 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

    .NET dates are primitives that don't support null values. The date check should probably be "myDate = Date.MinValue"

  • J (unregistered) in reply to Rootbeer
    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.
  • Crisw (unregistered)

    Zero is not Null!

  • my little phony (unregistered)

    "gontractor" is probably an apt name.

    You hire them, they do crappy work, foist it on you, and then they're gone.

  • jas88 (cs)

    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..)

  • airdrik (cs) in reply to J
    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).
  • Dr. Smith (unregistered)

    Maybe he uses a speech to text thingy and it isn't his fauld begause he has a gold.

    The "if test then return true else return false" stuff probably appeared when he blew his nose.

  • TGV (cs) 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

    Only one of these is a language specific WTF, so everyone not into that language can still enjoy it

    FTFY

  • ShatteredArm (cs) in reply to Meta-Knight
    Meta-Knight:
    - String version checks twice for empty string (String.Empty = "")

    You don't know that; someone may have redefined String.Empty.

  • geoffrey, MCP, PMP (unregistered) in reply to Meta-Knight
    Meta-Knight:
    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.

    The list of things wrong with this code is longer than the actual code.

    geoffrey:
    Meta-Knight:
    - myDate.ToString will never be an empty string

    If there's anything I have learned in this business, it is to never say never. Sometimes one has to check his arrogance at the door, and write code to check for a condition that he is "certain" can never occur.

    I understand your point, but it doesn't make sense to convert a date to a string to validate it anyway. Especially when ToString is culture-sensitive and might yield different results in different contexts.

    Fair point, but if you're validating a date from a date value, cultural sensitivity is irrelevant, since the item's life cycle is limited strictly to the validation routine.

  • Re: The Gonvert (unregistered)

    Private Function GonvertToDBNULL(ByVal myValue As Boolean) As Boolean If myValue Then Return True Else Return False End If End Function

    This is the one that gets me. Assuming the function is to determine with the value should save DBNull, or the value itself, this makes no sense. The database saves boolean values as either false for false, or null for true.

  • Stefan (unregistered) in reply to QJo

    In Germany, everyone knows if someone says "gonvert" or "gomment", they come from Saxony.

  • wydok (unregistered)

    The function names indicate that it will convert the value to null, but they reuen booleans.

    So, are they checking the passed in value to see if they can be converted to null for saving to the database?

    If so, why can a boolean value of True convert to null?

    Captcha: inhibeo. A Harry Potter spell.

  • wydok (unregistered)

    Also, 0 and the minimum integer value aren't the same. What if a field should actually store the minimum integer value? You won't know what the value was supposed to be.

    And sometimes Or is used and sometimes OrElse is used. WTF.

  • Qrr (unregistered) in reply to airdrik

    You say fail and then repeat what he said. Or is equivalent to |, neither one short circuits. OrElse is equivalent to ||, both short circuit. The fact that OrElse is generally used more often than Or and is longer/looks odd is inconvenient, but having two different or operators with different rules is entirely reasonable.

Leave a comment on “The Gonvert”

Log In or post as a guest

Replying to comment #:

« Return to Article