A colleague of mine did this UML component diagram to represent both the required/provided interfaces and the internal structure of the subsystems that compose the system we're working on:
(The subsystems are called "User Management", "Votes Management", "Post Management", etc...)
This diagram is for a System Design Document. This is therefore not an exact representation of the code objects.
The system follows a 3 layer approach:
- GUI represents the User Interface
- Control represents the application logic
- Repository and media access are required interface given by some other components that represent the Data Access.
Each component in the figure above has their own GUI and Control subcomponent. The repository is a monolithic component outside of this diagram so we're just ignoring it.
The question is: does it make sense that "GUI" and "Control" are instances, while "Gestione Utenti", "Gestione Voti", ecc... are not? My colleague states that this is useful to intend that "each GUI subcomponent is different from the GUI subcomponent elsewhere in the diagram". So there is another question: does it make sense that there are multiple "GUI" and "Control" subcomponents with the same name?
2 Answers 2
From an UML point of view, this makes sense:
:GUI
and:Control
represent parts inside a components. To simplify, parts are to components, what properties are to classes.Gestione Utenti
,Gestione Voti
etc.. are interchangeable components: the diagram represent how they depend on each-other via the offered and consumed interfaces, independently of their future instantiation.
These larger component may later be composed, for example by making them parts of a large component (you could for example have two Gestione Utenti
if the larger system would require this component to be redundant for being fail safe), or just by deploying them onto many nodes and ensure the right plumbing.
No, this is not possible.
Either you draw an object diagram with instance specifications, or a component diagramm, with the internal structure of the components. What you have here is a mix.
Text with underline means it is an instance specification. Showing it nested within a component doesn't mean anything. Connecting instance specifications with ports is not possible.
You can correct this, by simply removing the underline. Then they become parts of the component, as described in Christophe's answer.
Some minor hickups:
Parts are shown in a structure compartment. As such there should be a separation line between the name of the component and the compartment.
Connectors cannot connect to interface usages or realizations (lolli and socket). The notation is allowed for connectors connecting simple ports (ports with only one interface). So, you need to add ports to both ends of the connectors.
instanceName:Component
(underlined), where "Component" really plays the role of some kind of an abstract type (components are meant to be substitutable). But you may omit the typeinstanceName
or the name:ComponentType
if one or the other is not important for what the diagram is trying to communicate. 1/2:GUI
would, strictly speaking, indicate an unnamed instance that has the abstract type "GUI" (i.e., an instance of GUI component), but the concrete GUI realizations depicted may be different from each other. This would mean that all of the parent components work with their GUI subcomponent in the same way (see and call the same sorts of methods, use the same interface), but that the GUI components themselves differ in what they do internally and/or in how they are wired up with Control "behind the scenes". Your colleague may have intended something less formal, though. 2/2