3 ms·
None is the third-worst mistake in computer science, Maybe is the second-worst, the Result that can contain either a result or an exception is the worst. I h
by PaulHoule 3y ago
None is the third-worst mistake in computer science, Maybe is the second-worst, the Result that can contain either a result or an exception is the worst.
I have debugged so much code that does the wrong thing with a Result (or other error handling). I will always remember the engineering manager who boasted about how we (1) did careful error handling with monads and (2) did code reviews. Oddly though I never got my code reviewed and I found so much code that silently dropped errors out of carelessness to believe there had never been code reviews. In my experience given a malfunctioning Scala class you can: (3) screw around with it for a few days or (4) write it in Java and have it working in an hour.
(A counter to this is that sometimes you do want to send a result-or-exception to some other part of the program that involves storing it somewhere and Result is really great for that… but please learn to get over any fear of exceptions you have and ignore the people who want to stigmatize them.)