March 7, 2005

Throw Granular and Helpful Exceptions in Your Code

Suppose the user has to enter his name in a field. He forgets. Your Java code throws a NullPointerException. This is probably meaningless to the end user and encompasses a large section of defects?not just a missing user name. How will the user know it’s his fault and correct himself?

Building Temporary Tables to Optimize Queries

Applications often present a way to allow users to select a number of values. These values are then assembled in an IN() clause that contains a list of values to be matched, as in the following example: SELECT * FROM TableA WHERE SomeColumn IN( 1, 2, 3…) But as the

Dynamically Choose the Virtuality of a Member Function

Ever need to use the same member function from a inheritance hierarchy as both virtual and non-virtual? This code shows you how to do it dynamically, using a template. Suppose you have the following inheritance hierarchy: class checkBase{ public: void get() {cout