Article

From:
To:
Raoul De Kezel
Subject:
Re: Exceptions vs Error codes
Newsgroup:
borland.public.delphi.objectpascal

Re: Exceptions vs Error codes

"Raoul De Kezel" <‚úČhotmail.com> wrote in message >
> The called function should ideally raise an exception
> when sequential execution of caller code is meaningless
> (because the standard service cannot be provided)
>
> Now, the called function often *cannot* know whether
> caller code prefer to handle some unusual condition
> through sequential execution or exception handling.

Stronger yet, in my experience it is a rather unique case if the called
function can make such a judgement, lest it has a *very* application
specific task [inherently tied to the task of its caller, such as a code
block within a function], a local (nested) procedure, or perhaps a recursive
function?

> Therefore, it is IMO good practice for a library to provide
> two standard services. A restricted one, with signals
> anticipated exceptional conditions through exceptions, and
> an extended one, where the result range is extended with
> exceptional codes or objects.

You are way ahead of me, but this is in fact my practice, I only haven't
realised it or made it an explicit rule.

> ... more than a decade later most mainstream langages dont
> support this (and dont support well a formal specification of
> anticipated exceptions, for that matter)

Which languages *do* support automatic state rollback?
I know Java supports exception specification, which others?

BTW, I found the following article also informative, discussing (among other things) software fault tolerance and exception handling:
NASA/TM-2000-210616 "Software Fault Tolerance: A Tutorial" by W. Torres-Pomales of Langley Research Center.
http://citeseer.nj.nec.com/cache/papers2/cs/18310/ftp:zSzzSztechreports.larc ..nasa.govzSzpubzSztechreportszSzlarczSz2000zSztmzSzNASA-2000-tm210616.pdf/to rres-pomales00software.pdf
It is highly geared towards safety critical systems and therefore rapidly accellerates out of the normal Windows software domain, but is interesting nonetheless for as far as the techniques therein can be translated to the Windows/Delphi world.
Another question for you: Do you know of any design patterns or example implementations of generic/abstract "Checkpoint and Restart" mechanisms, in Delphi?
I appreciate your feedback!
Kristofer
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Tue, 07 Feb 2023 05:40:27 UTC
Copyright © 2009-2023
HREF Tools Corp.