I am of same idea that compositions is better way to isolate interface from implementation in almost all languages. This is important for "component oriented" software (XPCOM, COM) where high independency between each component is required (in compiling and in developing). In majority of scripting languages (like JS) composition is important too, because there is no private members or "explicit overriding".
However, for internal usage (to not expose in API), inheritance is still THE solution to define an is-a relationship. Forced delegation inside implementations requires redundant code (that makes code less maintainable and error prone). In a JS widget system, inheritance is not designed/recommended to use to extend third part widgets, but for internal usage to implement a set of widgets of same team/project. Inside jQuery UI also it is used inheritance (mixing parent prototype) to extend all their widgets from an base. If inheritance brought problems, it is very likely that it is not used properly or it is overused. With an good software architecture that shouldn't happen. PS: I da, dobro mi je poznat i C++ osim JS, C#, python, ... barem bolje od engleskog. On May 14, 11:35 am, DBJDBJ <[email protected]> wrote: > GOOD : > > interface X { } ; > class A implements X { } ; > > BAD : > > class Y { } ; > class B inherits Y { } ; > > Also, please do not feel sorry for me, I use JavaScript only when > necessary ;o) > > PS: Tvoj english uopste nije los ... > > -- DBJ > > On May 14, 6:17 am, Robert Katić <[email protected]> wrote: > > > I suppose you ALWAYS use delegation to define an is-a class > > relationship. > > If so, I am sorry for you. > > > Inheritance is an easier way to define an is-a relationship. > > Unfortunately it is often overused. > > Unfortunately changes to super-class can easily break sub-classes, > > specially in script languages where there is no good separation > > between interfaces and implementations... > > Mixins ($.extend) suffer same problems. > > > An possible solution of this problems is to implement "explicit > > overriding" (like C#). > > It's not hard to implement, but it would probably make inheritance > > unnecessary harder to use, specially in JS, where it is probably that > > sub-class and super-class is defined by same programmer. > > > However I think that inheritance is an powerful tool in hand of good > > programmers. > > > Sorry for my English. > > > On May 14, 1:07 am, DBJDBJ <[email protected]> wrote: > > > > "Inheritance is Evil" ... > > > >http://www.berniecode.com/writing/inheritance/ > > > > --DBJ > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
