News for hackers. Stuff that matters.
Re:You’re better off using Exceptions by shadowgovt on Monday February 03, 2020 @11:41AM (#22225843)
I find the mindset that exceptions are the right way to handle ordinary scenarios symptomatic of what I call "happy path coding:" assuming that the stars are always perfectly aligned for your program to work, and nothing ever goes wrong, and if it does it's someone else's problem.

It's a fine approach for prototyping but we should be highly suspicious of it for code people rely upon to work. As complexity approaches infinity, the odds of the system being "happy path"-aligned approach zero.

Network-relevant programming (such as web UIs), in particular, really highlights this fact (since any given network request is always allowed to fail, and "user closes their laptop or mobile device, moves somewhere else, and resumes work on an entirely different physical network" has gone from a rare occurrence to an extremely common one in the past two decades).

Re:You’re better off using Exceptions by AstralStorm on Tuesday February 04, 2020 @12:01PM (#22237955)
On the other hand, do you really want to bubble error results through layers of network stack and parsers, when handling is almost always the same?