Clean Code and The Art of Exception Handling

Clean Code and The Art of Exception Handling

22 Apr 2016
2 Comments
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 an 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 have been developed for different languages, one of the best examples is Ruby.

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

There are different recommended practices that help in embracing exceptions:

Maintainability: With this, bugs can easily be 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 workflow.



Comments

Name:

Hippie

Message:

Fiidnng this post has solved my problem

Reply:

Name:

whole life insurance rate

Message:

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!|

Reply:


Leave a comment: