4 ms·
Well, as a programmer I like exceptions too as error handling becomes a breeze. But as a user I hate them and the reason a simple: Because the developer doesn'
by arendtio 7y ago
Well, as a programmer I like exceptions too as error handling becomes a breeze.
But as a user I hate them and the reason a simple: Because the developer doesn't have to handle every case, many developers just don't know what types of errors/exceptions can happen at runtime and unless they catch all Exceptions at the top-level, their programs will crash every once in a while.
Yes, it is a bit unfair to judge a feature like exceptions by the resulting code quality, as you certainly can use them responsibly, but my personal impression is that exceptions mislead developers to writes code of lower quality (myself included). That is why I like the Go approach to (some extent).
- amelius 7y agoThe problem is that even if the programmer is forced to deal with every error condition, they might think a particular error is not likely and write a dummy handler (like print something and hope for the best). In that case exceptions are superior because at least they wind down the stack and allow a caller to deal with the situation, and prevent a crash.
- erik_seaberg 7y agoWhen people don't care, you have to make doing it right easier than doing it wrong.
- clinta 7y agoOr at least force it to be an intentional decision to do it wrong, which go does. Exceptions permit the programmer to be unaware that the function they're calling could throw an exception.
- kazinator 7y agoHowever, if you don't have/use exceptions and you forget to handle an error code, then instead of a loud exception, the situation is silently ignored and shows up as some problem elsewhere. For instance, oops, the program believed it saved something to a file, but that wasn't actually done; it didn't notice the failed write.