Discover Our Blog

Clean Code and The Art of Exception Handling

Clean Code and The Art of Exception Handling

Exceptions are equally old as programming. It’s an amazing fact that since the time programming was done using basic primary level programming language, exceptions were used to make some required alternations in the program flow. This further helped in avoiding failure. “Exception handling is the process of responding to the occurrence, during computation, of exceptions – anomalous or exceptional conditions requiring special processing – often changing the normal flow of program execution”.

Exceptions require special treatment because unhandled exceptions can cause unforeseen behavior, which is difficult to handle. The best example of unhandled overflow exception was the famous Ariane 5 rocket launch, which failed.

Efficient Exception Handling Is Very Beneficial

The programming world is moving more towards OOP i.e. object-oriented programming hence, exception support has become an inevitable aspect of modern programming languages. Vigorous exception handling systems has been developed for different languages, one of the best example is Ruby.

It’s not necessary that codes always have some problem. They may seem perfect but in due course of time it can cause code errors, which can further cause harm to the code base.

There are different recommended practices that help in embracing exceptions:

Maintainability: With this, bugs can easily spotted and fixed without hampering the functionality.

Extensibility: This helps in adding extra elements in the existing code base, which can be further implemented without causing any damage to the existing functionality.

Create your own Application Error Hierarchy

Almost all the programming languages come with a variety of exception classes that are evenly organized in an inheritance hierarchy just similar to any OOP class. In order to preserve the Maintainability and Extensibility of codes it is very crucial to create own sub-tree of application-specific exceptions that can be extended further. Hence, devoting some time to construct own hierarchy can be very beneficial.

Cryptex Technologies makes use of all the industry sound practices for having an efficient programming work flow.


  1. Fiidnng this post has solved my problem

  1. I like the valuable information you provide in your articles. I'll bookmark your weblog and check again here frequently. I am quite sure I will learn many new stuff right here! Best of luck for the next!|

Leave a comment: