
- OOAD Tutorial
- OOAD - Home
- OOAD - Object Oriented Paradigm
- OOAD - Object Oriented Model
- OOAD - Object Oriented System
- OOAD - Object Oriented Principles
- OOAD - Object Oriented Analysis
- OOAD - Dynamic Modelling
- OOAD - Functional Modelling
- OOAD - UML Analysis Model
- OOAD - UML Basic Notations
- OOAD - UML Structural Diagrams
- OOAD - UML Behavioural Diagrams
- OOAD - Object Oriented Design
- OOAD - Implementation Strategies
- OOAD - Testing & Quality Assurance
- OOAD Useful Resources
- OOAD - Quick Guide
- OOAD - Useful Resources
OOAD Miscellanous Q/A #2
Question:How the exception handling mechanism is useful than the normal error checking code?
Answer:
Exception handling mechanism is useful/ preferred than the normal error checking codes considering the following reasons:
Exception handling makes it easy to manage run time errors in a systematic manner.
logical and syntactical errors can be easily corrected by the normal error checking codes but other problems like exceptions can not be debugged using normal error checking codes. Exception handling mechanism is needed for exceptions handling. Exceptions are unusual conditions that a program may encounter while executing. These unusual conditions are
Division by zero.
Accessing an element which is out of range of array.
Passing in a parameter which is not a valid range.
Attempting to use a negative size for an array.
With the help of exception handling , program can automatically invoke an error handling routine when an error occurs.
Execution handling is preferred because it makes it easy to separate the error handling code from the code written to handle the rest of the program.
In case of the normal error check code mechanism, there is no facility to detect and handle exceptions. Thus normal error check code lacks in following:
Proper recovery of errors is not possible.
Effective management of errors is not done.
In brief, exception handling mechanism is useful/ preferred because
It manages or handles the exceptions properly.
It avoid the situation stopping the normal execution of programs.
It effectively detects the exceptional conditions.
It is proper method to catch all types of exceptions.
In this method, proper recovery of exceptions is done.