Java Best practices

Saturday, 12 March 2011

Exceptions (TOC)

Introduction to exception
How java implements Exception handling?
Types of Exceptions in java
            Checked vs unchecked vs Error type exceptions

Java's catching or throwing exception

This section discusses the reasoning behind this requirement and what it means to you and your Java programs.

Dealing with Exceptions

  • Example of class which has to deal with example
  • Catching and handling exception with try-catch-finally
  • Specifying the exceptions thrown by method using throws clause

How to throw Exceptions

  • The throw statement
  • Creating custom exception

Custom Exceptions

  • Adding custom exceptions to the project design
  • Creating the custom exception example
  • Naming convention for exceptions in java

Nested Exceptions

Runtime Exceptions--The Controversy

Exceptions and control flow

Finally and catch

Some practices related to exception:

    • Avoid @throws in javadoc

    • Javadoc all exceptions

    • Be specific in throws clause

    • Stack trace as String

    • Use template for repeated try-catch

    • Pass all pertinent data to exceptions

    Rekha Kumari at 02:35
    Share

    No comments:

    Post a Comment

    ‹
    ›
    Home
    View web version

    About Me

    Rekha Kumari
    View my complete profile
    Powered by Blogger.