IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: Inheritance versus Interfaces...
This did bring up a question for me though - I've always had a problem with the idea of multiple inheritances of classes when they overlap, and I like the way that Java deals with that - through Interfaces as opposed to Inheritance.


Standard lecture #1: implementation inheritance is overrated. Learn how to use plug-in functionality (Strategy and Visitor patterns if you want buzzwords) and your object oriented programming will get more maintainable and flexible immediately. :-)

It also has the ability to implement multiple versions of the same interface. So, if interface a has function foo(x), and interface b has function foo(x), you can select within the class which interface recieves the call, or you can specifically target one or the other interface. (Java might have that as well - I don't honestly know) I don't know if C# allows you to do the same thing with functions, but I have a feeling that it does.


Java has multiple interface inheritance.

Back to non-C#/Java world - multiple inheritances. These are ugly, especially where you have colliding implementations of the same derived functions. I myself am becoming addicted to Interfaces, despite the inability to reuse code, due to the reduction in collision problems.


Now, just transfer that thinking to plug-in type architectures, and you get the benefits of both approaches: inherited functionality, and no collisions.
Regards,

-scott anderson
New Thane, read Gamma et al. "Design Patterns" NOW...
I would personally say, read it (or something similar--any recommendations, Scott?) *before* you get heavily into Java (since you already have some coding experience). It will expose the "plug-in" approach Scott's talking about.
"A stupid despot may constrain his slaves with iron chains; but a true politician binds them even more strongly by the chain of their own ideas;...despair and time eat away the bonds of iron and steel, but they are powerless against the habitual union of ideas, they can only tighten it still more; and on the soft fibres of the brain is founded the unshakable base of the soundest of Empires."

Jacques Servan, 1767
New Personally, I have (and prefer) the CD version of the GoF
[link|http://www.bookpool.com/.x/6dz2mbtt24/sm/0201634988|Get it cheaply at bookpool.com]
Regards,

-scott anderson
New Right
"Plug-in" being a buzzword for deliberately disguised proceduralism.
New Er, what?
Regards,

-scott anderson
New Somewhat Glossed Over
This issue doesn't arise in a real object language like Smalltalk. Still, from my limited persepective, what you say is of course correct. It just shows that Java is a half-assed object language. (Naturally, it's based on a third-assed object language).

Don't you agree that this deflection onto "interfaces" of fundamental concepts is a total kludge?
New Don't pontificate
... where you have little to no clue.

Jay O'Connor uses the strategy and visitor pattern quite a bit in Smalltalk.

ANY language using inheritance will eventually run into the n * m problem.
Regards,

-scott anderson
     Inheritance versus Interfaces... - (inthane-chan) - (22)
         Well, being an Object Pascal user and fan... - (CRConrad) - (1)
             I could be wrong. - (inthane-chan)
         Re: Inheritance versus Interfaces... - (admin) - (6)
             Thane, read Gamma et al. "Design Patterns" NOW... - (tseliot) - (3)
                 Personally, I have (and prefer) the CD version of the GoF - (admin)
                 Right - (deSitter) - (1)
                     Er, what? -NT - (admin)
             Somewhat Glossed Over - (deSitter) - (1)
                 Don't pontificate - (admin)
         "no flame-wars"? .....party pOOper -NT - (tablizer)
         More mechanisms exist - (tuberculosis) - (7)
             Go for the XSL as a topic for sure. - (admin) - (6)
                 The problem right now... - (inthane-chan)
                 I'd love to hear them - (tuberculosis) - (3)
                     Couple of quickies: - (admin) - (2)
                         eXtensible Mangling Language - (static)
                         Heh - (deSitter)
                 That's how VB defines things... - (inthane-chan)
         Re: Inheritance versus Interfaces... - (JimWeirich) - (3)
             Re: Inheritance versus Interfaces... - (Arkadiy) - (2)
                 That's the basic of it. - (inthane-chan)
                 Re: Inheritance versus Interfaces... - (kelzer)

History shows again and again how Nature points out the folly of men.
165 ms