Skip to main contentCal State San Bernardino / [CNS] / [Comp Sci Dept] / [R J Botting] / [CSci320] [Search ]
[Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Grading] [Contact]
Sessions: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
17.html (HTML) [17.txt(Text)] Fri Jan 12 12:37:23 PST 2007

Contents


    CS320/17 Exception and Event Handling and Chapter 14

      Prev 16Concurrency and JavaChapter 13 not sect'n 8lab16 Java102
      17ExceptionsChapter 14lab17 Java103
      Next 18PrologChapter 2 sect'n 13 + Prolog Handoutlab18 Prolog101

      Preparation

    1. Study chapter 14 and these notes. Focus on C++ and Java exceptions.
    2. Answer review questions at the end of the handout
    3. Hand in answers to 3 or more review questions.

      Key ideas to remember:

      1. exception
      2. handling an exception
      3. exception handler
      4. raising an exception
      5. disabling an exception
      6. built in exception
      7. event
      8. event handler

      Don't memorize all the exceptions and event types in Java. These details are need to develop code, not on the final. Instead book-mark(put in favorites) the online WWW documentation [ index.html ] that Sun maintains.

      The CSci202 book "Scansholm" and Bjarne Stroustroup's LRM make a useful reference for C++ programmers. They won't be on the final.

      Exception Handling Principles

    4. Convert_exceptions::=If you can not handle an exception then convert it to a higher level exception.
    5. Name_the_problem_not_the_thrower::=name exceptions to indicate what is wrong not where it came from.
    6. centralize_error_logging::pattern. Have a single object that is responsible for recording bad things.
    7. standard_error_dialog::pattern. Have a standard user interface for reporting and sorting out errors.

      Notes on Chapter 14

      Event handling arrived late in the computer languages but is now a vital part of programming(Section 14.6.2...). GUIs (14.6.1) are easier than they look!

      Exceptions are not a late arrival. They are natural way to cope with Murphy's Law: If anything can go wrong, it will.

      Exceptions in Java (Missing point in book)

      The book does not mention a property of RuntimeException in Java. Normally the compiler rejects code that fails to catch a thrown Exception and doesn't declare that it throws it. This is not true of RuntimeExceptions. A welcome relief. You should spend some time in next sessions's lab exploring the Throwable hierarchy [ Throwable.html ] in Sun's documentation.

    Class Work

    [ 17q.html ]

    Lab Work

    [ lab/17.html ]

    Next

    [ 18.html ]

End