Re: Newbie Modelling Interface Question
From: AdamJoe1 (adamjoe1_at_yahoo.co.uk)
Date: 10/27/03
- Next message: Doc O'Leary: "Re: Visitor, dynamic_cast or ..."
- Previous message: Alfredo Novoa: "Re: OO's best feature survey results"
- In reply to: H. S. Lahman: "Re: Newbie Modelling Interface Question"
- Next in thread: H. S. Lahman: "Re: Newbie Modelling Interface Question"
- Reply: H. S. Lahman: "Re: Newbie Modelling Interface Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 27 Oct 2003 22:40:19 -0000
Responding to H. S. Lahman,
Thanks for the reply.
> > One option I've considered is to have two interfaces. The first is
IMemory,
> > which Rom derives from and provides one pure virtual function, CrcCheck.
The
> > second is IRWMemory which Fram derives from and provides pv functions
Read,
> > Write, and CrcCheck. The client then has a pointer to each interface.
> >
> > Another option is to have two interfaces again but one derives from the
> > other. IRWMemory would derive from IMemory and inherit its CrcCheck
> > operation. Rom would derive from IMemory and Fram from IRWMemory. Again
the
> > client would have a pointer to each interface.
>
> Both these approaches expose the subsystem implementation, at least
> indirectly, to the clients. That should be avoided. If you need
> different interfaces for different client contexts, then subclass the
> Facade wrapper, not the individual class interfaces.
I'm not sure I understand this. How do these approaches expose the subsystem
implementation if the client only sees the interface? I thought the whole
point of an interface was to prevent exposing the implementation. What is it
I'm not getting?
My approach so far has not included the use of Facades. I guess this is
because most of my subsystems have relatively simple interfaces and I
haven't felt the need to use them. The classes that derive from these
interfaces are fairly simple too. Perhaps that was wrong. Are you saying
that I should use a Facade regardless of how simple the interface and its
implementation are? Or could it be that now with a more complex interface a
Facade is more appropriate?
[snip]
- Next message: Doc O'Leary: "Re: Visitor, dynamic_cast or ..."
- Previous message: Alfredo Novoa: "Re: OO's best feature survey results"
- In reply to: H. S. Lahman: "Re: Newbie Modelling Interface Question"
- Next in thread: H. S. Lahman: "Re: Newbie Modelling Interface Question"
- Reply: H. S. Lahman: "Re: Newbie Modelling Interface Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|