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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e67a94e45ae33316 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-06 10:22:46 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!chcgil2-snh1.gtei.net!news.gtei.net!wn1feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc06-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3B97AB21.923D6482@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Another good URL for all you C++ haters References: <3b9604b1.10736828@news.geccs.gecm.com> <87u1yhmitg.fsf@deneb.enyo.de> <3B969DFA.414FAB0@worldnet.att.net> <3b97914c.4153792@news.demon.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 06 Sep 2001 16:57:52 GMT NNTP-Posting-Host: 12.86.32.142 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc06-news.ops.worldnet.att.net 999795472 12.86.32.142 (Thu, 06 Sep 2001 16:57:52 GMT) NNTP-Posting-Date: Thu, 06 Sep 2001 16:57:52 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:12821 Date: 2001-09-06T16:57:52+00:00 List-Id: John McCabe wrote: > > On Wed, 05 Sep 2001 21:49:24 GMT, James Rogers > wrote: > > > Java fans proclaim a lack of separation of > >interface and implementation to be an advantage because you have > >less code duplication. > > In my experience, Java fans claim that the Interface/Implementation > separation feature of OO is provided by the Java Interface structure > and Class structure (i.e. the Interface provides the Interface, and > the Class provides the Implementation). This seems a very high level > viewpoint corresponding to something like a pure virtual class (C++), > or abstract tagged type (Ada) rather than what Ada programmers often > see as the separation, i.e. the package spec/body. > > Personally I believe it is a combination of both. Java also allows the definition of abstract classes. They have the expected restrictions such as not being able to create an instance of an abstract class. Java interfaces are treated differently by the language. In Java you can extend (inherit from) only one class, producing single inheritance similar to Ada's. On the other hand, you can implement any number of interfaces, and interfaces may inherit from other interfaces. In many cases you can program Java entirely without the use of interfaces. Exceptions to this include the use of event handlers. Java event handlers are commonly used in GUIs and the reusable code modules called Java Beans. Note that, for Java Beans, only the event handler interface is required. There is no interface requirement for the get and set methods for Bean properties. Common practice, then, provides only partial separation of interface and implementation for Java Beans. Builder tools that use Java Beans employ introspection to evaluate Bean properties. In this case the implementation must report its interface at run time. Furthermore, there is no way to specify a constructor in a Java interface. Thus, even if you are diligent about building your Java classes from interfaces, you must still omit critical parts of the class definition. Why is introspection not as good as explicit separation of interface and implementation? Not every program uses introspection. Furthermore, introspection is a run-time activity. This means that compilers must have access to full implementation code, even though Java exclusively uses a shared library (aka dll) model for linking. There is no way in Java to perform an early compilation of just the interfaces, as can be done in Ada. Lack of separation inhibits large team development. Jim Rogers Colorado Springs, Colorado USA