one interface implemented by two seperate "modules"

R

Raffael Vogler

hello,
imagine two different modules A and B.
a module is just a bunch of classes and interfaces.
i want to use either A or B through the same
interface from another seperate module.
the problem is that this interface belongs to A and B
and has to be distributet with A and B.
But it also has to be known by the calling module.
is there a direct solution to this problem,
as there would have to be one interface used
by all those three modules.
or do I have to use some pattern invoking
methods dynamically?
but how do I make sure that thos modules are implementing
those methods?
Best regards, Raffael Vogler
 
P

Pat Ryan

Assuming you can modify A, you could take the interface out of A and put the
it into a third module C.
If C contains only interface definitions and constants which are common to
the implementation modules A and B, then this is a tidy solution to the
problem, since you get a clean separtion of interface and implementation.
Then C must be distributed with A and B.
 
R

Raffael Vogler

Then C must be distributed with A and B.

Hi, well thanks for your reply.
The problem I see coming with this solution is that if
I generally want to distribute A or B I always have to
distribute two modules and I have to make clear that
all modules implementing this C-mod-interfaces are
derived from the very same C-Mod. That is also problematic.

I'd be interested in a solution that is more general.

Perhaps the following idea could do the job, but I am not sure:
I check through reflection weather the module is
derived from the communication-interfaces needed and than I
communicate with this module by invoking its methods
dynamically.

Best regards, Raffael Vogler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top