4 ms·
> [as an alternative to exceptions] "It is true that what should be a simple 3 line program often blossoms to 48 lines when you put in good error checking, but
by michaelwww 13y ago
> [as an alternative to exceptions] "It is true that what should be a simple 3 line program often blossoms to 48 lines when you put in good error checking, but that's life
Was he being serious? I'd rather not wade through all that error checking cruft to see normal flow. Exceptions (or goto) don't create buggy hard to read programs, people do.
- crazygringo 13y agoExcept that error handling is part of normal flow. Wishing it wasn't, or just laziness, leads to bugs. It's not cruft, it's integral. That's the whole point.
- michaelwww 13y agoI disagree. Building an error checking scaffolding around every possible and unlikely error obscures the expected flow of control. If I checked for every possible error condition before I started the engine of my car in the morning it would take me an hour to get out of the driveway. I'd much rather have the car tell me when something was wrong and not start. If the system you are using already throws exceptions, you might as well use them too.
- um304 13y agoExactly my point. In my experience, exceptions have helped me significantly reduce my code, increase readability and quicken bug tracking.