UML component diagram of dining philosopher problem in client server architecture - components

I have to describe the structure of the system of dining philosophers using a uml component diagram in a client server architectural style.
I did this:
but i have many doubts on its correctness:
is it correct to show every philosopher or should i draw only a generic one? and what about the forks?
should the forks be included in the table/server component?

There are two things you might be trying to show.
Components in general: Philosopher, Fork, Dining Room.
Component Instances. Philosopher 0-4, Fork 0-4 and the Dining Room.
The general component diagram doesn't show instances, but shows interfaces, and might include some constraints on the relationships to show that there are 5 instances exactly.
The instance diagram would look similar to what you've shown with 5 instances of the Philosopher component, and 5 instances of the Fork component, and 1 instance of the Dining Room component.
http://argouml-stats.tigris.org/documentation/manual-0.26/ch23s05.html

Related

How to represent communication with other object of the same class in UML sequence diagram?

I have a question regarding UML sequence diagram. I have actor system, where I have many objects (actors) of the same class communicating with each other. The number of actors depends on the problem, but it is too large to draw them all. I have also other parts of a system (other actors) and now I'm drawing UML sequence diagram showing communication between actors with a time perspective. My question is how to show communication between actors of the same class?
I have found something like this:
But it looks like calling method within object and not other object of the same class (or maybe I'm wrong?). I also thought about showing two objects on diagram, but then I would have to double number of arrows, becouse each communication from other part of system would have to be connected with both. Do you know some third solution how to show this properly?
You could divide your scenario over multiple sequence diagrams.
One diagram has multiple lifelines for the same class, for example i1 : MyClass and i2 : MyClass and shows the interaction between the instances. If another part of the system calls method bar of all instances, then you could draw those calls, but what happens inside that method is modeled in a different sequence diagram.
For example, here is the first diagram:
and here is the second diagram:

Component diagram dependency vs assembly

I'm having a hard time understanding the difference between dependency and assembly(ball and socket) in UML component diagram.
I googled a lot and only found this relative question : uml component diagram difference between assembly and interfaces with dependency
But I don't really understand the answer to that question, I specifically want to ask :
What does he mean by "definition level" and "instance level" ? I understand that there is only one diagram, are there two ?
Whether there are two or not, can you give me a valid example which has "dependency" and "assembly" and explain why the first was "dependency" and the second was "assembly" ?
Note that I'm not asking about any particular image I found on web, I'm asking here in general, Also I want Uml 2 :) .
I prefer examples because I don't understand all the words in UML, also I prefer these examples to be somewhat realistic , that is not "A and B" but for example "Order and Person".
My goal of the question is to draw the Component diagram for our graduation project that we'll give to the professor :) .
A component is a piece of software. This is the class level (definition level). This piece of software may be installed on multiple machines, or maybe multiple instances may be running on the same machine. This is the instance level. If, in your case, each component is instantiated only once, then you only need one diagram, showing the instances. Otherwise, it would be good to have one diagram show the class level and one diagram show the instance level.
For example, there is a component called EmployeeProvider, which provides services to access an employee database. Suppose there is an instance running in the USA and one instance running in Europe. Suppose also that there is a report generator component, which only has one instance, which reads information from both employee databases. Below you can see two diagrams, one showing the class level (top) and one showing the instance level (bottom).

Component diagram for a cooperative multi-robot system

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.

Component diagram before class diagram?

I would like to know which diagram from those two should be created first when designing large IT system.
In every article I read about UML, the component diagram is mentioned as almost last.
I think that, when designing a larger system is better to divide it to smaller parts/modules on the component diagram and then for every component create a detailed class diagram. Is that correct?
How it look in practice from your experiences?
Do you know of any article/tutorial that shows from beginning to end, the design of system using UML?
There is no mandatory order for UML diagram design - in fact, you will often find yourself creating several simple diagrams of different types, and refining them later. The process is generally iterative but doesn't have a follow a particular order.
That being said, some UML diagrams provide a more abstract view than others, and it may sometimes make sense to start with the most abstract views and work your way down to the most specialised ones. Use case diagrams typically come early, while object diagrams or state diagrams often come later in the design process, once the original, abstract solution has been refined.
You will also want to take a look at consistency between your diagrams: indeed, with several views you will introduce redundant elements, and it is important to make sure that they do not contradict each other. For example, if you have a sequence diagram and a class diagram, any call message in the former should correspond to an operation in the latter. See Alexander Egyed et al's work for automated consistency management and correction in UML models.

UML binary association aggregatee has access to aggregator

Firstly, I'd like to thank those who answered my previous question ages ago. Currently I'm engaging more in the design phase UMLs, as this is my first medium scale deployment I'm entrusted with.
This is extremely simple, but it bugs me so.
If (Component) owns (Manager of Component), and (Manager of Component) has a reference to (Component) through which it manages it; how do you fully describe the relationship?
I know it is aggregative, but how do you describe (Manager of Component) possessing a reference/pointer to the (Component) that physically owns the (Manager of Component) ?
Example: Lidar owns a LidarManager
On first sight, it seems a little strange for Component to own Manager of Component. Would expect it the other way around. Anyway, assuming you need it this way...
...it's just a plain old aggregation relationship, navigable in both directions, with diamond at Component end.
hth.

Resources