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

[XP] Re: YAGNI and Solid Code

Expand Messages
  • Stefan Egilsson
    thomas matelich wrote: original article:http://www.egroups.com/group/extremeprogramming/?start =2511 ... issue when it comes ... pointers
    Message 1 of 18 , Feb 28, 2000
    • 0 Attachment
      thomas matelich <tmatelic-@...> wrote:
      original article:http://www.egroups.com/group/extremeprogramming/?start
      =2511
      > Stefan Egilsson wrote:
      >
      > > I do not agree with the notion of "breaking the base class".
      > > What you are doing is reusing the base class implementation
      > > for your own purpose, which does _not_ affect how others reuse
      > > that base class (unless you are manipulating static variables
      > > in the base class, which is something I never do).
      > >
      > > Thus "breaking the base class" is not an issue, as it only affects
      > > the correctness of your own derived class.
      > >
      > > In other words, I totally disagree with you on what is the issue
      > > here, I say it is about not breaking subclasses, while you say
      > > it is about not breaking base classes. Well, I guess that is a
      > > sign of a healthy difference of opinion :)
      >
      > Not "breaking the base class" seems to me to be a very important
      issue when it comes
      > to using derived classes polymorphically. If I maintain a vector of
      pointers to a
      > base class, I want to know that they will behave in the manner
      prescribed by the base
      > class.

      That is a basic property of polymorphism. The reason I disagree
      with the notion of "breaking the base class" is that I think there is
      no such thing. It is the _extending_ class that can be broken, not the
      base
      class. Even if it might appear to be the base class that is broken,
      that is really not the case, it is the use of it in the extending class
      that
      is broken. In other words, it is always the responsibility of an
      extending class to ensure that it complies the the specification of the
      base class. This is something that you have to have in mind no matter
      whether you are using protected data in the base class, or private
      data and protected accessor/mutator methods. The only difference is
      the freedom/responsibility which you have in extending the class.

      - Stefan
    Your message has been successfully submitted and would be delivered to recipients shortly.