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 <[email protected]> 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 <[email protected]>
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to