Loading ...
Sorry, an error occurred while loading the content.

Re: [XP] "Inheritance is a card we can only play once." (was: removing duplication)

Expand Messages
  • Victor
    ... Somebody once said that s possible to write a bad program in any language. Yet, there are languages and language flavors that are more helpful than others
    Message 1 of 1 , Jun 3, 2005
    • 0 Attachment
      Jeff Grigg said:

      > So I wouldn't say that you should be afraid of inheritance, or avoid
      > it. But overuse can get you into a tight spot that you'll have to
      > work to get out of.

      Somebody once said that's possible to write a bad program in any language.
      Yet, there are languages and language flavors that are more helpful than
      others for writing good code.

      For example Smalltalk with its workspace, allows you to write and test
      snippets of code. It is a great supporting tool for TDD. In addition to
      that, VisualWorks Smalltalk (and maybe others too) with its Refactoring
      Browser, makes it very easy to change hierarchies and to rename classes and
      variables. You rename in one place, and it changes the name everywhere the
      object is referenced. Where there maybe a conflict, it asks you to confirm.

      Of course, a good tool does not release anybody from their responsibility to
      be knowledgeable and to think. :-)

      Victor

      ==============================

      ----- Original Message -----
      From: "Jeff Grigg" <jeffgrigg@...>
      To: <extremeprogramming@yahoogroups.com>
      Sent: Friday, June 03, 2005 8:48 AM
      Subject: [XP] "Inheritance is a card we can only play once." (was: removing
      duplication)


      > > --- Ron Jeffries wrote:
      > >> To my recollection, [Kent Beck] just said something like
      > >> "Inheritance is a card we can only play once. We
      > >> should not play it too soon."
      >
      > --- Dominic Williams <xpdoka@d...> wrote:
      > > [...] if inheritance is TSTTCPW, we should just do it,
      > > we can always refactor later."
      > >
      > > So, was that "old" wisdom, or does it still apply?
      >
      > On a technical note: Smalltalk, Java and C# are limited to single
      > inheritance. C++ supports multiple inheritance, but it can get
      > quite tricky very quickly, so it's best to be cautious in its use.
      >
      > I'm sure that with Test Driven Development, we could refactor
      > inheritance out later, and replace it with something else. But in
      > single inheritance languages, you can still have only one parent
      > class at a time, so you'll have to *remove* any marginally helpful
      > inheritance hierarchy before you can add a more helpful one.
      >
      > So I wouldn't say that you should be afraid of inheritance, or avoid
      > it. But overuse can get you into a tight spot that you'll have to
      > work to get out of.
      >
      >
      >
      >
      > To Post a message, send it to: extremeprogramming@...
      >
      > To Unsubscribe, send a blank message to:
      extremeprogramming-unsubscribe@...
      >
      > ad-free courtesy of objectmentor.com
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.