> Ideally, one would not need to care about private variables because we
are only interested in that the public interface does what it is supposed
to do. Right ?

Yes, at least as far as it concerns the testing.

Denpendency Injection has other aspects.

As an example, if there is a class that prints to stdout you mayby would
not test that, taking it as an "interal" behaviour.
With DI you inject the output stream, with the result that you can use
different printers in future.

Lyx already does this in many caes. Exactly that is dependancy injection.

Now you could drop in a MockStream to prove that the class uses the stream
object like expacted.

Regards

\Elmar


-- 
Elmar Hinz
Freiherr-vom-Stein-Str. 1
33014 Bad Driburg

TYPO3 community contact: t.3.e.l.m.a...@.g.m.a.i.l.dot.c.o.m
personal contact: e.l.m.a.r.dot.h.i.n...@.g.m.a.i.l.dot.c.o.m

Reply via email to