In Rhapsody, is it possible to draw a diagram like the following?
I can add ports and interfaces to classes, but Rhapsody doesn't seem to support the port concept for components.
Yes it is possible, but for Classes. Usage is possible in normal Class or Object Diagrams.
see:
IBM Manual "Managing Ports"
A "Component" in Rhapsody is different to an UML Component,
it represents a Executable or Library and therefore there is no special Component Diagram like your Example.
Related
I defined my software system using EA. I stayed mainly at the high level so far. The software interfaces between my components are represented as Structural Elements "Provided Interface" (the little purple bullets) and "Required Interface" (the little sockets).
Now, I would like to go a little bit further into the details, and define the API corresponding to each of these Provided Interfaces, ideally as a class diagram. It would be perfect if I were able to create a nested composite structure diagram for each of these Provided Interfaces, like for software components for example. But it seems that EA does not enable that.
What I do is that I create an Interface nested in my software component, then I link the Required Interface (the purple bullet) to my Interface (purple square) with a Dependency link. Then I can create a nested composite structure diagram in my Interface. But I doubt this is the optimal method.
Can someone tell me what is the "EA-approved" way of defining Required Interfaces ?
Thank you :)
You can directly select the Interface in the ProvidedInterface or RequiredInterface without needing to explicitly create a Realize or Dependency connector to the target interface.
You can do this as shown in the figures below:
One advantage of this is that you do not have to show the actual target interface on the same diagram as the components while still being able to navigate to them. This becomes handy when you have components that provide or require many interfaces (and you do not want to clutter your diagram). With this approach you can use the Find | Locate Classifier in Project Browser context menu and directly jump to the composite diagram.
Given I have two Java classes Foo and Bar, and Bar has a getFoos() method that returns a List<Foo>.
In Java, all classes extend the parent class Object. List is an interface that extends the interface Collection, which in turn extends Iterable. All of these are provided by the Java core and do not require programming. However, they have methods that can be used or overridden. Interface hierarchy may be necessary to be known, for example a method that takes an Iterable<Foo> will accept a List<Foo>.
When drawing a class diagram from these in UML, how do I do with the well-known classes (Object) and interfaces (List, and its super interfaces Collection and Iterable)? Do I have to draw them into the diagram as well? Can I skip them completely? Is there a special symbol for these (a cloud would feel great to me)? What about not-that-common classes that should be qualified (i.e. if it would be an java.awt.List and not a java.util.List)?
UML is not linked to any language, there is nothing in the norm about JDK classes.
A lot's of tools provide a profile with JDK classes already defined.
So you have to look in your tool if you get menu like "import profile" and look which profiles are available.
Two others solutions could be:
Define in your models the minimum set of JDK classes you need
Trying to write a java program to generate the XMI of JDK classes. Theoretically not so complicated, but the JDK includes JNI classes on which the introspection can not be used.
Your choice for how to deal with well-known classes will depend on how you plan on using your UML class diagram.
If the main purpose for creating a UML diagram is to communicate design details to a team, I would opt for not including well-know classes (not just from the JDK but also classes that are well-known in your context). The reason being that you want your message to be focused. Adding these well-known classes can quickly clutter your diagram while adding nothing to your message. For the same reason I typically exclude getters/setters and any information that is not essential to understanding the design. For classes that are not well-known I will include them because they communicate information that is not easily accessible to the team.
If your class diagram is going to be used in MDA, i.e. it will be used to generate a system implementation, then you have to include well-known classes.
When part of my solution is to use already built classes (for instance,Java's API classes) to promote reuse's principle, how do i represent these in uml diagrams like class, sequence and activity diagrams? Is it more common to represent them on diagrams or to ommit them?
Of course you have different options. But usually I create component elements representing libs (and APIs). Those components can either hold the classes they implement directly or you can associate them (e.g. via a <<realize>> relation). It's a good idea to attach lollipops and sockets to the component to show the implemented and required interfaces. The latter can also be used in sequence diagrams.
I would like to make a component diagram for a multiple robot coordination system.
I would like to show on the component diagram that the sub-component "Perception" of each "Robot" component communicates through an interface with each other. Indeed, the sensors of all robots are used in order to estimate the position/velocity of each robot, it is a cooperative sensing.
How can I do that ? Should I have an interface which would be both provided and required by the component "Robot" ?
Thanks.
For this type of system you are in position to use full power of UML and make really effective documentation. You will most likely need some (or all) of the following diagrams:
Component diagram - to show the "big picture" and the main parts of your system ant their interfaces and dependencies. Components are "black boxes" here and will be detailed in the following diagram
Composite structure - are perfect to open up the components and show their internal structure. You can take "black boxes" and their interfaces as kind of input to this work. Each component (except the external ones) should be modelled internally. This kind of diagrams lets you use the whole-part paradigm to model internal structure as a network of interconnected elements. Previously detected interfaces will be used here to show how they are actually implemented.
Class diagrams. If you need to further specify the elements of internal structure (their attributes, methods, associations, etc), this is the diagram to draw.
State machines. In embedded real-time systems, lots of classes are active and have states. Identify those classes (or even components) and use state diagrams to show their internal logic.
Sequences and interactions. These diagrams will help you to specify how different elements of your system work together to implement different scenarios.
Deployment diagram. As robot is a piece of hardware and these components run on it (or them, if there are more than one hardware node) you might want to show how the components are distributed over the hardware structure.
You could also have a look on timing diagram, relativelly new one, designed especially for real-time systems. It might come on handy if you need to express time restrictions, durations, etc.
If you are new to UML, I would recommend to start with components and deployment. They are relativelly easy to learn. As you feel understanding and need to express your ideas further, dive in the composite structure and states. And finally classes.
Have fun!
EXAMPLE
This is how I understand your model and its elements. This extends my comments.
Explanations are in comments and in the diagram notes.
A component diagram:
A component instances' diagram:
Note that the first diagram should be extended with the "connectivity rules" that define all valid connectivity possibilities. Is there only one CentralManager? Must each Robot be connected to CentralManager? Can a Robot talk to itself? And so on...
These and other questions should be modelled separatelly. On class diagrams benavior diagams, according to concrete details.
I have been going over some books and some articles to refresh my memory on class diagrams with UML.
I have stumbled upon something i have not known before and that's the lollipops and sockets relations (where lollipops are provided interfaces and sockets are required interfaces).
But I cant seem to wrap my head around when and why to use them.
From what I remember about interfaces and and class diagrams, the use of interfaces is done by A realization arrow (I create some interface and some other class will realize it).
So when will i want to use a lollipop association?.
The sockets show a uses dependency between some client classifier and the provider of the interface. This indicates that the client classifier uses any implementation of the interface.
UML lollipop (ball and socket)
It is a part of UML Component Diagrams
Socket - requires interface(consumer)
Ball - provides interface(producer)
You can use the "lollipops" to represent an interface of a component - typically in a component diagram. They are not used to attach them to all/any classifiers.
The Lolipop notation is used in the componenet digram.
As Far as i know, the lolipop can mean input and output
Where the socket (Half-Circle) reqiures input and the ball provides the input
Reference: OMG UML 2.5.1 specification, Retrived from: https://www.omg.org/spec/UML/2.5.1/PDF