Need feedback on simple idea

Andrew Berg andrew_c_berg at
Sat Apr 12 04:15:29 UTC 2003

On Fri, 11 Apr 2003 19:14:19 -0700 (PDT), German Morales 
<germanmorales at> wrote:

> It seems that Nathanael Schärli wrote:
>> I think that the argument about "loosing encapsulation" is complete
>> bogus because it has no relevance in practice.
> [big snip]
> I'd like to add something to Nathanael's explaination...
> Sometimes it happens to me that when writing Unit Tests I want to check
> internal state of an object, for example to see if it was affected by a
> message, and I end up writing (previously not needed) accessors for some
> of the instance variables.
> Am I the only one?
> Unit tests should test as a black box only?
> If not, having public accesors is almost a need, at least the "get" ones.

Whenever I run into this, I add an extra message, something like 
#checkFooConsistancy which does the appropriate fiddling.  Or better, try 
to re-think the internal data structures such that there are not 
redundancies to be able to become inconsistant.

andrew_c_berg at

More information about the Squeak-dev mailing list