Avoiding Nulls with "Tell, Don't Ask" Style

A very interesting thought about another wonderful side effect of "Tell, Don't Ask" principle (Nat Price wrote in his blog):

"On the other hand, if the object tells a collaborator to do something with the value, it can choose, when the value does not exist, to just not tell it's collaborator anything or to tell the collaborator to do something different. There's often no need to represent the "does not exist" case as a data structure because it never gets passed around."

Comments

Popular posts from this blog

Haskell: performance

Regular expressions: Rust vs F# vs Scala

STM: F# vs Haskell