4 ms·
>I find uninitialized objects' badness comparable to the badness of unhandled exceptions - neither is very hard to debug. Unless you have a bunch of code that
by realharo 10y ago
>I find uninitialized objects' badness comparable to the badness of unhandled exceptions - neither is very hard to debug.
Unless you have a bunch of code that just passes the object around without looking into it (so it won't fail there), and then when the crash finally happens, you have no idea where the invalid object came from.
This is really just another form of the billion dollar mistake, except you have invalid objects instead of null pointers (or in the worst case, you have both).
With an unhandled exception, you always have the context of where and why it happened (assuming you know the reason behind throwing it).