- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
In terms of handling nulls, as a general rule I choose to try to avoid pushing it onto the caller so they don't have to. A NullPointerException should mean programmer error... the source of where it was generated will determine which programmer error (callee or caller), regardless of where it came from it should be fixed, and preferably by not just slapping in a "if (val == null)" or variation of that expression. Sometimes its unavoidable, other times it can be. BTW, I am not a fan of the Null/Empty object "pattern" as it often is confusing or just kicks the can down the road for someone else to deal with. Most modern languages have idiomatic ways to handle this (Optionals for instance).