2

I have tried to make component diagram by using plantuml.

I want to represent tcp connection between two modules, so I am learning how to make component diagrams.

In the midst of studying, I found a link that I don't know what it means.

enter image description here

(from PlantUML website)

Is the link type shown in the link above suitable for expressing tcp connection? If not, what type of link should be used to express the tcp connection between the two modules?

Thanks for reading my question!

Christophe
  • 68,716
  • 7
  • 72
  • 138
didnlie23
  • 101
  • 7

3 Answers3

3

Only the middle two are valid UML connectors. They symbolize a socket-lollipop connection. You use them in a draft (mainly). In a more detailed view you would replace/adorn them with ports and interfaces connected with information flows. But at your stage these connectors are fine. The lollipop side represents a provided and the socket a required interface.

Note that the clouds are stereotyped elements. So their meaning depends on a profile where they are defined. You should use general component elements instead: enter image description here

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
2

The focus of this diagram is about how components can be combined. If you want to express that one module offers an interface that corresponds to some specifications (for example a service component that exposed an interface using tcp) and the other module requires this interface (e.g. a client component that needs to consume the server interface over tcp), then this socket/lollipop notation is what you need:

enter image description here

But if you want to explain how component instances are deployed on a physical/virtual infrastructure, and how component instances are connected, you'd better go for a deployment diagram. This allows to show components on their devices (e.g. server/cloud, containers, end-user device, ...), and how the devices/execution environments are "physically" connected (e.g. via tcp/ip link):

enter image description here

Christophe
  • 68,716
  • 7
  • 72
  • 138
1

Actually, contrary to popular believe this diagram doesn't show any valid UML syntax.

Of course, ball and socket notation does exist. The ball defines that the component realizes the shown interface and the socket that it uses the interface. However, joining the ball to the socket has no defined meaning.

That means they have simply been placed near to each other, so that they look as if they are one symbol. It is really unfortunate, that some modeling tools will actually show a symbol like this (please note that plantUML does not qualify as a modeling tool).

Now, some people will tell you that it is a shorthand for a dependency between the socket and the ball. This is not supported by the specification, but let's accept this notion for a moment. What does it mean? Since a ball is a realization and a socket is a usage, the dependency is between the usage and the realization! The specification defines about this:

Creating a wiring Dependency between a Usage and a matching InterfaceRealization, or between compatible simple Ports, means that there may be some additional information, such as performance requirements, transport bindings, or other policies that determine that the Interface is realized in a way that is suitable for consumption by the depending Component.

I for my part have never defined "performance requirements or transport bindings" for interface realizations. But if you have, go ahead and use dependencies.

Now, there is one place, where this symbol is allowed: In a composite structure diagram between simple ports. Please note, that this is not an interface realization or usage but a connector with a funny shape.

If the parts have simple Ports (Ports with a single required or provided Interface), then ball-and-socket notation may be used to represent assembly Connectors between those Ports. Ball-and-socket notation may not be used to connect complex (i.e., non-simple) Ports or parts without Ports.

Axel Scheithauer
  • 2,758
  • 5
  • 13
  • Well, no. This is an assembly connector. See p. 187 of UML 2.5. – qwerty_so Mar 10 '23 at 21:12
  • Yes, it is an assembly connector. As such it cannot be drawn between components, only between parts or ports on parts. And only for simple ports the ball and socket notation is an option. I think this only confuses the readers and therefore discourage its usage. – Axel Scheithauer Mar 12 '23 at 09:44
  • Hmm. I guess you are right again. Though, the clouds could be stereotyped parts as well. I mean the diagram is fucked up anyway. I would guess that more than half of UML diagrams out there are syntactically incorrect in one or another way.Not an excuse, though. – qwerty_so Mar 12 '23 at 10:04