Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Nullable types??

Nullable types??

Scheduled Pinned Locked Moved The Lounge
questiondiscussion
40 Posts 22 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Bardy85

    Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

    D Offline
    D Offline
    Dave Kreskowiak
    wrote on last edited by
    #20

    Bardy85 wrote:

    Are they good or are they bad?

    Neither. You use the correct tool for the job. Nullable types are just another tool in the toolbox. They serve a specific surpose. I don't qualify them as "good" or "bad".

    A guide to posting questions on CodeProject[^]
    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
         2006, 2007, 2008
    But no longer in 2009...

    B realJSOPR 2 Replies Last reply
    0
    • J Jim Crafton

      Sounds like you're suffering from a stack overflow?

      ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

      D Offline
      D Offline
      Douglas Troy
      wrote on last edited by
      #21

      Jim Crafton wrote:

      Sounds like you're suffering from a stack overflow?

      Sounds like a medical condition that afflicts older developers. [cue drug company commercial here] Do you suffer from Stack Overflow? Is this affecting your love life? Work? Family? Friends? Millions of aging Software Developers, like you, live with SOF everyday. Well, worry no more. With Stacagra, you'll regain your confidence and management over your Stack once again. :rolleyes:


      :..::. Douglas H. Troy ::..
      Bad Astronomy |VCF|wxWidgets|WTL

      modified on Monday, August 3, 2009 11:54 AM

      P 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Bardy85 wrote:

        Are they good or are they bad?

        Neither. You use the correct tool for the job. Nullable types are just another tool in the toolbox. They serve a specific surpose. I don't qualify them as "good" or "bad".

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008
        But no longer in 2009...

        B Offline
        B Offline
        Bardy85
        wrote on last edited by
        #22

        True. What ever is best for the job. Simple. easy. For some reason when I code, I sit for hours wasting time, trying to find the best way foward. I know there are always a handfull of ways to accomplish a given task. I'm just trying to find the "best",most effecient,simplest solution. Maybe that it. Time. Every ms counts. Oh well. Think it's just monday driving me up the wall. Thanks anyway.

        D 1 Reply Last reply
        0
        • J Jim Crafton

          I'd reply, but I'm in the middle of an access violation...

          ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

          J Offline
          J Offline
          Joan M
          wrote on last edited by
          #23

          Are you violating MS Access? :rolleyes:

          [www.tamelectromecanica.com][www.tam.cat]

          D 1 Reply Last reply
          0
          • B Bardy85

            Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

            J Offline
            J Offline
            Joan M
            wrote on last edited by
            #24

            Once I met one that was really, really bad... :rolleyes:

            [www.tamelectromecanica.com][www.tam.cat]

            1 Reply Last reply
            0
            • I Ian Shlasko

              bool areNullablesGood = ("the month".indexOf('R') >= 0); Well, that answers that.

              Proud to have finally moved to the A-Ark. Which one are you in? Developer, Author (Guardians of Xen)

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #25

              Ian Shlasko wrote:

              bool areNullablesGood = ("the month".indexOf('R') >= 0);

              That seems pretty close to the truth, as (1) months have at most one capital letter (never an R), (2) and "the month" has none. :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


              1 Reply Last reply
              0
              • J Joan M

                Are you violating MS Access? :rolleyes:

                [www.tamelectromecanica.com][www.tam.cat]

                D Offline
                D Offline
                Dan Neely
                wrote on last edited by
                #26

                MS access users are violated.

                The European Way of War: Blow your own continent up. The American Way of War: Go over and help them.

                G 1 Reply Last reply
                0
                • B Bardy85

                  True. What ever is best for the job. Simple. easy. For some reason when I code, I sit for hours wasting time, trying to find the best way foward. I know there are always a handfull of ways to accomplish a given task. I'm just trying to find the "best",most effecient,simplest solution. Maybe that it. Time. Every ms counts. Oh well. Think it's just monday driving me up the wall. Thanks anyway.

                  D Offline
                  D Offline
                  Dan Neely
                  wrote on last edited by
                  #27

                  Don't use them when you don't have to. Every time you call an API expecting a non nullable value you'll have to do validation/conversion of your nullables.

                  The European Way of War: Blow your own continent up. The American Way of War: Go over and help them.

                  1 Reply Last reply
                  0
                  • B Bardy85

                    Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                    S Offline
                    S Offline
                    Shog9 0
                    wrote on last edited by
                    #28

                    Bad. But inconsistency is worse. Rather all types be nullable than just a subset...

                    D 1 Reply Last reply
                    0
                    • B Bardy85

                      Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                      M Offline
                      M Offline
                      Marc Clifton
                      wrote on last edited by
                      #29

                      Useless, because there's no mapping of a nullable type to an object with value DBNull.Value. Marc

                      Will work for food. Interacx

                      I'm not overthinking the problem, I just felt like I needed a small, unimportant, uninteresting rant! - Martin Hart Turner

                      1 Reply Last reply
                      0
                      • B Bardy85

                        Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                        J Offline
                        J Offline
                        Judah Gabriel Himango
                        wrote on last edited by
                        #30

                        Given that the inventor of null calls it his "billion dollar mistake[^]", I think it's safe to say null references are bad. Or did you mean System.Nullable<T> in the .NET framework?

                        Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon Judah Himango

                        1 Reply Last reply
                        0
                        • B Bardy85

                          Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                          T Offline
                          T Offline
                          Todd Smith
                          wrote on last edited by
                          #31

                          I usually use them in conjunction with a database and linq. But I don't see why they can't be used whenever the need arises. http://qconlondon.com/london-2009/presentation/Null+References:+The+Billion+Dollar+Mistake[^]

                          Todd Smith

                          1 Reply Last reply
                          0
                          • S Shog9 0

                            Bad. But inconsistency is worse. Rather all types be nullable than just a subset...

                            D Offline
                            D Offline
                            Dario Solera
                            wrote on last edited by
                            #32

                            Well, all value types are non-nullable by default. You can make them nullable by wrapping them in a class. This is done automatically in .NET with the "?" operator.

                            If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki

                            S 1 Reply Last reply
                            0
                            • D Dario Solera

                              Well, all value types are non-nullable by default. You can make them nullable by wrapping them in a class. This is done automatically in .NET with the "?" operator.

                              If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki

                              S Offline
                              S Offline
                              Shog9 0
                              wrote on last edited by
                              #33

                              Yeah... And boy is that not slick. :rolleyes:  ("Yay!" i thought to myself, upon hearing of this for the first time... "Now i can write generic code that treats value types and reference types the same!" The gods of .NET proceeded to laugh heartily at my naivete...)

                              1 Reply Last reply
                              0
                              • realJSOPR realJSOP

                                Using my astounding precognitive powers, I predict that this will be a pointless thread.

                                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                                -----
                                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                                O Offline
                                O Offline
                                Oakman
                                wrote on last edited by
                                #34

                                John Simmons / outlaw programmer wrote:

                                Using my astounding precognitive powers, I predict that this will be a pointless thread.

                                I knew you were going to say that.

                                Jon "One loves to possess arms, though they hope never to have occasion for them." --Thomas Jefferson to George Washington, 1796. Soap Box 1.0: the first, the original, reborn troll-less

                                1 Reply Last reply
                                0
                                • D Douglas Troy

                                  Jim Crafton wrote:

                                  Sounds like you're suffering from a stack overflow?

                                  Sounds like a medical condition that afflicts older developers. [cue drug company commercial here] Do you suffer from Stack Overflow? Is this affecting your love life? Work? Family? Friends? Millions of aging Software Developers, like you, live with SOF everyday. Well, worry no more. With Stacagra, you'll regain your confidence and management over your Stack once again. :rolleyes:


                                  :..::. Douglas H. Troy ::..
                                  Bad Astronomy |VCF|wxWidgets|WTL

                                  modified on Monday, August 3, 2009 11:54 AM

                                  P Offline
                                  P Offline
                                  PIEBALDconsult
                                  wrote on last edited by
                                  #35

                                  Throw in something about dangling pointers.

                                  G 1 Reply Last reply
                                  0
                                  • B Bardy85

                                    Nullable or Not. That is the question. Are they good or are they bad? What are YOUR thoughts?

                                    P Offline
                                    P Offline
                                    PIEBALDconsult
                                    wrote on last edited by
                                    #36

                                    Well, they're low in fat, sodium, and carbohydrates, and contain no alcohol; how can that be good? :confused:

                                    1 Reply Last reply
                                    0
                                    • D Dave Kreskowiak

                                      Bardy85 wrote:

                                      Are they good or are they bad?

                                      Neither. You use the correct tool for the job. Nullable types are just another tool in the toolbox. They serve a specific surpose. I don't qualify them as "good" or "bad".

                                      A guide to posting questions on CodeProject[^]
                                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                           2006, 2007, 2008
                                      But no longer in 2009...

                                      realJSOPR Offline
                                      realJSOPR Offline
                                      realJSOP
                                      wrote on last edited by
                                      #37

                                      You just ruined an otherwise pointless thread with serious commentary. Get with the program.

                                      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                                      -----
                                      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                                      D 1 Reply Last reply
                                      0
                                      • P PIEBALDconsult

                                        Throw in something about dangling pointers.

                                        G Offline
                                        G Offline
                                        Gary Wheeler
                                        wrote on last edited by
                                        #38

                                        What about "raising" an exception?

                                        Software Zen: delete this;

                                        1 Reply Last reply
                                        0
                                        • D Dan Neely

                                          MS access users are violated.

                                          The European Way of War: Blow your own continent up. The American Way of War: Go over and help them.

                                          G Offline
                                          G Offline
                                          Gary Wheeler
                                          wrote on last edited by
                                          #39

                                          MS Access users are should be violated. - ftfy

                                          Software Zen: delete this;

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups