The Artima Developer Community
Sponsored Link

Legacy Design Forum
Composition Versus Inheritance



This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


The copout and the java API

Posted by Chris Morris on December 01, 2000 at 7:50 AM

We've got to program with Java as it is, and not having multiple inheritance forces us to use composition a lot, eg a GUI object can't also inherit from a problem domain class.

The opponents of multiple inheritance/"Java advocates" mostly also say "Don't inherit implementation." It's helpful to note that the API forces us to inherit implementation a lot, eg when writing an applet or using RMI.

Unless you can find an employer who uses Eiffel, Java is pretty good, so lets complain too much!


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us