Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!ames!pacbell!osc!jgk From: jgk@osc.COM (Joe Keane) Newsgroups: comp.object Subject: Re: Inheritance explained... finaly... Summary: Some of OO is right, but some is quite wrong. Don't buy it all. Keywords: inheritance Message-ID: <1831@osc.COM> Date: 9 Jan 90 21:11:48 GMT References: <1130005@gore.com> <14185@lambda.UUCP> Reply-To: jgk@osc.COM (Joe Keane) Organization: Object Sciences Corp., Menlo Park, CA Lines: 36 In article <14185@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes: >In any case, I still have doubts about the future of Object-oriented >programming. After all, except for inheritance, the whole concept >is a subset of what can be done with generic functions and overloading. >Maybe the correct approach is to add inheritance to a language which >has generic functions - it can't be THAT hard. Mr. Giles has a number of good points. Let me quickly enumerate the bad points of the object-oriented paradigm as it stands today. Type system. Single inheritance completely falls apart once you leave the typical textbook `tree of types' example. Multiple inheritance fixes a number of these problems, but usually complicated things even further. I have yet to see a language which does multiple inheritance cleanly. I can say more about what they do wrong and how to do it right, but that would be a long post. Multiple arguments. Forcing the first (implicit) argument to be special is bogus. This is what you want sometimes, but many operations are fundamentally operations on more than one object. The way you add two numbers in Smalltalk is to construct a message containing one of the numbers as an argument to the addition operator, and send that thing to the other number. I'll let the reader decide if this makes sense, never mind if it is elegant. Also, polymorphism should not be indexed on the class of the first argument. Side effects. Object orientation includes a vague assumption that messages modify their receivers, but not their parameters. This needs to be made more explicit and more general. Note that the C++ `const' keyword is a start, but it only addresses whether you modify the parameters or objects themselves, and not what they may refer to or depend on. Certainly any language which doesn't have a concept of a pure function is deficient. Notably, Smalltalk gets zero out of three on this evaluation. This isn't meant to be critical of the designers of Smalltalk, since you must take into account that it was originally a string pattern matching language, and was created a long time ago before the object-oriented paradigm existed as such. However, i worry when i hear people touting Smalltalk as the state of the art.