Boost logo

Boost :

From: William Kempf (sirwillard_at_[hidden])
Date: 2000-12-19 09:42:31


--- In boost_at_[hidden], Jesse Jones <jejones_at_a...> wrote:
> It's pretty common for one public method to call another even when
the
> object doesn't strictly satisfy the invariant. There's usually
nothing
> wrong with the code, but it's awfully annoying to have to weaken
your
> contract for these occasionaly cases.

Let me clarify my stance. It's very common for a method to call
other methods, be the public or private. However, if the invariants
aren't still satisfied at the time of the call there's very tight
coupling between the two methods with no documentation of which
invariants need not be satisfied. This can lead to the same bugs
that can occur with out DBC to begin with. So, yes, there are cases
where this "must" be done, but because of the weakened assertions one
should avoid as many of these cases as one can. An invariant system
must allow for this, but a programmer should avoid it.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk