
- Forum
- Testing
- Software Patterns
- Re: Extends is evil?
Re: Extends is evil?
This is a discussion on Re: Extends is evil? within the Software Patterns forums, part of the Testing category; Carl Gundel wrote: > Perhaps ChessClub isn't a Set, but a Club. If I compute the union of > two ...
-
09-14-2003, 06:13 AM #21Chris Uppal Guest
Re: Extends is evil?
Carl Gundel wrote:
> Perhaps ChessClub isn't a Set, but a Club. If I compute the union of
> two clubs, should this return yet another instance of club? Smells
> wrong to me.
That's a good point, but it could be that the union of two [Chess]Clubs is just
a Set. (Compare
#start , #end
which is a String rather than a Symbol.)
Since this thread has risen from the grave, I may as well add the point that I
never got around to making earlier:
If a ChessClub were a Set then *which* set would it be ?
The set of club rules ?
The set of hardware (chess sets, clocks, etc) that it owns ?
The set of current, active, members ?
The set of paid-up members ?
The set of active + associate members ?
The set of paid-up members + those who haven't yet paid this year's
subscription, but will probably do so when the club secretary
gets annoyed enough ?
etc...
-- chris
-
09-14-2003, 05:38 PM #22panu Guest
Re: Extends is evil?
Carl Gundel wrote:
> Perhaps ChessClub isn't a Set, but a Club. If I compute the union of
> two clubs, should this return yet another instance of club? Smells
> wrong to me.
Isn't this what happens exactly when two chess clubs
decide to merge?
The new chess club has each member of the original
clubs as its members. But if a person was a member
of both clubs before the merger, he still won't be
a duplicate member in the new club.
Yes, ChessClub isn't the same thing as Set. But
one (simple) way of modeling a chess-club would
be to create a subclass of Set named ChessClub.
Models are models. They aren't the same thing as
the thing being modeled. It is wrong to mix the
two levels, which easily happens. A chess club as
we speak of it is a 'real thing' existing because
actual people contracted together to create it.
But Set is simply a class in Smalltalk.
So ChessClub and Set are two separate things. But
they are *similar* in some ways and therefore it is
possible to model ChessClubs as a (subclass of) Set.
-Panu Viljamaa
-
Sponsored Ads

Reply With Quote





