www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - More power than needed ... OOP to Don Clugston

reply "BLS" <lietz wanadoo.fr> writes:
Hi Don,

Don C. wrote :
<<In OOP, you spend your time trying to find Is-A relationships, but they
don't exist. Unsurprisingly, hardly anyone is "really" doing OOP. It
seems to be unimplementable.>>

Oops, what is the matter? . A Is-relation between two classes is just
inheritance. f.i. cB inherits cA, ergo cB is a special case of cA.


I think you talk about the problem to decide :  Do we have a
Has-Relationship or do we have a Uses-Relationship. ?!
I agree, it is often difficult to figure out the difference between Has- and
Uses- Relationship.
But when you keep in mind that a  Has-Relationship only exist when we can
say instead of :
cA has 2(n) cB objects ,
cA consists of 2 cB objects.
-------------------------
In other words : cA consists of 2(n) cB objects means  Has-Relationship.
Bjoern
Mar 17 2006
parent reply Don Clugston <dac nospam.com.au> writes:
BLS wrote:
 Hi Don,
 
 Don C. wrote :
 <<In OOP, you spend your time trying to find Is-A relationships, but they
 don't exist. Unsurprisingly, hardly anyone is "really" doing OOP. It
 seems to be unimplementable.>>
 
 Oops, what is the matter? . A Is-relation between two classes is just
 inheritance. f.i. cB inherits cA, ergo cB is a special case of cA.
Yes, that's exactly right. I'm saying that inheritance is rarely appropriate. If you read the Design Patterns GoF book, you'll see that But the defining feature of OO design is inheritance. Without inheritance, OOP doesn't have polymorphism. What I find extremely common in practice is "Can-be-treated-as-A" polymorphic relationships. Most of the time, "is-A" relationships are an approximation to "Can-be-treated-as-A" relationships. I think that polymorphism is very important, but inheritance-based polymorphism has many problems.
Mar 17 2006
parent reply "BLS" <lietz wanadoo.fr> writes:
Hi Don,
okay, now I understand what you mean. Takes a while. You may have noticed
<g> that english is not my favourite language.
GoF.
Yes of course, I know about it. I read Bruce Eckel s Thinking in Pattern and
Prof. Moessenboek OOP in Oberon 2 instead because I have heard that GoF
Design Patterns is a bit too theoretical. Can you confirm ? Or will you say
it is a "You need it" book ?
Thanks,
Bjoern


"Don Clugston" <dac nospam.com.au> schreef in bericht
news:dveppu$1im5$1 digitaldaemon.com...
 BLS wrote:
 Hi Don,

 Don C. wrote :
 <<In OOP, you spend your time trying to find Is-A relationships, but
they
 don't exist. Unsurprisingly, hardly anyone is "really" doing OOP. It
 seems to be unimplementable.>>

 Oops, what is the matter? . A Is-relation between two classes is just
 inheritance. f.i. cB inherits cA, ergo cB is a special case of cA.
Yes, that's exactly right. I'm saying that inheritance is rarely appropriate. If you read the Design Patterns GoF book, you'll see that But the defining feature of OO design is inheritance. Without inheritance, OOP doesn't have polymorphism. What I find extremely common in practice is "Can-be-treated-as-A" polymorphic relationships. Most of the time, "is-A" relationships are an approximation to "Can-be-treated-as-A" relationships. I think that polymorphism is very important, but inheritance-based polymorphism has many problems.
Mar 18 2006
parent reply Don Clugston <dac nospam.com.au> writes:
BLS wrote:
 Hi Don,
 okay, now I understand what you mean. Takes a while. You may have noticed
 <g> that english is not my favourite language.
I know the feeling. I'm an expat myself, and don't speak the local language (German) as well as I'd like... Your English is about 100 times better than my German.
 GoF.
 Yes of course, I know about it. I read Bruce Eckel s Thinking in Pattern and
 Prof. Moessenboek OOP in Oberon 2 instead because I have heard that GoF
 Design Patterns is a bit too theoretical. Can you confirm ? Or will you say
 it is a "You need it" book ?
Well, GoF was the book that launched the Patterns movement, everyone quotes it all the term and uses terminology from it. A lot of the code in it isn't spectacularly good, and parts of the book seem a bit clumsy, but it was certainly groundbreaking. So, it's true that it's too theoretical, but I think it's still probably a 'you need it on your shelf' book. At least, you need a good idea of what's in it.
Mar 18 2006
parent "BLS" <lietz wanadoo.fr> writes:
Thanks Don !
Mar 18 2006