Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!news.uu.net!visix!news From: amanda@visix.com (Amanda Walker) Newsgroups: comp.object Subject: Re: Objects and Interactions: Separate Definitions Message-ID: <1991May22.021151.18641@visix.com> Date: 22 May 91 02:11:51 GMT References: <3999@motcsd.csd.mot.com> Sender: news@visix.com Distribution: comp Organization: Visix Software Inc., Reston, VA Lines: 46 [Sorry for the delay in responding--I've been out of town for a week] cimshop!davidm@uunet.UU.NET (David S. Masterson) writes: Amanda> ... A trivial example of this idea is that a heapsort Amanda> should operate on any set of objects for which I can provide Amanda> comparison and exchange operations. In object orientation, this seems to never be quite right. The real way of expressing a HeapSort() operation is that it operates on any set of Sortable objects (which is defined as having a comparison operation). Often, though, this looks like overkill as it expects an awful lot of things to derive from Sortable. One of the advantages of a dynamic type system in this kind of case is that Sortable need not be an explicitly declared class, as it would have to be in C++, for example. Now, multiple inheritance can help, in the form of "mixin" classes, but I find it most simply expressed in a dynamic type system in which the methods are dispatched at run time. Generic functions (or operators) allow some of this to happen in a static type system such as C++, since you can write the algorithm in terms of the operations which are available on the objects, and not their explicit types themselves. This approach is most useful for expressing abstract operations (like sorting) than for more concrete ones, admittedly. One method is a technique called (I think) double polymorphism which is a tricky way of having the derivatives of Sortable promote themselves up the hierarchy until comparible values are found. Yes. Not too many object systems easily support this, though. Which is not necessarily a bad cross. ER is used for determining Entities and Relationships which is very useful for understanding object definitions as well. Relationships can be treated, though, as objects just as easily as Entities. Once again, agreed. I find ER and "objects" to both be useful ways of looking at the same things in different ways... -- Amanda Walker amanda@visix.com Visix Software Inc. ...!uunet!visix!amanda -- Don't try to out-weird me... I get stranger things than you free with my breakfast cereal.