[progress Communities] [progress Openedge Abl] Forum Post: Re: Oo Inheritance

  • Thread starter Thread starter agent_008_nl
  • Start date Start date
Status
Not open for further replies.
A

agent_008_nl

Guest
"Avoid inheritance, polymorphism": for me this meant "forget inheritance and the inclusion polymorphism that goes with it". https://webcourse.cs.technion.ac.il/236703/Spring2005/ho/WCFiles/06D-Inclusion-Polymorphism.pdf . I do not know if the writer of the paper meant the same. I would have to reread the paper. If the writer of the paper means this refacoring https://refactoring.guru/replace-conditional-with-polymorphism when he writes "Use polymorphism instead of repeated switch statements" he indeed contradicts himself. There is more than inclusion polymorphism though. Inclusion polymorphism can be missed. Alas the other possibilies for polymorphism in openedge are quite restricted compared to some other languages. Here what java creator Gosling said in a interview in 2001: A Delegation-Only Language Bill Venners: When asked what you might do differently if you could recreate Java, you've said you've wondered what it would be like to have a language that just does delegation. James Gosling: Yes. Bill Venners: And we think you mean maybe throwing out class inheritance, just having interface inheritance and composition. Is that what you mean? James Gosling: In some sense I don't know what I mean because if I knew what I meant, I would do it. There are various places where people have completed delegation-like things. Plenty of books talk about style and say delegation can be a much healthier way to do things. But specific mechanisms for how you would implement that tend to be problematic. Maybe if I was in the right mood, I'd blow away a year and just try to figure out the answer. Bill Venners: But by delegation, you do mean this object delegating to that object without it being a subclass? James Gosling: Yes -- without an inheritance hierarchy. Rather than subclassing, just use pure interfaces. It's not so much that class inheritance is particularly bad. It just has problems." ( http://www.artima.com/intv/gosling3P.html )

Continue reading...
 
Status
Not open for further replies.
Back
Top