2

I'm not sure how to draw a UML diagram for two classes match this natural language description?

The Server class has one attribute named 'disk' of type Disk.

Which one of these two diagrams is the right one?

composition UML diagramm
attributte UML diagramm

I think the first one describes well the relationship between the classes, but the second one is a better description of the single class.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
IgnazioC
  • 4,554
  • 4
  • 33
  • 46

3 Answers3

1

enter image description here

  • If 'disk' is an attribute, it have to has a 'dot' on the association's end.
  • If there is NO navigability from Disk to Server, the association should have a cross on the Server end.
  • If there IS navigability in both sides (attribute IS a navigability), there is NO arrows on both sides (both are omitted).
  • IBM SW is not in accordance to UML standards. Beware!

Go to http://omg.org and read the new standard 2.5. It is NOT accepted, but it is much more easy than old ones and is different in the documentation organization and understandability only.

Gangnus
  • 24,044
  • 16
  • 90
  • 149
  • Thanks for your answer. Datatype suggested from Meetu Singh is about primitive values,not class. Can i ask you which software are you using? I read about argouml but it very ugly and a bit unstable. thanks a lot. – IgnazioC Feb 03 '14 at 20:04
  • @IgnazioC look also here: http://stackoverflow.com/a/21478862/715269, I have done a more elaborated analysis of associations in class diagrams. – Gangnus Feb 03 '14 at 20:34
  • As for VP UML - yes, it is not so pretty as Visio, but no modelling tools are. Diagramming tools, as Visio are more pretty, but less powerful. VP is good in that sense, that when you find a bug, they are correcting it. Yes, it has problems, but less than Sparx EA or IBM ratio. Papyrus can everything and is free, but it is much less stable, even more problems, too. But there you can repair everything yourself... But I simply have no time for it. So, after a month of trying I'll subscribe for UP UML (subscribe because I am not sure which level I need). – Gangnus Feb 03 '14 at 20:41
  • @IgnazioC I have rather decided to buy EA from Sparx - VP UML is terrible for freehand diagrams, and I use them often. – Gangnus Feb 05 '14 at 13:54
0

Create a data type for disk.

Please go through the below link:

http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r0m0/index.jsp?topic=/com.ibm.xtools.modeler.doc/topics/cclassd.html

Meetu Singh
  • 241
  • 2
  • 5
0

Both diagrams could express what you need.But first one better correspond to reality. Just change composition to server side. Server is composed of Disk. It is possible to set multiplicity on disk side to zero or more and zero to one on server side. It express situation when server does not contain disk and disk can be part of other device (example. video recorder).

Vladimir
  • 2,066
  • 15
  • 13