|
|
|
|
|
by village-idiot
3434 days ago
|
|
Funny, I approach it from the other side. Is the potential of failure part of my domain? Or is it something I have to handle in order to avoid errors? Should .businessLogic() have to handle the case if .validate() failed? Or should it only be called if validate succeeded? Using a common API (Either is not new or novel, it's all over the place) to separate success from failure lets me write code that is only concerned with its side of the success/fail tree without polluting it with null checks and error handling that belongs elsewhere. |
|