Jump to content

Coding by exception

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dtallcott (talk | contribs) at 21:01, 15 May 2014. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Coding by exception is an accidental complexity in a software system in which the program handles specific exceptions that arise . This anti-pattern can quickly degrade software in performance and maintainability.[1]

How to Avoid

As a general rule, well designed software projects contain very few corner cases[2]. There are a variety of software development methodologies that purport to help engineers develop software that avoid these corner cases. They typically address dependency management issues. Design patterns are another tool for arriving at less of a 'one-off' solution. As a simple solution, programmers should avoid writing code to specifically handle an exception handling and instead use a more generalized solution. [Exceptions| exception handling] were invented to inform the user that something went wrong and should be fixed with care.

Accidental Complexity

Accidental complexity is that complexity which arises in computer programs or the development process which is deemed not essential to the problem being solved. Coding by exception is an example of accidental complexity. Where this issue arises from poor planning or programming, some complexity is an essential complexity and unavoidable. Here is a list[3] of accidental complexities:

  • Blind Faith
  • Error Hiding
  • Hard Coding

See also

References