This applies to programming in the greater sense, but also drills down (my new favorite corporate term!!!) to perl.
Does anyone else use pre and post condition checking to build robustness into functions for perl programs? I know it is a bit extreme for a small program, but what about much larger ones?
Also, is there a module that can be used to verify pre and post conditions?
I.E.:
Psuedo Code:
use Cool::PrePostModule;
###
# some precondition documented here
# some postcondition documented here
###
sub functionname
{
# get all yer args here
&setPrecondtion('something == somethingelse');
&setPostcondition('thisthing == thatthing');
&checkPrecondition('somethingelse') or die 'I cant verify precondit
+ion';
#yadayadayada
&checkPostcondition('thatthing') or die 'I cant verify postconditio
+n';
}
Is this sort of construct a little too high level for the intended applications of perl programs?
_________________________________________
E-Bitch
Tempora Mutantur Nos et Mutamur in Illis
"The Times are Changed Even as We are Changed in Them"
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.