Created January 3, 2010
Last updated January 3, 2010
[ Japanese | English ]

Design policy when an exception occurs

  In this page , I will explain the design policy when an exception occurs.

  The exception handling is necessary regardless of the object-oriented design and programming. Then , because I thought that it was not a content suitable in this contents , I had not written at long time.
  But , because the amount of the design and programming source code of the exception handling is often more than that of the normal processing, and because it is important , I will explain.

 
1. What is the exception?
2. The design policy when an exception occurs
3. Reference


1. What is the exception?

  First of all , I will explain the exception.

  I don't know the strict definition, but I think that it is to become impossible to execute the normal processing.
The following are the typical causes of the exception.
  1. User's input mistake is detected.
  2. The file is not found.
  3. Failure of the accessing (writing or reading) to the file.
  4. Accessing to the null pointer.
  5. Deviding by 0 (zero).
  6. Accessing to the undefined index of the array.
  7. Failure of the accessing to the network.
  8. Failure of the accessing to the DB ( Database ).
  9. Failure of the SQL.
  10. Lack of the heap memory.

Note : Of course , because you can define the causes , there are many other too.

  The first "User's input mistake is detected." might not be included in the exception.
This is dependent on the policy of the system development.
( Note : Even if it is not included in the exception , this doesn't mean that "User's input mistake is detected." is not needed. )
Back to Top

2. The design policy when an exception occurs

  When an exception occurs , what should the program do ? I think the following.


Finally , I will describe 2 points.
1. Because the prohibited matters in the exception handling is written in the book of the Anti-pattern , please read books.
(For example , there are The Man with the Axe anti-pattern , Ignoring Reality anti-pattern)
2. You should design supposing that an excepiton occurs. "It is likely not to occur." is very denger. I repeat , the amount of the design and programming source code of the exception handling is often more than that of the normal processing. There is a case that you can't design an exception handling well. In this case , you may think that you define the limitation.
Back to Top

3. Reference

  The following tables are pages that I referred to create this page.

No.

Linked Website Name

Description

Linked date

1 Exception handling - Wikipedia, the free encyclopedia This page explains the exception handling 2010/1/3

No.

Author

Book Name

ISBN

1 Bill Dudney , Stephen Asbury , Joseph K. Krozak , Kevin Wittkopf J2EE AntiPatterns 978-0471146155


Prev Up Next  Top
Back to Top

I doesn't assume the responsibility of any damage that occurs because of the use of this page.

Visual Basic® for Applications may represent a VBA.
Mac ,Mac OS ,Mac OS X ,AppleScript are trademarks of Apple Inc., registerd in the U.S. and other countries.
Sun, Sun Microsystems, Sun Microsystems Computer Corporation, the Sun logo, the Sun Microsystems Computer Corporation logo, Solaris, Java, JavaSoft, JavaScript, HotJava, JDK, and all Java-based trademarks or logos are trademarks or registered trademarks of Sun Microsystems, Inc.
Other brands and their products are trademarks or registered trademarks of their respective holders and should be noted as such.

The author of this page and these companies do not have any relationship.