Re: c++ class design: where to put debug purpose utility class?
On Jun 27, 4:31 pm, Phlip <phlip2...@gmail.com> wrote:
123098...@gmail.com wrote:
Let's say I have the following class:
[...]
"Testing privates" is a FAQ in the unit testing communities.
The best answers is: If you invented your class using Test
Driven Development, then foo would expose enough effects of
its private member - slightly more effects than its production
clients need - that tests can indirectly assess the
performance of the private.
Actually, I think that test driven development would have a
slightly negative effect here. Greg made the real point: a
function has post-conditions. If you can't see them, then they
don't matter, and so aren't real post-conditions. And if you
can see them, you verify that they work.
But this concept really comes out of programming by contract,
rather than test driven design (which can easily be used to
avoid specifying the necessary contracts).
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34