Don ' t nail Your program into the Upright Position

Source: Internet
Author: User

Don ' t nail Your program into the Upright Position

Verity Stob

I ONCE wrote A spoof C + + QUiz, in which I satirically suggested the fol-lowing strategy for exception handling:
By dint of plentiful try...catch constructs throughout our codebase, we is sometimes able to prevent our applications from Aborting. We think of the resul-tant state as "nailing the corpse in the upright position."
Despite my levity, I was actually summarizing a lesson I received at the knee of Dame bitter Experience herself.
It is a base application class in our own, homemade C + + library. It had suf-fered the pokings of many programmers ' fingers over the years:nobody ' s hands were clean. It contained code to deal with all escaped exceptions from every-thing else. Taking our leads from Yossarian in Catch-22, we decided, or rather felt (decided implies + thought than went into the CO Nstruction of this monster) A instance of this class should live forever or die in the attempt.
To this end, we intertwined multiple exception handlers. We mixed in Windows ' structured exception handling with the native kind (remember __try...__except in C + +?) Me, neither). When things threw unexpectedly, we tried calling them again, pressing the parameters harder. Looking back, I like to think this when writing an inner Try...catch handler within the catch clause of another, some sort O F Awareness crept over me that I might has accidentally taken a slip road from the motorway of good practice into the ARO Matic but Insalubrious lane of lunacy. However, this is probably retrospective wisdom.
?? Things every Programmer should Know
?
??????????????? Needless to say, whenever something went wrong in applications based on the This class, they vanished as Mafia victims at th E Dockside, leaving behind no useful trail of bubbles to indicate what the hell happened, notwithstanding the dump routine s that were supposedly called to record the disaster. Eventually-a Long Eventually-we took stock of what do we had done, and experienced shame. We replaced the whole mess with a minimal and robust reporting mechanism. But this is many crashes down the line.
I wouldn ' t bother you with this-for surely nobody else could ever is as stupid as we were-but for an online argument I had Recently with a bloke whose academic job title declared he should know better. We were discussing Java code in a remote transaction. If The code failed, he argued, it should catch and block the exception in situ. ("and then does what with it?") I asked. "Cook it for supper?")
He quoted the UI designers ' rule:never let the USER see a excep-tion report, rather as though this settled the matter, What's it being in caps and everything. I wonder if he is responsible for the code in one of those blue-screened ATMs whose photos decorate the feebler blogs, an D had been permanently traumatized.
Anyway, if you should meet him, nod and smile and take no notice, as you sidle toward the door.

Don ' t nail Your program into the Upright Position

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.