July 26, 2003

The Debug and Release Check Technique

Assertions are excellent at catching bugs during development. However, some checks need to be performed at runtime for production code as well. A good way to wrap the two is this: if (condition_failed){ ASSERT(false); return error_code} At debug time, this forces the debugger to stop at the error point. In

Use Interfaces to Increase Source Code Flexibility

Where possible, use interfaces (as opposed to interface-implementation classes) to increase your source code’s flexibility. If you later need to change an interface-implementation class (to improve performance, for example), it’s a trivial matter to change a constructor call (or a call to a static factory method) as opposed to making

Copy Filenames to a Clipboard

File hierarchies are becoming more complex and file paths longer as the capacity of hard drives increases. There are still many occasions, however, when you can’t browse to identify a file to be used?for example, when entering a constant in VB source. Normally, there is no alternative but to type

Take a Quick Look at a File

The Windows Script Host (WSH) supports many useful features, including VBScript’s FileSystemObject object and the ability to drag and drop filenames. You can drag and drop a data files icon onto the script (or a shortcut to the script) to see the first ten lines of a file, or you

Practical XML for Java Programs

he true raison d’The Dos and Don’ts of XMLXML is a universal format for transferring hierarchically organized data. When properly formatted, XML documents are readable, self-explanatory, and platform-independent. In practice, certain general XML features can be discarded: entities, DTD (Document Type Declaration, now mostly replaced by Schemas), and processing instructions