Re: Newbie Modelling Interface Question

From: AdamJoe1 (adamjoe1_at_yahoo.co.uk)
Date: 10/27/03


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]



Relevant Pages

  • Re: Remoting Objects: style question
    ... Most likely, if you use abstract objects, the first cast will be done in the ... class to which it is cast, regardless of whether it derives from that class. ... acobj will be non-null even though the remoted object is ... > the object actually implements the interface). ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Newbie Modelling Interface Question
    ... > Hardware Interface subsystem. ... > two classes, amongst others, Fram and Rom, which implement the following ... > CrcCheck ... > second is IRWMemory which Fram derives from and provides pv functions Read, ...
    (comp.object)
  • RE: Implementing custom interfaces
    ... When you added a web reference to your project, ... that derives from SoapHttpClientProtocol. ... implemented in this file will not have derived from your interface even if ... I have created a web service which implements a custom interface. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • RE: Implementing custom interfaces
    ... that derives from SoapHttpClientProtocol. ... implemented in this file will not have derived from your interface even if ... I have created a web service which implements a custom interface. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Newbie Modelling Interface Question
    ... Hardware Interface subsystem. ... two classes, amongst others, Fram and Rom, which implement the following ... second is IRWMemory which Fram derives from and provides pv functions Read, ...
    (comp.object)