• (cs)

    C# does support null for value types. It's called nullable types and you define 'm like bool? name = null, or something.

  • Karl von L. (unregistered)

    Clearly, the designer's brain is very null.

  • (cs)

    This reminds me of a manager I had who would send out status reports of our tasks from time to time. First he would flag them with priorities of "H", "M", and "L", for High, Medium, and Low. But after a couple of months, he introduced the priorities "HH", "HM", "ML", and "LL". It was explained that HH was "Very High", "HM" was "High-to-Medium"... you get the idea. Then he started using special color coding to denote which tasks were "blockers", and bolding which tasks where "critical bug fixes", and he introduced "HHH" tasks which were "EXTREMELY High priority" and.. it got a little confusing.

    But I was just waiting for an "MM" priority to show up. You know - "Very Medium." And perhaps "MMM" for "EXTREMELY Medium."

    Makes about as much sense as "Very Null."

    Good WTF.

  • (cs)

    The TRUE wtf is that they didn't define the method isUberNull!

  • Dave (unregistered)

    Followed, of course, by isExcruciatinglyNull, damnThatsTheNullestThingEVER, politicianIQNull, and finally isNullAndNotNull.

    Dave

  • AJ (unregistered)

    What about kindaNull  or sortaNull?

  • (cs) in reply to Dave

    I wonder how people map those values to the database... do they put in a null into the field and have another bit column called veryFlag

  • (cs) in reply to PrisonerOfPain
    PrisonerOfPain:
    C# does support null for value types. It's called nullable types and you define 'm like bool? name = null, or something.

    Only since 2.0, though.

    This is a fine WTF. I hereby decree this to be the new "FileNotFound." I can make decrees, right?
  • (cs)

    I think that this is quite funny, the function named isVeryNull made me laugh. However, I can also see the point to this, due to the nature of floating point numbers.

    When comparing two floating point numbers, you'd normally have to do something like

    if( abs(a - b) < cuttoff_value) { ...

    this function makes that much simpler

    if( isNull( a - b)) { ...


    Funny names, still. :)

  • (cs)

    > isNull(double _value)

    That was just the start. I'm sure the rest of the library was:

    isTruelyNull(double _value)
    isReallyQuiteSpectacularlyNull(double _value)
    isNullToEndAllNull(double _value)
    isMoreNullThanTheOtherNull(double _value)
    isSoNullThatWhenItSitsAroundTheNullItSitsAROUNDTheNull(double _valu

  • (cs)

    Knowing that Alex routinely obscures a submission by changing the language of the code, I wonder if it was Java or C# originally.  If it was, then this is a hell of a WTF, but not an altogether shocking one.  I've seen many well-meaning newbies decide that, say, a java.lang.Integer is far too heavyweight, and such people go to ridiculous lengths to avoid using wrapper classes.

    If only universities would start teaching that premature optimization is the root of all evil.

  • (cs) in reply to Nand

    So what's wrong with plain old 0?

     

  • Rob (unregistered) in reply to Karl von L.

    Come on, isVeryNull() was written later by a developer making fun of it.

  • (cs) in reply to Dave
    Anonymous:
    Followed, of course, by isExcruciatinglyNull, damnThatsTheNullestThingEVER, politicianIQNull, and finally isNullAndNotNull.

    Dave


    And the ever popular isNotOnlyVeryNullButFileNotFoundToo


  • (cs)

    So.. anyone care to guess what kind of system considers 0.0 to be null, but at the same time can't define isNull as "return _value == 0.0;"?

    If they have a tolerance around 0, then one would presume they were doing math on the number.  But why would you want a statement like isNull(a + b)?  I mean, what would that even mean?  If they aren't doing math to get the value, then they could always set the value equal to 0 (I mean, there's no chance that one compiler is going to convert 0 to a double differently from another compiler), so why bother with a tolerance?

  • bw (unregistered)

    How is zero represented in this brilliant scheme?

    final public static double zero = 0.0002; // notQuiteNull

    ??

  • (cs) in reply to PrisonerOfPain

    Nullable types are based on generics and as such did not exist until .NET 2. Prior to that, you had to wrap it or box it.

  • (cs)

    It's too bad there's no way to distinguish between zero and "very null".  Zero is a pretty useful and meaningful value.

    And when they set something to "null" or "very null", I wonder what value(s) they use...


  • (cs) in reply to RiX0R
    RiX0R:

    So what's wrong with plain old 0?

     

    With doubles, everything is wrong with 0.

    Erhm. With doubles, everything is wrong.

  • (cs)

    What, no "fist!", "First!" or "frist!" post?  I'm losing my faith in the trolls.  Or they're starting to get that the joke isn't funny anymore.

    Null is a value between 0.0001 and 0.0000000001, dumb@$$es!

  • (cs)

    "Null" means "Zero" in German and other languages. I think those methods are badly named, should rather be "isZero" resp. "isVeryZero".

  • Colin (unregistered)

    I would like to propose a system for a continuum of NULL values.

    double nullDegree(double _value)
    {
      return Math.abs(_value);
    }
    double isAntiNull(double _value)
    {
      if (_value > 0)
      {
        return 1;
      }
      else
      {
        return 0;
      }
    }

    This way we can determine how null something is as well as if it's anti-NULL.  Meaning if two NULLs are of equal degree then summing them would annihilate the values if one is NULL and the other is anti-NULL.

  • (cs)

    I would imagine it goes to follow that:

    All work and no play makes Jack a Very Null boy.

  • (cs) in reply to ammoQ
    ammoQ:
    "Null" means "Zero" in German and other languages. I think those methods are badly named, should rather be "isZero" resp. "isVeryZero".
    Than again, what would value_ mean in German? Seems kinda like the confusion people have when the first encounter the OR operator and think it works like XOR because of how it's used in natural language.
  • (cs) in reply to mjonhanson
    mjonhanson:
    Null is a value between 0.0001 and 0.0000000001, dumb@$$es!


    Or between -0.0000000001 and -0.0001
  • AR (unregistered) in reply to Dave

    What about "I can't believe it's not null"?

  • (cs)

    I wonder if they have a IsPartiallyNull() method?

  • (cs) in reply to ammoQ
    ammoQ:
    "Null" means "Zero" in German and other languages. I think those methods are badly named, should rather be "isZero" resp. "isVeryZero".


    public static System.Boolean HabenSieEineNull(System.Double derValue)
  • Anonymous (unregistered) in reply to mjonhanson

    Fist!

  • (cs) in reply to John Bigboote

    Doesn't schools teach the concept of NaN (Not A Number).  I mean, even C and C++ support these!

    This code is definitely not NaN-friendly.

  • enterprisey (unregistered)

    public class VeryPaulaBean extends PaulaBean
    {
      public String getVeryBrillant()
      {
        return "Very brillant";
      }
    }

  • Occasional Browser (unregistered)

    what about "isMotherOfAllNulls" ?

  • Pat (unregistered)

    HL7, the messaging standard for Healthcare, defines seven different "Flavors of Null".  There.  Not a lot of people know that. 

  • Matt (unregistered) in reply to Pat
    Anonymous:
    HL7, the messaging standard for Healthcare, defines seven different "Flavors of Null".  There.  Not a lot of people know that. 


    Could I have a dish of raspberry null, please?

    CAPTCHA: picture
  • (cs) in reply to Pat

    Anonymous:
    HL7, the messaging standard for Healthcare, defines seven different "Flavors of Null".  There.  Not a lot of people know that. 

    Do they have a "cookies and cream" flavor?

  • dasmb (unregistered) in reply to RiX0R
    RiX0R:

    So what's wrong with plain old 0?



    Well, quite a bit actually.  This obnoxious code not withstanding, there is quite a bit of difference between "There is no value" and "There is a value, and it's 0."  Non-existance of data is a very important distinction; and I could even see a need for explanitory metadata explaining WHY a field is blank -- for example, there might be a field that's blank since creation and another that's been purposely MADE blank.  You could do worse than calling the first case "very null."  Of course, you'd still be wise to make sure the discrete value "0" failed both tests.

    Interestingly enough, what's far worse than non-nullable integers in .NET is the fact that Date is also a value type.  No null dates, but every .NET date time picker handles nullable values and every customer wants them.  We wound up using midnight on January 1st, 1900 (the default from one or another of our legacy systems, probably Access), and it kind of came back to haunt us.  Bug reports with "Date Time Field XxX displays January 1st" were very, very common.
  • (cs) in reply to IQpierce
    IQpierce:

    This reminds me of a manager I had who would send out status reports of our tasks from time to time. First he would flag them with priorities of "H", "M", and "L", for High, Medium, and Low. But after a couple of months, he introduced the priorities "HH", "HM", "ML", and "LL". It was explained that HH was "Very High", "HM" was "High-to-Medium"... you get the idea. Then he started using special color coding to denote which tasks were "blockers", and bolding which tasks where "critical bug fixes", and he introduced "HHH" tasks which were "EXTREMELY High priority" and.. it got a little confusing.

    But I was just waiting for an "MM" priority to show up. You know - "Very Medium." And perhaps "MMM" for "EXTREMELY Medium."

    Makes about as much sense as "Very Null."

    Good WTF.

     

    Actually, when I go to the Elegant Steak House (tm) (patent pending), I always make a point mention that I'd like the steak prepared "extra medium."

  • enterprisey (unregistered) in reply to dasmb
    Anonymous:
    RiX0R:

    So what's wrong with plain old 0?



    Well, quite a bit actually.  This obnoxious code not withstanding, there is quite a bit of difference between "There is no value" and "There is a value, and it's 0."  Non-existance of data is a very important distinction; and I could even see a need for explanitory metadata explaining WHY a field is blank -- for example, there might be a field that's blank since creation and another that's been purposely MADE blank.  You could do worse than calling the first case "very null."  Of course, you'd still be wise to make sure the discrete value "0" failed both tests.

    Interestingly enough, what's far worse than non-nullable integers in .NET is the fact that Date is also a value type.  No null dates, but every .NET date time picker handles nullable values and every customer wants them.  We wound up using midnight on January 1st, 1900 (the default from one or another of our legacy systems, probably Access), and it kind of came back to haunt us.  Bug reports with "Date Time Field XxX displays January 1st" were very, very common.


    This space intentionally left blank? :)

    I agree, sometimes it would be nice to have some kind of distinction between not initialised and deliberately nulled out states. (And NaN, as a third special value.) But this is useful for debugging only, in production code you do not use uninitialised variables, do you? :)
  • (cs)

    Ah, yes, the inevitable stream of "0 is a value, where NULL is the absence of any value" philosophical discussions...and I cannot help myself from jumping into the fray:

    In my humble, not entirely versed in the algebra of databases, opinion the necessity for a NULL is basically a limitation of our understanding of how to store, manage, and present data. It is also probably carried over from some historical application somewhere due to limited storage in early computers - there was not enough space to include 'valid / not valid / Brillant! / veryNULL' flags for data.  So part of it is due to the physical nature of data storage (I'm sure that in most modern databases and strictly typed languages, NULLs are implemented internally with some sort of magic number or wrapped with a flag somewhere that is transparent to the programmer), and part due to presentation - especially in databases where information is transmitted in sequential, delineated form where there must be a fixed number of spaces; if things could be transmitted instead as entities with characteristics, the concept of NULL would probably not be required.

    And now that I've said things which may or may not make any coherent sense, I think I'll depart.

  • (cs) in reply to mrprogguy

    <FONT color=#006400>Actually, when I go to the Elegant Steak House (tm) (patent pending), I always make a point TO mention that I'd like the steak prepared "extra medium."</FONT>

    I hate, I Hate, I HATE--forum software!

    (And you thought I was going to say "Peter Pan."  But I ask you--what would be the point in hating peanut butter?)

  • (cs) in reply to PrisonerOfPain
    PrisonerOfPain:
    ammoQ:
    "Null" means "Zero" in German and other languages. I think those methods are badly named, should rather be "isZero" resp. "isVeryZero".
    Than again, what would value_ mean in German? Seems kinda like the confusion people have when the first encounter the OR operator and think it works like XOR because of how it's used in natural language.

    It could be that it's written by some German coder who's supposed to be writing the code in English but hasn't got the hang of certain bits of the language yet. isZero and isVeryZero are actually reasonably accurate names/descriptions for the functions...

  • Stu (unregistered)

    This is my favourite WTF since I started reading the daily WTF.

    So simple, so elegant, so WTF.

  • enterprisey (unregistered) in reply to too_many_usernames
    too_many_usernames:
    Ah, yes, the inevitable stream of "0 is a value, where NULL is the absence of any value" philosophical discussions...and I cannot help myself from jumping into the fray:

    In my humble, not entirely versed in the algebra of databases, opinion the necessity for a NULL is basically a limitation of our understanding of how to store, manage, and present data. It is also probably carried over from some historical application somewhere due to limited storage in early computers - there was not enough space to include 'valid / not valid / Brillant! / veryNULL' flags for data.  So part of it is due to the physical nature of data storage (I'm sure that in most modern databases and strictly typed languages, NULLs are implemented internally with some sort of magic number or wrapped with a flag somewhere that is transparent to the programmer), and part due to presentation - especially in databases where information is transmitted in sequential, delineated form where there must be a fixed number of spaces; if things could be transmitted instead as entities with characteristics, the concept of NULL would probably not be required.

    And now that I've said things which may or may not make any coherent sense, I think I'll depart.


    Yeah, and using ints, longs and doubles and other silly things are also useless, as internally they are all zeros and ones. (As far as I know, most java implementations do use a pointer to a dummy singleton "null" object but causality is the other way around. They use this technique because there's no other sensible way to represent null, which is needed in a sensible language.)
  • miguel (unregistered)

    So if you multiply 2 nulls together you may get verynull... nice.

  • Matt (unregistered)

    After reading through all the comments, i'm still laughing.  Good one.  No eye-burning involved.

    CATTCHA==ENTERPRISE
    :)

  • (cs)

    Fools.  Lisp already solved this over 40 years ago (tm) with Is-Null, Is-Pretty-Null, and The-Nullest.  And you other guys are just NOW inventing these functions?

  • Anonymous (unregistered) in reply to ammoQ
    ammoQ:
    "Null" means "Zero" in German and other languages. I think those methods are badly named, should rather be "isZero" resp. "isVeryZero".


    Then the real WTF is German being a very dull null language.
  • (cs) in reply to IQpierce

    IQpierce:
    This reminds me of a manager I had who would send out status reports of our tasks from time to time. First he would flag them with priorities of "H", "M", and "L", for High, Medium, and Low. But after a couple of months, he introduced the priorities "HH", "HM", "ML", and "LL".

    And in all that, he never noticed that using those values, you can't sort on priority? (Highs would be first, followed by Lows, and then Mediums)

  • (cs)

    Huh. Are we sure that by "Null" they don't mean "insignificantly small", for doing comparisons, for example?

    double f1, f2;
    ...
    if(  isNull(f1 - f2) )
    {
      // f1 - f2 is almost 0
    }
    ...
    if( isVeryNull(f1 - f2) )
    {
      // f1 - f2 is very almost 0
    }

    In this case, it's a very poor name for a legitimately useful function.  Though I prefer to make it explicit, and just #define an "epsilon" or "threshold" value somewhere to compare against...

    #define EPSILON 0.00000001 // really small
    ...
    if(  fabs(f1 - f2) <= EPSILON )
    {
     // close enough
    }

    Then there's no confusion about what's actually going on.

  • Stine (unregistered) in reply to PrisonerOfPain

    A professor put it like this:

    Lets say you are walking around downtown with 6 cents in your pocket.  A beggar walks up and asks if you have a penny or nickel?  Do you tell him "no"?  If you're a bastard you do.

Leave a comment on “It's Pretty Null”

Log In or post as a guest

Replying to comment #:

« Return to Article