From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,953e1a6689d791f6 X-Google-Attributes: gidfac41,public X-Google-Thread: f79bb,953e1a6689d791f6 X-Google-Attributes: gidf79bb,public X-Google-Thread: 103376,953e1a6689d791f6 X-Google-Attributes: gid103376,public X-Google-Thread: fdb77,953e1a6689d791f6 X-Google-Attributes: gidfdb77,public From: "Marcos F. F. de Macedo" Subject: Re: Eiffel and Java Date: 1996/11/11 Message-ID: <3286EC0C.3893DF91@sede.unijui.tche.br>#1/1 X-Deja-AN: 195979635 references: <550sm2$sn1@buggy.news.easynet.net> <55562c$nkd@mulga.cs.mu.OZ.AU> <328592FC.64F26D66@sede.unijui.tche.br> <328831DB.47C86C44@horz.technopark.gmd.de> content-type: text/plain; charset=us-ascii organization: NAVOCEANO mime-version: 1.0 newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.sather,comp.lang.java.advocacy x-mailer: Mozilla 3.0 (X11; I; Linux 1.2.13 i586) Date: 1996-11-11T00:00:00+00:00 List-Id: Alexander Asteroth wrote: > > Marcos F. F. de Macedo wrote: > > This kind of interface/implementation in Sather is diferent of the usual > > concept. This is subtype/subclass independence. That is a good thing in > > Sather that I have not yet thinked of the exact consequences. > > > > Interfaces in Java have nothing to do with this concepts. Interface in > > Java is an implementation restriction (not a conceptual one) to avoid > > multiple-inheritance and work yet work with static typing. Interface is > > java is just a deferred class with just deferred routines. Nothing more, > > nothing less. > > I don't see your point. What is missing in Java's interfaces. > > If it's that you don't have to touch existing code (as F.H. wrote) > that has to do with supertyping, not with the abstract classes concept > of Sather (Or am I completetly wrong here?). > > Can you give an example of what you mean and what you think > is wrong about Java's interfaces? > Of course I can. Let's make myself clear. When I talk about abstract classes I talk about the general concept that Yes common to most object oriented classes (pure virtual in C++, defferred in Eiffel, abstract class in Smalltalk, virtual in Simula,etc). An abstract class is a classe that has one or more routines that dont have implementations but just interface. Such class can not have instances because its behavior is not defined. Its used to model general class for example. I can have an abstract class ANIMAL with sub-classes Dog, Cat, Bird. No object will be direct an animal but one of Dog, Cat or Bird. The abstract serves as the general model an in a Framework its the root of the main hierarquies. In static typed languages the abstract class is used to defined a minimal behavior of subclasses. Its common to abstract classes to not have all methods abstract but do define other that class abstract methods over self to give an special behavior. Such methods are called template and are in the soul of OOP. The Java interface are just an abstract class with all methods abstract (no implementation). Its is used because its hard to implement multiple inheritance when there are attributes. So you can inherit from one class but multiple inheritance. In languages such as Sather, Eiffel, Beta, etc... You can made abstract classes with just abstract methods and you will have the same behavior. But templates can only be done if some methods are not abstract. The good thing in Java is that you can inherit one parent (single inheritance) but can inherit multiple interface (multiple subtyping). In Eiffel you have (multiple-inheritance and multiple sub-typing). The type hierarquie in Sather is diferent in that you can put an interface in a class that was not declared to "implements" it. That can be a good thing to correct bad design but can be a good thing to make bad design too. You will have to work with two diferent hierarquies. Its that necessary? (if you want to know how this diferent implementations are done send me an e-mail). I hope thar this was not too long but too clear :-) -- Marcos F. F. de Macedo marcosm@sede.unijui.tche.br UNIJUI - BRAZIL