Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Representing class variables and methods in UML

Many programming languages allow you to define class/instance methods, and the same for attributes. E.g. Python, Smalltalk. I have the concepts. E.g. for instance variables, every object has it’s own copy of the variables. Class variables only have one copy of the variables shared with all instances of the class.

My doubt is: how do I represent class methods and class attributes in UML? I was thinking in represent it through static, as in C++, Java, and C#, but is it ok? "static" and "class" are the same in UML?

Thanks!

like image 924
Jhon Doe Avatar asked Feb 09 '23 21:02

Jhon Doe


1 Answers

Static attributes/operations1 need to be underlined. See also Class diagrams

enter image description here

1The term method is used for behavior (the howto) in UML. An operation is the term used in UML for a BehaviorialFeature that can be called on an interface (which is what you find in the compartment underneath the attributes).

like image 141
qwerty_so Avatar answered Mar 14 '23 23:03

qwerty_so