Is it possible to use ball and socket notation in EA class diagram?
Asked Answered
M

3

5

Ball and socket notation is legal UML 2.0, but I cannot find a way to force EA to draw it on the diagram. It refuses to allow dependency between socket and the ball. Is there any way to make it happen, as in diagram below (little ms paint magic):

enter image description here

Also, a side question, can you make the ball or socket appear on the other side of the element?

Misleading answered 8/2, 2013 at 1:32 Comment(0)
B
5

There are two different ways of showing the ball and socket in EA.

With the one you've used, you've drawn connectors from your Consumer and Producer classes to the IProducer interface (a dependency and a realization, respectively). You've then switched on display of Dependent and Realized interfaces on your classes.

Doing it this way means the balls and sockets are fixed. You cannot select them (the class gets selected instead), you cannot move them wrt their parent classes, and they cannot be endpoints for connectors.

The other way is to use Expose Interface.

With this method, you don't draw any connectors from your classes to the interface. Instead, you use Expose Interface to create an embedded element, which has the interface as its classifier, in each class.

These exposed interfaces, being elements in their own right, behave the way you want them to: you can move them around the perimeter of their respective classes, and you can draw connectors between them.

In the example, note the absence of any connectors to the IProducer interface element.Sample use of Exposed Interfaces

In order to expose the interfaces, there are two ways to go about it. You can select Expose Interface in the diagram toolbox, but note that that's only available in the Component toolbox - not the Class toolbox. That's what I've done with the Producer in this example.

The other way is to right-click the class and select New Element -> Port. This creates a port, which you can give any name. Then you right-click the port and select New Element -> Provided / Required Interface.

Either way brings up the Exposed Interface dialog, which allows you to select the interface element that should be exposed by using the ellipsis button (...) and browsing the project tree for interfaces.

Using a port may seem a bit cumbersome but it is, strictly speaking, more correct UML. Note also that a single port can expose several interfaces, both provided and required, allowing you to group interfaces which form some sort of logical unit. It might be that you have several interfaces which form one service and so go together, but that the class provides and requires several services.

This (to me) makes more sense when you're discussing not individual classes but rather components, and I generally use realization/dependency whan I'm modelling classes, and ports and exposed interfaces when I'm modelling components.

Blob answered 11/2, 2013 at 22:5 Comment(2)
This seems to be best available in EA. But why must we have that dependency connector separating from /bridging the gap between the provision of the interface and the requirement of the interface? That is to say, I can create a single "assembly" connector on the diagram, but I cannot associate it with a specific Interface class, which makes it semantically meaningless even though it renders as one would expect... no way to do that?Capitally
In other words, I want diagrams that look like this: uml-diagrams.org/component-diagrams.html but are based on actual interface classes... how to?Capitally
D
2

In EA ball and socket connections can (only) be drawn between ports. Use the "assembly" connector type.

Desk answered 24/10, 2013 at 15:13 Comment(0)
H
1

It is right that ball and socket are legal UML 2.0 notation but they are not UML element, they depict element relations. So I guess that depending of the tool you use it will (or will not ) allow you to create a dependency between them. According to UML specification, a UML dependency should be create between, at least, two NamedElements.

Heise answered 8/2, 2013 at 8:47 Comment(2)
I still think that if EA supports UML 2.0 it should allow it. There is some more interesting info here: martinfowler.com/bliki/BallAndSocket.htmlMisleading
You are right it seems to be a legal representation as it is depicted in UML2.4.1 specification (Fig 8.14) but I tested my usual tools i.e. Modelio and Topcased but none of them support this but you are allowed to make appear the socket and the ball on all sides :-)Heise

© 2022 - 2024 — McMap. All rights reserved.