Monday, June 17, 2013

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 RSS · Twitter

Leave a Comment