Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How much of your code do you test?
Message
De
12/11/2002 12:48:39
Patrick O'Neil
American Specialty Information Services
Roanoke, Indiana, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00721300
Message ID:
00721708
Vues:
13
>
> Absolutely, however, with my personal coding standards, there are two rules
> that I follow which make the work simpler than otherwise might be the case.
>
> First: No premature exits of iteration structures. If an exit is required
> that's predicated on a logical condition, then a DO WHILE...ENDDO loop is
> used.
>
> Second: Each module has one, and only one exit point, namely the last line.


hi george -

i'm always interested to read your comments.

i heartily agree with your implied philosophy that personal coding
standards really go a long way toward producing error-free code.
glad to hear that though (re)expressed.

as for having one-and-only-one exit point ... i used to adhere to
that policy also, but over time have adapted my technique.

now, i always have a dedicated section at the beginning of a subprogram
that as much as possible, validates all data used in that subprogram.
(of course this cannot completely validate, when processing a table or
cursor, but ...)

it just got to seem, that the deep nesting resulting from combining
the validation with the processing often made the code hard to read --
to the point it became more likely to have logic errors.

in short, to have several exits from a standard validation section
amounts to having a single exit from validation, and seems worth
it since it simplifies the processing section. and i know exactly
where to look for different types of functionality in my subprogram.
patrick
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform