Article Preview
Buy Now
COLUMN
Writing Debuggable Code
It's The Next Best Thing To Bug-Free Code
Issue: 6.1 (November/December 2007)
Author: Charles Yeomans
Author Bio: Charles is the author of "I Declare: Calling External Functions in REALbasic", available online at http://www.declareSub.com/
Article Description: No description available.
Article Length (in bytes): 8,133
Starting Page Number: 39
Article Number: 6116
Related Web Link(s):
http://www.declareSub.com/
Excerpt of article text...
You will not write bug-free code. But perhaps it's enough to write code that is easy to debug. Bugs are usually easy to fix when you can reproduce them and isolate them. In this issue's column, we look at some example code and rewrite it to be debuggable.
Let's consider the example of a window containing two edit fields StartDateField and EndDateField, and a listbox ReportListbox that holds the result of a database query returning all records in the specified date range. Here is some typical code for generating a report from such a query.
Sub BuildReport()
dim startDate as Date
if not ParseDate(StartDateField, startDate) then
...End of Excerpt. Please purchase the magazine to read the full article.