Re: to subclass or separate
From: Bjorn Abelli (bjorn_abelli_at_DoNotSpam.hotmail.com)
Date: 03/17/05
- Next message: John C. Bollinger: "Re: Sorting a hashtable"
- Previous message: John C. Bollinger: "Re: pooled connection myth"
- In reply to: Matt Humphrey: "Re: to subclass or separate"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 17 Mar 2005 18:35:57 +0100
"Matt Humphrey" wrote...
>
> "Bjorn Abelli" wrote
>> ...or something in between, i.e. that you maybe should construct another
>> superclass (abstract) with the parts that are the same in both Message
>> and
>> Reply, and let them both be subclasses from a common superclass.
>
> That certainly is another way to setup inheritance. I would still make
> the
> decision to use inheritance or not based on whether the objects were
> variations of some kind or whether their similarities were superficial. I
> would try to avoid using inheritance to share implementation details of
> objects that are not strongly related.
Exactly, it all boils down to in what way the concepts are related, which
really only the OP can figure out.
It did sound to me as both "Message" and "Reply" are two different types of
a common concept, actually of some "MessageType", but still differ in
significant implementation details, so one not can say that a "Reply" is-a
"Message" or vice versa, but they can both be said to be of some
messagetype, just like cats and dogs both are mammals, and thus share some
traits...
// Bjorn A
- Next message: John C. Bollinger: "Re: Sorting a hashtable"
- Previous message: John C. Bollinger: "Re: pooled connection myth"
- In reply to: Matt Humphrey: "Re: to subclass or separate"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|