Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I write comments in UML Class diagram?

Tags:

uml

What symbol should I use ?

like image 979
Keating Avatar asked Oct 23 '10 08:10

Keating


People also ask

How do you comment on a UML diagram?

A Comment is shown as a rectangle with the upper right corner bent (this is also known as a “note symbol”). The rectangle contains the body of the Comment. The connection to each annotated element is shown by a separate dashed line.

What is used to give remarks in UML?

Annotational things can be defined as a mechanism to capture remarks, descriptions, and comments of UML model elements. Note - It is the only one Annotational thing available. A note is used to render comments, constraints, etc. of an UML element.

What does a +/- symbol mean in an UML diagram?

The plus signs indicate the means you must use to interact with the properties and methods of the class. In other words, the Public items of a class define the interface for the class object and how you must interact with it.


3 Answers

Below is an extract from the Unified Modeling Language specification. The complete specification is available at http://www.omg.org/spec/UML/2.3.

9.5.1 Comment

A comment is a textual annotation that can be attached to a set of elements.

Description

A comment gives the ability to attach various remarks to elements. A comment carries no semantic force, but may contain information that is useful to a modeler. A comment may be owned by any element.

Notation

A Comment is shown as a rectangle with the upper right corner bent (this is also known as a “note symbol”). The rectangle contains the body of the Comment. The connection to each annotated element is shown by a separate dashed line.

Presentation Options

The dashed line connecting the note to the annotated element(s) may be suppressed if it is clear from the context, or not important in this diagram.

alt text

like image 83
WileCau Avatar answered Oct 03 '22 22:10

WileCau


Use --.

...if you are looking to comment the UML source, rather than render a comment in a diagram. As mentioned by WileCau above the reference for this is here: http://www.omg.org/spec/OCL/2.2 and is called an Object Constraint Language comment."

-- This section is about [etc.]
[My Thing] -> (Result)

This doesn't work in all UML renderers though - When I tried in PlantUML for example, it considered this a syntax error.

like image 24
hiljusti Avatar answered Oct 03 '22 21:10

hiljusti


If you looking to add a comment in the UML source, depending on the renderer you can use -- or ' for a single line comment.

For PlantUML comments:

@startuml
' This is a comment on a single line
Bob->Alice : hello
/' You quote alors use slash-and-quote
to split your comments on several
lines '/
@enduml
like image 35
Alexander Higgins Avatar answered Oct 03 '22 22:10

Alexander Higgins