I'm currently having a hard time with creating a component diagram that should represent a certain type of component/interface dependency and hope that you can give me some hints. As background, I only started learning UML and software engineering some weeks ago, so I assume that I just have a thinking barrier and/or am doing things more complicated than necessary.
Assume I have a "virtual" component Services. In this component I want to collect and model all services my system may offer. Next, I have a component Admin which (at this level) may use (and hence depend on) any of the services provided by Services. Last but not least there is a component User which may only use one specific service that is already known. Would this be properly represented by the attached component diagram? If not, how would it be properly represented? Would you just indicate that User also depends on the Services port and model the conrete interface dependency in a different diagram? Is a dependency from Admin to the Services port the proper way of showing the dependency to the "virtual" Services interface or would it be better to just show a dependency to the Services component?
Thank you for your help & patience
Daniel
1 Answer 1
First of all, your diagram looks fine and documents quite well your architecture. However, if taking UML by the letter, there are some aspects to clarify.
What is the nature of your "virtual" component ?
Your diagram says that Service
is a subsystem/component that is itself composed of UserService
, Service1
, Service2
. This would be consistent with the term "virtual", which suggest that Service
is a mental grouping of the components into something larger.
However, the term "virtual" is ambiguous. Is it possible that Service
could be a real component that offers virtual services and that acts as a facade or API gateway to the external world ? In this case, it should be represented as a separate component.
Ambiguous links
On the internal side, the delegate connectors suggest that the Service
port is a complex port that provides 3 different interfaces.
On the external side however, the single UserService
lollipop says that the port is a simple port that provides only that service. This is at least what the UML 2.5 standard says in Fig.11.3 Parts and roles with ports and Fig.11.4 Alternative notations for connecting parts and roles
The following solutions could remove this contradiction:
- Remove the ambiguous
UserService
lollipop : then you see thatUser
component depends on the services (which offers several interfaces), but theUSerService
socket of theUser
shows that it only requires that services. From there the reader can deduce that it may not use the other interfaces as it doesn't know them. - Use a different
Service
port for theUserService
: User would then be connected only to that port, whereasAdmin
would be connected to both ports. - Use an artistic disambiguation, by adding to your current diagram a couple of unnamed lollipops to the
Service
port, in order to make clear that it's a complex port, even if User uses only one specific of it.