5 ms·
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 mi
by ValentinTrinque 3y 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 https://youtu.be/OMPfEXIlTVE?si=qmizH1OvqV7eLKNK
- ramchip 3y agoFrom the article: > This is highly related to the "Null Object Pattern", but I thought I would explain it from the perspective of functions.