0

I wonder if I can use few dependencies from 1 required interface of my system to few provided interfaces of another element.

Example: https://i.stack.imgur.com/lfoSr.png

Example of what I mean: My systems need access to few channels of distribution(all I can get) and Execution channel provides two interfaces: 1("phone call") and 2("sms").

Can I connect this like I did on diagram?

user3565261
  • 344
  • 1
  • 6
  • 19

1 Answers1

1

Required and provided interface should be of the compatible types when connected through dependency, that's the oly way they can communicate.

This means that your situation is possible only is IChannel1 and IChannel2 are derived from the IChannelAccess.

UPDATE (after comment)

Interface is a kind of classifier and can therefore be inherited from another one. You can show this situation on a separate diagram.

enter image description here

As your component System expects IChannelAccess, it can safely access any interface derived from it. In this case he cannot call op11(), op12() or op2(), but only op().

Aleks
  • 5,674
  • 1
  • 28
  • 54
  • Should I paint that IChannel1 and IChannel2 are derived from the IChannelAccess? How? – user3565261 May 14 '14 at 14:43
  • Ok, I get it. Just one more, is this diagram which shows interface's inheritance necessary or no? – user3565261 May 14 '14 at 14:54
  • In theory, no diagram is mandatory in UML. :) It is only mandatory that the elements and connections exist in the repository. Diagrams are there only to visually help humans to understand the idea. So, if you can somehow connect the interfaces and define the inheritance, it would be enough. It is however recommended, for clarity sake, that it is also visualised. Of course, you can be pragmatic and put a note on your initial diagram, with the explanation about this inheritance. Just be sure now th show the inheritance on the same component diagram. Although legal, it would be confusing. – Aleks May 14 '14 at 14:59