Here's a start: As a side note, I would emphasize that interfaces in Java also represent a sort of inherent 'contract', basically saying, "All objects of this type will have these methods, and those methods should do this". They impose a type constraint over the object, which in turn allows for polymorphism without inheritance, which in turn is a good thing. Inheritance breaks encapsulation by giving you intimate knowledge and access to your super classes' wibbly bits. The bottom line is you should usually give some thought to whether or not a class is going to be inherited from, and what will happen if it is inherited from. Otherwise, overriding certain behavior and not others can break code in unpredictable ways (this has bitten me on the ass enough times to make me worry about it).

Of course, there are many times when inheritance is useful, and I certainly do use it a lot. Superclasses are typically very bare abstract classes with only common behavior, however, and are not typically instantiated by themselves.

But that's just like, my opinion, man :).
Allen


In reply to Re^3: Object Terminology by oylee
in thread Object Terminology by stvn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.