4 ms·
Should we have error handling at all ? Software engineers: no, too much work to think about every possible error case Sysadmins (looking at above statement):
by candiodari 8y ago
Should we have error handling at all ?
Software engineers: no, too much work to think about every possible error case
Sysadmins (looking at above statement): NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
Now in theory you could do error handling without try...catch. Golang especially espouses that vision. However, like C before it, in practice Go programs ignore pretty much every error case.
To that practical situation, I will say, try...catch is far, far superior. Why ? Because it terminates your application instead of running the program in a way that erases the database. As an additional bonus try...catch gives you exactly what happened, and the entire stacktrace that mostly specifies what all the parts of the application was doing (and if you know what you're doing in Java/C++, including all values of all internal data structures. In Python ... well a little bit less but still substantial information).
- notacoward 8y ago> try...catch is far, far superior. Why ? Because it terminates your application Nope, that's try without a catch. Every time you catch an exception you prevent that (though of course you can turn around and terminate anyway). > try...catch gives you exactly what happened Depends on the implementation. Python's is actually one of the best this way. For C++ what you say is simply not true. It's possible for an extremely diligent programmer to define exceptions that capture more useful state, but in practice almost no exception-intensive codebases provide as much information as in a typical error-return based system.
- kjeetgill 8y agoI find Java stack traces to be among the most readable. Exactly one line per stack frame, and just enough information to hunt the source file/library down the whole call stack. Python is good but slightly too verbose because it needs to dump whole file paths.
- jackewiehose 8y ago> Should we have error handling at all ? > Software engineers: no, too much work to think about every possible error case > Sysadmins (looking at above statement): NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO I hope all developers that are not completely incompetent agree with the sysadmins here.
- candiodari 8y agoSure, then ask them "what happens if you run out of memory in the middle of the 'new user' function" and see what their answer is.
- jackewiehose 8y agoThere is nothing wrong to "ignore" errors like out-of-memory, as long as you know the consequences. Terminating the application on fatal errors is part of error handling. That's fine. But you should never ever ignore(!) errors, hoping for the best (and I think try-catch encourages this, so I don't like it).
- Forge36 8y agoThat's the mess I'm dealing with today. Lots of secret suppression on dozens of cases. Once we started logging and stopped seeing obsolete responses, the data loses started coming in. That's raising a lot of concern now
- candiodari 8y agoOh I forgot one. Should we have error checking ? Management (no error checking): everything looks good ! Management (error checking): our developers SUCK ! They constantly get close to losing data or insist on the database having this "correctness" technobabbly thing. Idiots.
- anyfoo 8y agoThe transaction doesn’t complete and you’re back with the previous state. Modern software is often written in a way that kill -9 is the actual supposed way to terminate the process, to drive the point home that aborting at any point should be safe.