Re: Design Problem Aggregation

From: Merlin (merlin2769_at_hotmail.com)
Date: 05/12/04


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



Relevant Pages

  • Re: Design Problem Aggregation
    ... This means that the more abstract class knows about ... do not wire the casting logic in the ancestor - do all your ... The container in object G can have objects of type Gpart ... > I read your article on ISP and looked at the decorator pattern in GOF. ...
    (comp.object)
  • Re: CryptAcquireContext fails with error 6 (The handle is invalid)
    ... I wanted to test your suggestion, unfortunately, I couldn't get ... When I trie the sample found in the documentation with my container: ... Phil. ... > You can check/change the permissions on a key container with the ...
    (microsoft.public.platformsdk.security)
  • Re: Sharing a RO std::list between 2 threads & Crash in _Orphan_ptr()
    ... But now you say you are calling methods on it that modify the list. ... It is, of course, illegal to modify a list while another thread is traversing it. ... So before starting the scan thread only one thread is accessing/modifying the std::list container. ... I call erase(), clearor removein my destructor when my shell extension is unloaded. ...
    (microsoft.public.vc.stl)
  • Re: PageFrame. Hiding Pages (VFP 6)
    ... > Thanks for the suggestion. ... > Unfortunately, all these are tricks / work arounds, ... When a label is clicked you ... >> add a container class with your controls on it. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Help with some logic, best way to update a container.
    ... Simon wrote: ... Anyway, my suggestion was not to copy the contents of the new container into the old one, but rather to simply set the old one equal to the new one. ... Visual C++ MVP ...
    (microsoft.public.vc.mfc)