Monday 25 March 2013

Exception handling and fail fast or safe


Exception handling and fail fast or safe:- 


Exception handling in java induces us to design our program to be fail safe. Instead we should use 

exception handling to fail gracefully and quickly. Exception should not be carried around in the 

sequence flow for too long. Golden rule with exception handling is, throw early and catch late. When 

we hit an exception, it should be thrown immediately. We should not catch an exception unless we 

are sure what to do with it and the action we take by catching it should negate the failure.

No comments:

Post a Comment