View Single Post

  #10 (permalink)  
Old 08-14-2003, 02:20 AM
Mark van Gulik
Guest
 
Posts: n/a
Re: Extends is evil?

"Peter van Rooijen" <peter@vanrooijen.com> wrote in message news:<3f3a5326$0$49117$e4fe514c@news.xs4all.nl>...
> "Mark van Gulik" <ghoul@attglobal.net> wrote in message
> news:2caa87f8.0308121317.63025522@posting.google.com...
> > "Peter van Rooijen" <peter@vanrooijen.com> wrote in message

> news:<3f38f235$0$49110$e4fe514c@news.xs4all.nl>...
> > > "Guillermo Schwarz" <guillermo_schwarz@hotmail.com> wrote in message
> > > news:3f38e49d@news.totallyobjects.com...

> [...]
> > > > or a more real example: a Dog is a Cat that barks
> > > > instead of meows, so meow() calls bark().
> > >
> > > I've never seen code with such classes, much less it being called a

> "real
> > > example". Now I am sure you are kidding.

> >
> > How about OrderedCollection>>at:? Or Dictionary>>add: (if you think
> > that one's ok, you must instead have a complaint with
> > Dictionary>>select.

>
> Mark,
>
> I don't know which dialect this is in


VisualWorks 5i.2.

>, but I think I understand your point.
> I had not induced that Guillermo had this in mind. If I'm right it is the
> same thing that Nathanael Shaerli has researched for Squeak and to some
> people it's amazing how many funny inheritance things (such as blocking) are
> going on in its collection library.


I think I read a paper on this in the OOPSLA proceedings quite some
time ago. The collection hierarchy was analyzed for commonalities and
differences of protocol, modulo renaming. An idealized inheritance
DAG was built up from the core functionality of the classes.

> However, I don't think this (what Nathanael researched for his traits study)
> is a result (or an example) of implementation inheritance. Rather it is
> mostly a result of not having multiple inheritance.


I discovered long ago that strong typing and multiple inheritance were
a package deal. Either one is a disaster without the other. It's a
little less clear what happens when you have both. There might be a
similar all-or-nothing relationship with generics, reflection, type
inferencing, proof-carrying-code, etc.

> > Smalltalk has plenty of other meows and barks.
> > It gets by, but there are some truly ancient potholes that will never
> > be filled.

>
> Perhaps you know some really good examples of II in a Smalltalk library.
> That would be good, to have some examples we can all agree are II and then
> can use to discuss how "good" or "bad" it is.


Ok, OrderedCollection has these subclasses in VisualWorks 5i.2 (with
some parcels loaded):
-SortedCollection (probably a mistake)
-LinkedOrderedCollection (workable)
-FontDescriptionBundle (ChessClub)
-EncodedOrderedCollection (missing visitor pattern for literal
encoding)
-MessageHeaders (ChessClub)
-AHSPersistentOrderedCollection (should be generated code or
aspect)

Similar nonsense exists in the Dictionary hierarchy. A trivial
example is CEnvironment, which (1) is a Dictionary that has strings
for its keys and values [oooh, ahhh], (2) is effectively a singleton
with a #postCopy method for some unknown reason, and (3) is a place to
put class methods that are directly and indirectly related to OS
environment variables.
Reply With Quote