Re:Avoid Null Checks by Replacing Finders with Tellers
by masklinn on Monday June 17, 2013 @03:54PM
(#5895509)
The point is to move the check out of the library user's way, and out of his ability to forget about it. Same as block-scoped resource patterns (RAII, context managers, unwind-protect, whatever).
If you think about it, it's not avoiding null checks, it's just moving it to a different place. The null check still needs to happen in order to know when to call the block, it just happens to be in the datasource.whatever code.