Hacker News new | ask | show | jobs
by ailideex 2287 days ago
> When your main argument for not using exceptions for every kind of error handling is performance instead of architecture

Personally I find that using exceptions quite broadly makes it easier to build fault tolerant software. And to me this makes the performance issue rather moot. Some classes, such as, financial OLTP systems, should much rather be correct and resilient than performant.

I could presumably write the same exact logic in asynchronous C, but most likely it will have serious stability issues. And what is more, every person I have come across in my life that insisted on writing asynchronous code for financial OLTP systems ended up writing software which would never have the requisite stability and had to either be abandoned or rewritten.

To me, avoiding exceptions absolutely seems like trying to fix a problem that is not related to how code is written by changing how code is written - instead of changing how the code is executed, which is where the actual problem comes in.

Another argument I hear all too frequently though is that people can just ignore exceptions ... and yes - they can - and in almost all cases (unless someone did not just ignore exceptions) this will cause program or thread termination.

In C you can just ignore error return values also - but what is worse - you can forget to check them - and then execution continues as if everything is fine. With exceptions you guarantee that someone has to go out of their way to continue execution as if everything is fine if something went wrong.

This is why exceptions are optimal for happy path programming.