first meta- – ISA\\\Errors

Parent
Data
Errors
Aliases None.
Information This is about the error management.
Note
Note kind Explanation
Text The Exception construct has proven to be very useful to control execution flow in case one problem occurs.

However, the general way programming language like C++, Java or even C# provide this feature seems not very adequate.

  1. All of these languages support Exception by a for each individual problem: That's enormous in volume, in verbosity both at elaboration and at catch time.
    Fundamentally: Is each exception case a ? The question have to be stated.
    1. A specifies a classification of objects, and of the features that characterize the structure and behavior of those objects. But all Exceptions in C++, Java, etc. shares the same features in 99%.
      Therefore in this precise case, exception and errors must not be supported thru classification.
    2. On the other hand, Exception not only occurs in Error cases:
      • It can be convenient to stop a treatment when the result is reached (for in nested loops)
      • Some other case could be listed: continue, break and return keywords, yield return/break in C#
    3. To handle errors an Error relying mainly on an error code as proven to be efficient and is in fact much more appropriate.
  2. These languages also merge the notion of Exception and of Error: This is abusive.
    An Exception is some thing that introduce a rupture in the normal execution flow of instruction.
    An Error is an abnormal situation.
    Exception is just a way to handle Errors.
  3. The usual way of supporting Exception drives to have Exception to be .
    What's about having several problems to signal to caller?  You only communicate the first one? This driven developer to put the list of problems elsewhere: Not very nice.
  4. Distinction between RuntimeException and DesignTimeException put Java in a situation that you could declare Exceptions a method throw, but even if you don't, RuntimeException can always be thrown: A bit contradictory.
    At contrary, C# do not declare Exception, but in this case what are the Exception the caller is expected to manage… Confusing isn't it ?
  5. In real life, the effective case you need to distinguish is about the Exception (Error in fact) nature, because the treatment should often differ. There is in fact only 3 relevant domains:
    1.  Technical (disk is full),
    2. (you cannot validate while a given field is not filled in some circumstances),
    3. Business (you cannot perform debit of 100$ on your account because its balance is only 5$).​

To sum up, in Exception and Error are separated concepts. The Exception is an Element that can be thrown at run time. An Error is an Event. These types are usable together thru the Error exception .

Edition
Version 1
Country None.
Language  None.
Tirage 1
Dependencies None.
Inhibit all invariants False.
Ideas.
Diagram
Classes
Other modules
Assemblies

None.

Version and status

Version Date Description Status
V1R1 31-Dec-17 Initial. Candidate

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.