Lecture overview -- Keyboard shortcut: 'u'  Previous page: Recommendations about exception handling [Section] -- Keyboard shortcut: 'p'  Next page: Recommendations about exception handling -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 29 : 30
Object-oriented Programming in C#
Exception Handling
Recommendations about exception handling

  • Control flow

    • Do not use throw and try-catch as iterative or conditional control structures

    • Normal control flow should be done with normal control structures

  • Efficiency

    • It is time consuming to throw an exception

    • It is more efficient to deal with the problem as a normal program aspect - if possible

  • Naming

    • Suffix names of exception classes with "Exception"

  • Exception class hierarchy

    • Your own exception classes should be subclasses of ApplicationException

    • Or alternatively (as of a more recent recommendation) of Exception.