Skip to main content
Post Made Community Wiki by sea-rob
Source Link
luis.espinal
  • 2.6k
  • 1
  • 21
  • 17

The problem with nulls is that languages that allow them pretty much force you into programming defensively against it. It takes a lot of effort (far more than trying to use defensive if-blocks) to make sure that

  1. the objects you expect them not to be null are indeed never null, and
  2. that your defensive mechanisms indeed deal with all potential NPEs effectively.

So, indeed, nulls end up being a costly thing to have.