Monday, June 17, 2013 [Tweets] [Favorites]

Avoid Null Checks by Replacing Finders With Tellers

Michael Feathers:

The person method accepts an id for a person and a block. If the person is found the block is called with the person. Otherwise it isn’t. Elegant, eh? And, there are no nulls.

Lots of luck doing this in a language without blocks or lambdas. I think that when the history of computing is finally written, one of the chapters will be about how much insanity thrived in the era before blocks were considered mainstream.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment