Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the counterpart of the pseudocode annotation in UML class diagram

In the GOF23 book [Design Patterns Elements of Reusable Object-Oriented Software], there is pseudocode annotation in the class diagrams. It is a very helpful tool.

<img src="http://www.cs.unc.edu/~stotts/GOF/hires/Pictures/class088.gif" alt="annotation" />

But I can not find the counterpart in UML class diagrams, so would like to know if there is the counterpart of pseudocode annotation in UML class diagrams

like image 597
Rui Avatar asked Feb 04 '26 06:02

Rui


1 Answers

One can claim that the above is illegal UML (since the note connector is wrong). However, you can just attach the note to the class and augment the note (to show the operation which is meant).

Enterprise Architect shows behavior like this:

enter image description here

(the blabla is the behavior).

Note: I have to check with the UML specs whether this is legal UML. Though EA is quite compliant, it has a few flaws too.

Edit: I have checked the UML 2.5 specs. Pseudo code is not really mentioned and there's no place where they tell how to show it. Only with Actions/States they talk about showing behavior. E.g. on p. 329:

the optional <behavior-expression> is an expression specifying the effect Behavior written in some vendor-specific or standard textual surface language (see sub clause 16.1)

So it's up to you to "invent" your notation, document it in your domain, and use it appropriately.

like image 93
qwerty_so Avatar answered Feb 06 '26 00:02

qwerty_so



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!