I'm not a real big fan of state variables, and in fact, for this example,
I had tossed around doing some status checks similar to what you've done,
but rejected it after a couple of false starts.
The problem with state variables is that they introduce some additional
coupling:
- What if the variable gets set to a value other than the legal values (or not initialized)? You could branch more often or less often than you think.
- What if you refactor and now need a finer-grain distinction (stale vs real stale)?
How do you track down which values to check, or does it now need some disjunctive
tests?
- Tracing the program flow now also requires a data simulation as well.
Yeah, again, just reporting on where I've been burned. But I think I've got
enough scars to not just be a guy in a diner on this one. You know, the guy
at the end of the counter who has an opinion on
everything even though
he's not been there? {grin}
-- Randal L. Schwartz, Perl hacker
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.