Interfaces allow you to have polymorphism just as well as inheritance does. So, one could not use inheritance at all and implement interfaces to acheive polymorphism.
Dave >From: Eddie Bush <[EMAIL PROTECTED]> >Reply-To: "Struts Developers List" <[EMAIL PROTECTED]> >To: Struts Developers List <[EMAIL PROTECTED]> >Subject: Re: [Proposal] Sub-application inheritence >Date: Tue, 08 Oct 2002 09:54:22 -0500 > >Jon Harvey wrote: > >>I must side with Craig's world view: >><snip> >> >>>sub-apps should be as self >>>contained and independent as possible, in the same manner that webapps >>>should be as self contained and independent as possible. >>> >></snip> >> >>OO is first and foremost about encapsulation. >>Your solution's objects mirror the user's mental model. >> >You must have missed my post about adding a switch to make it optional and >default it to "off". > >>Inheritance breaks encapsulation. It tightly >>couples subclasses to superclasses. A subclass depends on >>the implementation details of its superclass for its proper >>function. If the superclass's implementation changes from >>release to release, the subclass may break even though it >>hasn't been touched. >> >>When I model I use this rule of thumb: >>If inheritance isn't in the domain model, >>don't have it in the implementation. >> >>I try to use composition over inheritance which >>IMHO makes the code easier to understand. >>One of the biggest mistakes for Java newbies is to >>jump into inheritance and end up with an app made >>up of one huge inheritance heirarchy. It is evil to >>maintain - I have had to try and 'fix' quite a few. >>You spend most of the day traversing the heirarchy >>playing "find the implementation". It's tedious when >>you have the source but becomes evil when you have >>to decompile some framework's jar and find out the >>inner workings of superclasses. >> >Ok - I see that side. You don't find polymorphism (which is kind of what >we're discussing, I think) a valuable asset? I do :-) > >>Sorry about the rant - Joshua Bloch explains it better >>as Item 14 in his book: "Effective Java Programming Language Guide" >>He helped architect & write alot of Java's collection >>classes which are an excellent example of how to write >>an API framework. It's well worth reading. >> >>Hmm sorry - probably a bit more than 2 cents... >>but I consider inheritance the most widely misused >>feature of OO languages. >> >Hey - 2 cents; 10 cents ;-) I don't think anyone's counting. The point was >to generate meaningful discussion. All views are important. It's really >kind of moot at this point though, as I observed in my response to Martin. >I now see (crystal) clearly that this discussion should be tabled until we >have a 1.1 final out there. > >As a rebuttal however :-) I would note that inheritence is one of the (very >powerful) tools of the OO paradigm. Yes, it can be misused. What can't? > >Ok ... I had a couple paragraphs explaining my point but I removed them (I >think voicing opinions on this issue would be counter-productive at this >time - sorry I started it!). Let's continue on and get 1.1 out the door >and then put our heads together - fair enough? I'm sure there's someone >out there wishing 1.1 were final so they could use it - and such >discussions are just going to side-track us from our primary goal, which is >reaching final status of 1.1. > >>Jon. >> >-- >Eddie Bush > > > > >-- >To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>