|
On 10-Nov-07, at 1:00 PM, Ken Sims wrote:
> IMO, monitor should be used sparingly, only for things that are
> unexpected or if there is no easy way provided to test in advance
Have to disagree with you here Ken.
Monitor is a relatively lightweight task and I feel the decision to
use/not use should be based on the likelihood of the error
occurring. The ease or otherwise of the testing is irrelevant.
Monitor logic is _much_ clearer since a) You know that the programmer
anticipated a potential problem b) the anticipated code path is
obvious c) the error handling is obvious.
When you see something like:
If myVar <> 0;
do lots of stuff:
else;
do other stuff;
endif;
You really don't know until much later _why_ the variable is being
tested - whereas an On-Error DivideByZero; makes it pretty darn clear.
I would agree with you in cases where there was a high probability
(i.e. > 50%) that the date was bad or whatever - but otherwise I
think MONITOR is a far superior solution.
Now if only Barbara would give us THROW to go with it ...
Jon Paris
www.Partner400.com
www.SystemiDeveloper.com
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.