5

I don't check for nulls and I don't have null caused exceptions.

Comments
  • 0
    Good coding/data handling then
  • 1
    Give me the api docs, I'll make some NPEs for you.
  • 2
    Then I assume you either are using a language without the concept of null, like assembly, or you are very careful and avoid any builtin or 3’rd party methods that return null as the only indication of status.

    Could probably be done but I see it would hamper a program.

    And lang that just renames null to nil or nothing is still null ;)
  • 0
    Do you have issues with null values?

    Cause that sounds a lot like a person I know that has issues with null values. You really shouldn't.

    Null has it's uses.
  • 1
    Don't need to check for NPEs in your code if you barely have any to begin with.

    *BIG BRAIN*
  • 0
    No one got it yet.

    Big projects.

    I use a language with the concept of null.

    I don't avoid apis that return null.

    The language I use , uses null, not nil.
  • 0
    I guess a segfault upon dereferencing a nullpointer doesn't count as exception.
  • 0
    @Fast-Nop let's say it counts.
  • 0
    @galileopy There are a number of possibilities:

    1) checking error codes instead of null
    2) checking error states along C's errno hack
    3) ensuring that no error can happen before doing the operation plus not doing operations where that would open a race condition
    4) crossing fingers and getting promoted before the shit hits the fan.
  • 0
    There's another way.

    Abstract the null checking in a ADT.
    Call it Maybe.

    Try to mimic the Maybe monad from Haskell.

    Use that.
    Wrap null returning functions with. Maybe.fromNullable
    ...
    ???
    Profit
  • 0
  • 0
    Wrapping the check doesn't qualify as not doing the check. It does qualify as clickbait however.
  • 1
    @Fast-Nop
    I never write
    if (a === null)

    I never have to worry about not planning for all possible outcomes.

    Or have to emulate complex execution trees on my mind while coding.

    I never said it was a hard trick.
Add Comment