Re: Design Problem Aggregation
From: Merlin (merlin2769_at_hotmail.com)
Date: 05/12/04
- Next message: H. S. Lahman: "Re: inheritance question"
- Previous message: Neo: "Re: Transitive Closure with XDb1"
- In reply to: Robert C. Martin: "Re: Design Problem Aggregation"
- Next in thread: Robert C. Martin: "Re: Design Problem Aggregation"
- Reply: Robert C. Martin: "Re: Design Problem Aggregation"
- Reply: CG: "Re: Design Problem Aggregation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 May 2004 13:26:10 -0700
Hi Robert,
Thank you for your excellent suggestion. What you have proposed is
certainly a solution to my problem although I am not clear in one
area. The container in object G can have objects of type Gpart
(pointers... I wont repeat this in the rest of this post). Now you
suggested that I need to cast an element from this container from type
Gpart to type BASE (the base class in the main hierarchy). That will
prevent me from calling methods specific to A or B. What efficient
techniques are there to test the element from the container for its
type? Is such tests good practice? Are there better ways to process
objects in the container? It looks like I need to have virtual methods
for various types in BASE such as IsA() and IsB() returning FALSE in
BASE and TRUE in the class of the correct type. I have a bad feeling
about doing this... Casting also seems inelegant.
I read your article on ISP and looked at the decorator pattern in GOF.
The ISP idea was very refreshing and opened my eyes to problems I had
seen in the past. As I have not used ISP yet I can guess what will be
involved. Are the fears I expressed above justified when ISP is
applied to the class design problem that was proposed.
Kind Regards
Merlin
- Next message: H. S. Lahman: "Re: inheritance question"
- Previous message: Neo: "Re: Transitive Closure with XDb1"
- In reply to: Robert C. Martin: "Re: Design Problem Aggregation"
- Next in thread: Robert C. Martin: "Re: Design Problem Aggregation"
- Reply: Robert C. Martin: "Re: Design Problem Aggregation"
- Reply: CG: "Re: Design Problem Aggregation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|