CSCI E-143 CertPrep:   Error Handling   (Kalani, chapter 3)

Saturday, Oct. 23, 2004

This Saturday we will cover Kalani's chapter 3,  "Error Handling for the User Interface".

Here are some things in Kalani that you should know about:

Exceptions

Validating user input


This looks like a lot of detail,  but I think it's a lot easier to handle than an equivalent length of stuff in chapter 2 was.   You remember chapter 2?

See you Saturday.


Floating-point operations    (from the C# Language Specifications,  section 4.1.5)

The floating-point operators, including the assignment operators,  never produce exceptions.   Instead,  in exceptional situations,  floating-point operations produce zero,  infinity,  or NaN,  as described below:  


The  using  statement     (as opposed to the using directive)    (from the C# Language Specifications,  section 8.13)

[In the following example,  "R"  is a  "Resource",]  a class or struct that implements  System.IDisposable,  which includes a single parameterless method named  Dispose....

...a using statement of the form

using (R r1 = new R(), r2 = new R()) 
{
  r1.F();
  r2.F();
}
is precisely equivalent to:
using (R r1 = new R())
  using (R r2 = new R()) 
  {
    r1.F();
    r2.F();
  }
which is, by expansion, precisely equivalent to:
R r1 = new R();
try 
{
  R r2 = new R();
  try 
  {
    r1.F();
    r2.F();
  }
  finally 
  {
    if (r2 != null) ((IDisposable)r2).Dispose();
  }
}
finally 
{
  if (r1 != null) ((IDisposable)r1).Dispose();
}

Here are the relevant questions from the two tests at the end of the "short Kalani"  book:  

    Test 1:  questions  19  (page 364;  answer:  page 392),  23,  34.

    Test 2:  question  11  (page 408;  answer:  page 441).

(Some of these questions may duplicate those in long Kalani.   Both texts are listed here.)


Last revised Oct. 23, 2004