Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!johnson From: johnson@m.cs.uiuc.edu Newsgroups: comp.object Subject: Re: OO Ada -- another way Message-ID: <77500063@m.cs.uiuc.edu> Date: 8 Nov 90 17:17:00 GMT References: <90@ Lines: 37 Nf-ID: #R:bertrand@eiffel.UUCP >I do not understand Professor Johnson's last comment about >creating abstract classes ``only to get around problems by the >type checker''. This does not relate to anything in my experience. >In fact, I have often heard objections to static typing (often from >people used to programming in Smalltalk, Objective-C or C++) based >on the argument that strong typing limits the expressive power >of object-oriented programming. Whenever I have tried to go further >and understand the real problem, it has turned out that the claimed >counter-examples (in which typing constraints were supposed to be an >obstacle) only existed because of the absence of one or more of > (a) multiple inheritance > (b) genericity > (c) reverse assignment attempt >and could be handled quite elegantly, with typing constraints >fully in force, as soon as these mechanisms were available. I was not talking about programs that were impossible to type-check. I was just complaining about programs that created abstract classes with no implementation just so classes could multiply inherit from them and so have several interfaces. I consider this a bit ugly, but that is not the main problem. The main problem is that I keep running into people who think that this is the main purpose of abstract classes, whereas the REAL purpose of abstract classes is to reuse design, including abstract algorithms. Thus, abstract classes in Smalltalk almost always have useful code that is defined in terms of the undefined operations. I've seen quite a few abstract classes in C++ that don't. To reiterate, I was not claiming that type-checking limits expressiveness, just that types-as-classes seemed to encourage people to misunderstand the most important purpose of abstract classes. Ralph Johnson -- University of Illinois at Urbana-Champaign