(moved from the STOP() Happens thread…)
also related to the DAB article cited above, another article by David Bayliss on the ABC File Manager (Clarion Magazine, June 1999. FileManager II – ABC Design) includes the following:
GetField PROCEDURE(KEY K,BYTE Component),*?
This method is used to return an ANY variable corresponding to a given
component of a key. I didn’t want to have to protect the rest of my code
against GetField returning a null so the procedure ASSERTs that the
incoming component will be found. In other words, GetField gracelessly
handles out of range components.This does illustrate another agenda within ABC: offensive programming.
Defensively I would have coded so that an out of range value returned a
null, which would take two lines of code. Then on the receiving end nulls
would have been handled, presumably in some “see if we can still keep
going” fashion.There are four calls to GetField in abfile (i.e., this method is relatively
underused). Each would have had to temporarily store the GetField
result, test for the null and do something smart with it. This might have
taken five lines of code each (one for the declaration, one for the extra
assign, two for the null test, one to handle the null case). In total I
would now need 22 lines of code to handle something that should never
happen as opposed to the one line of code used in ABC. Doing that
throughout a heavily integrated file like ABFILE could turn 2000 lines of
code into 40,000 lines of code 95% of which would be rarely executed
and thus minimally tested. QED.
and finally, two months later in Clarion Magazine in August 1999, in the article Propitious Memory Corruption, DAB writes:
In this situation it will Assert, throw up garbage screen displays (if the assertions are ignored), and generally make it clear something is horribly wrong.
snip
So what is better? A system that works 99% of the time and just subtly corrupts your customers data or a system that downs tools and refuses to budge until it is fixed?
Thanks to Dave Harms you can find the articles at: