Re: Separation of API and implementation



As a practical matter this would be further enforced at the OOA/D level
by not passing 'y' as a reference to B::foo at all. Instead one would
instantiate a relationship between the B object and 'y'. Whoever
instantiates that relationship (by assigning the reference) would
encapsulate the rule that 'y' can only be a Yb. Then the B object just
collaborates with whoever is on the other end of the relationship
regardless of what interface is used and everything will Just Work. The
main purpose of relationships in the OO paradigm is to limit
participation in collaborations so we should take advantage of that.


Do you have a simple example of this - I don't fully grasp what you
mean by creating a relationship as opposed to a collaboration.

(Really appreciate the response - still trying to understand it all!)

.



Relevant Pages

  • Re: Passing by reference
    ... It depends upon the reason one is passing the reference. ... instantiate all relationships via a constructor so there will always be ... I naturally think of 'getter' methods as 'knowledge ...
    (comp.object)
  • Re: calling from one workbook the classes and functions in another
    ... having discovered the vb trick recently I'm suddenly a big fan ... > reference to the instantiated class. ... you can't instantiate the class. ... >> Copy your cls into a VB Project for an activex dll. ...
    (microsoft.public.excel.programming)
  • Re: Design question: Multiplying singletons
    ... Since relationship implementation is orthogonal to class semantics and it is usually easy to implement when originally defining objects, it is usually a good ideal to implement the *-side of such relationships and instantiate them properly even if there is no immediate need to navigate them. ... but not as much to keep the reference to the whole in the ... through the AController object. ... One could use a factory like AController to instantiate the relationships dynamically, ...
    (comp.object)
  • Re: VB6 Common Code for Access, Excel and VB Projects
    ... Instantiate the class as, say, YourClass, then qualify each reference to ... > without a class module included as well. ... >> Compile the code to an ActiveX DLL and add a reference to each VBA/VB ...
    (comp.programming)
  • Re: Opinions on the Law Of Demeter
    ... all that line of code is doing is declaring a reference of type A ... There are only references in Java, no pointers in the C/C++ sense. ... of allowing others to instantiate an object of type A and set it via the ...
    (comp.object)