Interfaces were added to Java because they didn't want to (for reasons I fully appreciate) do multiple inheritance, which would have provided equivalent functionality (and then some). Interfaces are, IMO, very much worthwhile, but they do come at a significant performance cost vs pure virtual calls. They also provide nothing in the way of access control.
On Oct 27, 7:26 pm, William Ferguson <william.ferguson...@gmail.com> wrote: > > ("Interfaces", by the way, are just a "poor man's" subclass -- very > > little conceptual difference.) > > *choke* > > Uh OK. I'll leave it there. > I hope that one day you will see the difference. > > On Oct 28, 8:32 am, DanH <danhi...@ieee.org> wrote: > > > Android (and Java) would never have been built without subclasses. > > True, with a good suite of APIs you may never need to subclass > > anything, but that's simply because the people who designed the APIs > > were skillful in using the full power of the OO model. > > > ("Interfaces", by the way, are just a "poor man's" subclass -- very > > little conceptual difference.) > > > On Oct 27, 5:20 pm, William Ferguson <william.ferguson...@gmail.com> > > wrote: > > > > Sorry Dan, I have to strongly disagree with '"Subclasses", on the > > > other hand, are the "meat > > > and potatoes" of OO programming". > > > > IMHO subclasses are typically the most abused part of OO programming > > > and are often a cause of obscure programming bugs. The Android API is > > > a good case in point, many of the widget classes require you to > > > subclass them in order to provide additional functionality but don't > > > give you access to the attributes you need. IMO one of the main > > > failures of the Android API is that it makes too heavy use of > > > implementation inheritance (subclassing) rather than interfaces. > > > > I rarely subclass. I find I can get a much cleaner abstraction using > > > interfaces and composition. > > > And when I do subclass I keep the responsibilities and methods locked > > > down tight. > > > > Subclassing is a slippery slope that gets steep really fast. > > > > On Oct 28, 3:50 am, DanH <danhi...@ieee.org> wrote: > > > > > First you need to understand that "inner classes" and "subclasses" are > > > > two distinctly different things. "Inner classes" are mostly just a > > > > convenience, simplifying coding without actually providing significant > > > > additional function. "Subclasses", on the other hand, are the "meat > > > > and potatoes" of OO programming and provide power, function, and > > > > security advantages that are so substantial that few programmers ever > > > > grasp their full potential. > > > > > On Oct 26, 9:27 pm, zeeshan mirza <zeeshan.nabeel.mi...@gmail.com> > > > > wrote: > > > > > > Frank thank you for your answer. I know some points when do we need to > > > > > create inner classes like we cant extend more than one class so if we > > > > > create inner classes we can extend more classes. Am i right? is there > > > > > any other advantage of inner classes ? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en