Admir Mujkic
Dec 17, 2024

--

Thank you for your comment!

Regarding your first point - the Null Object pattern isn't just about 'hiding' null values. It's about modeling a special case (non-existent customer) as a first-class citizen in our domain. NullCustomer isn't a workaround; it's a legitimate representation of the 'customer does not exist' state with clearly defined behavior

For your second point - you're absolutely right. My example combining Result<T> and the Null Object pattern has redundant checking. If Result.IsSuccess guarantees a valid object, the additional null check is unnecessary and confusing....

--

--

Admir Mujkic
Admir Mujkic

Written by Admir Mujkic

I am Admir Mujkić, a technical architect with over 15 years of experience helping businesses harness technology to innovate, grow, and succeed.

No responses yet