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."


Popular posts from this blog

Computing cryptography hashes: Rust, F#, D and Scala

Upcoming F# struct tuples: are they always faster?

Composing custom error types in F#