Error Code - Error Codes and Exception Handling

Error Codes and Exception Handling

Error codes are slowly disappearing from the programmer's environment as modern object-oriented programming languages replace them with exceptions. Exceptions have the advantage of being handled with explicit blocks of code, separate from the rest of the code. While it is considered poor practice in methodologies that use error codes and return codes to indicate failure, programmers often neglect to check return values for error conditions. That negligence can cause undesirable effects, as ignored error conditions often cause more severe problems later in the program. Exceptions are implemented in such a way as to separate the error handling code from the rest of the code. Separating the error handling code from the normal logic makes programs easier to write and understand, since one block of error handling code can service errors from any number of function calls. Exception handling also makes the code more readable than implementations with error codes, since exception handling does not disrupt the flow of the code with frequent checks for error conditions.

Read more about this topic:  Error Code

Famous quotes containing the words error, codes, exception and/or handling:

    We call contrary to nature what happens contrary to custom; nothing is anything but according to nature, whatever it may be, Let this universal and natural reason drive out of us the error and astonishment that novelty brings us.
    Michel de Montaigne (1533–1592)

    I cannot help thinking that the menace of Hell makes as many devils as the severe penal codes of inhuman humanity make villains.
    George Gordon Noel Byron (1788–1824)

    The ways by which you may get money almost without exception lead downward. To have done anything by which you earned money merely is to have been truly idle or worse.
    Henry David Thoreau (1817–1862)

    Mothers risk alienating their mates if they expect them to hold or care for the baby exactly as they do. Fathers who are constantly criticized or corrected may lose interest in handling the baby, and this is a loss for everyone. The cycle is a dangerous one. Now the same mother feels bitter because she is no longer getting any help at home.
    Cathy Rindner Tempelsman (20th century)