Envy subclasses for superclass access 
Author Message
 Envy subclasses for superclass access


>I have been told that Envy can support test automation by providing
>the ability to define a subclass in which all superclass variables are
>visible.  This allows a test driver to be implemented as a subclass
>of the class under test.

Envy provides the ability to define an extension of a class.  An extension
is essentially a group of methods which can be loaded and unloaded
independently of the class definition. One could implement the test as a
separate application or a subapplication that extends the classes being
tested with methods that perform the tests, but it would be smarter to use a
real testing framework such as the Kent Beck one.  The classes and methods
that set up the tests can still be in a separate application--this way, they
can easily be separated before packaging.  Finally, in my not so humble
opinion, implementing a test driver as a subclass of the class under test
sounds suspiciosly like the design style of C++ programmers who still have a
hard time realizing that aggregation, collaboration, and inheritance cannot
be freely interchanged for the sake of pleasing the compiler.


Wed, 18 Jun 1902 08:00:00 GMT  
 Envy subclasses for superclass access


>Yes, of course -- this question arises in the context of developing patterns
>that document exactly such a framework.  The essential problem (not limited
>to Smalltalk) is how to achieve sufficient controllability and observability
>of the class under test when the implementation is encapsulated.  This problem
>must be solved (or tolerated) regardless of the test framework used.

Easy. The test framework should be able to break encapsulation. Encapsulation
is a mechanism for program organization. There are clearly reasons that
particular systems may need to violate it in a disciplined way, e.g. testing,
persistence. In Smalltalk this is possible through using the reflective
mechanisms. Java didn't used to have this, and they found they needed it, q.v.
the changes to the security mechanism in JDK 1.2.


The Object People                       http://www.objectpeople.com                  
613.225.8812(v) 613.225.5943(f)    

Wed, 18 Jun 1902 08:00:00 GMT  
 [ 3 post ] 

 Relevant Pages 

1. Envy subclasses for superclass access

2. How to copy a subclass from a superclass?

3. Changes in superclass are not reflected in subclasses.

4. Invoking a subclass's method on its superclass's instance

5. ENVY: Application with different superclass?

6. Using methods in the superclass' superclass

7. jython question: accessing protected superclass methods

8. access to a shared variables of a subclass?

9. To Subclass or Encapsulate? (WAS: Access Methods)

10. Accessing envy behind a firewall

11. VW:Envy:Remote access

12. How exporting Parcels From Envy For Non-Envy


Powered by phpBB® Forum Software