top | item 39666701

(no title)

ValentinTrinque | 2 years ago

You do have another solution that can lower the amount of conditions: Null Objects. These don’t fit every use cases, but they can allow you to express what’s missing, or not defined, or empty, and avoid nil pointers dereference or conditions to check the state.

As Sandy Metz is used to say « Nothing is Something »[0]

0: https://youtu.be/OMPfEXIlTVE?si=qmizH1OvqV7eLKNK

discuss

order

ramchip|2 years ago

From the article:

> This is highly related to the "Null Object Pattern", but I thought I would explain it from the perspective of functions.