Question

I'm making a class diagram for a project.

How can I describe vectors, lists, files or unsigned types?

I would like to make a detailed diagram so I need to specify the types of the members and the input/output parameters of the methods.

Thank you all!

Was it helpful?

Solution

For more detailed description of the inner structure of the class you need a Composite Structure Diagram. There you can describe your methods as "ports". And your fields as attributes. You can show there really almost everything!

enter image description here

For detailed description of the specific instances of the class and their mutual behaviour you need an Object diagram.

At the links applied you can see a bit how to make them. But take it as a start only.

The class diagram is too common to describe the inner structure of the class. It is tooled for the description of the inter-classes relations. So, you can put your information into the model of the class, but some of it won't be seen on the diagram. But I would advise you to start from the class diagram and make it as detailed as it can show and only later go to more detailed diagrams. Maybe you won't need them after all.

Edit:

You can make a port on the border of your class, name it fileName and connect it to io interface you use. (Composite Structure Diagram only)

As for vector/list, it is easier, and could be done in a Class Diagram. If you want to show that some attribute is a vector or list, simply write: someAttr:List or put a List block on the diagram, draw association to it and name its end "someAttribute". You could do it with File, too, but there you should draw more, I think, to show the used io interface.

For showing attributes in class diagram also look here.

OTHER TIPS

You should use an uml class diagramm. [Link][1]

In a class diagramm you can relate class members with types, functions with parameters and signatures.

[1] http://www.holub.com/goodies/uml/

(Somebody can format this? IMHO SO app can not handle links..)

Your question is not clear to me. There are two variants:

  • you need to define what type of collections (vector, list etc) in specific programming language should be used to implement multicity element ([N], [0..N] ordered or unordered, unique or nonuniqu) It is not possible to explicitly define in UML. You can only declare, what type it is. For example in note or constraint
  • You need simply define types of collection Use ordinary class or DataType element to define

Standard syntax for member (attribute, port etc.) is following: +name:Type[Multiplicity]{contraints} The same syntax is used for parameters (all types) of operation (methods in programming language)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top