Home > Archive > Software Engineering > September 2005 > Basic condition???
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Basic condition???
|
|
| Roy Smith 2005-09-17, 7:00 pm |
| I'm maintaining a piece of code which is heavily commented with references
to "basic condition". After a bit of head scratching, I finally figured
out that the author is talking about an invariant.
Is "basic condition" an alternate way of saying "invariant" in some
theoretical circles, or did the author just make this phrase up to confuse
people like me? FOLDOC, Wikipedia, and Google all draw blanks on "basic
condition".
| |
|
| Roy Smith wrote:
> I'm maintaining a piece of code which is heavily commented with references
> to "basic condition". After a bit of head scratching, I finally figured
> out that the author is talking about an invariant.
>
> Is "basic condition" an alternate way of saying "invariant" in some
> theoretical circles, or did the author just make this phrase up to confuse
> people like me? FOLDOC, Wikipedia, and Google all draw blanks on "basic
> condition".
It sounds like an invariant.
It also sounds like the kind of comment that should be converted into an
assertion. For example:
// the frob should dingaling-dang my ling-long ling-long
Refactor that into (in C++):
#ifndef NDEBUG
bool theFrobShould(Frob & frob)
{
return frob.dingaling().dang() ==
my.LingLongLingLong();
}
#endif
assert(theFrobShould(frob));
....
assert(theFrobShould(frob));
....
assert(theFrobShould(frob));
....
The point is you can make the stuff inside the invariant checker arbitrarily
complex, and then you can call the invariante anywhere in the code where you
have a frob to check.
(Eventually, of course, you can refactor the invariant out into unit
tests...)
--
Phlip
[url]http://www.greencheese.org/Z Land[/url] <-- NOT a blog!!!
| |
| H. S. Lahman 2005-09-18, 6:57 pm |
| Responding to Smith...
> I'm maintaining a piece of code which is heavily commented with references
> to "basic condition". After a bit of head scratching, I finally figured
> out that the author is talking about an invariant.
IME it is an unconventional alternative for 'invariant'.
However, it does makes a certain amount of sense since an invariant
represents a particular condition of the software. It is not too tough
a leap that a 'basic condition' would be a condition that spans (is
always true for) some sequence of processing steps that each change the
condition of the software locally.
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
hsl@pathfindermda.com
Pathfinder Solutions -- Put MDA to Work
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
(888)OOA-PATH
|
|
|
|
|