|
|
|
|
|
by eofster
3878 days ago
|
|
I now see that my examples are oversimplified. I also don’t think that the Null Object pattern is the ultimate solution for handling nulls. I just found it useful in certain cases. What I wanted to show here among other things and why optional chaining would not help is if we wanted to have a special case handling on failure. Optional chaining fails silently. So if we wanted to log an error or to terminate the app every time the request fails, we'd have to do it on every function call. |
|