|Think about Loose Coupling|
Re^7: Style guide for error messages?by rir (Vicar)
|on Sep 26, 2005 at 21:39 UTC||Need Help??|
You mentioned gotos and returns. On this list should be the closer cousin: semaphore flags. Flags are worse than exceptions because they are advisory.
I want my file and line number captured.
That goes into the message.
I was not complaining nor was I trying to change your mind (or practices); even brilliant men can disagree.
I'd prefer to be uninformative to users, but detailed to developers.
With objects one can inform both appropriately.
if it comes to wanting to discriminate one exception, my first question is why you want to do that
An example: A fair sized body of code, being 7 or more calls deep, explores the environment of the program. The scope of the environment is expanded and now failure to access a few resources is no longer reason to exit, instead by expressing the problem at the new top level, a separate tree of code is able to substitute some of the new resources instead. So now we want to discriminate a few exceptions from the many. Capturing some data to present to the user may also be appropriate.
That your fingers are trained to type confess is a valid and compelling reason to practice as you do, but it gave me a laugh. I thought of some programmer trying to use that as a justification to his boss--what made that image really funny is that such idiocynratic issues can have a serious impact on productivity.
For the simple case, objects are worse than strings. If ... more complex, then objects are an obvious win.
I agree with your opinion as you summarize it.