So I did some research about how to denote static methods and classes in UML. I found on these two pages that static methods should be denoted by underlining them, but what is the correct way to display a class as being static?
5 Answers
Marking a class as static is a very low level information, which we don't put in UML diagrams usually. UML 1.0 as well as 2.0 gives some flexibility to designer/developer to modify the convention if it suits to your audience/team.
You can put a note to that class, or use something like <<static>>
( as used for interface).

- 10,309
- 6
- 39
- 55
I would just use a stereotype <<static>>

- 18,922
- 9
- 50
- 67
-
Yes, that's what I've been doing, but I was wondering whether there was some kind of standardized way of denoting... – Robin Kanters Dec 03 '12 at 08:53
IMO static classes (like in C#) should not even be used in OO Design. A static class cannot be instantiated and thus is actually not a class regarding UML semantics.
You could mark the class as "leaf" (no subclasses) and add a constraint which does not allow non-static members. This would resemble the meaning of the C# static keyword.

- 13,285
- 2
- 32
- 49
-
The official documentation confirms, it cannot be instantiated: https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-classes-and-static-class-members – Christian Aug 16 '17 at 07:26
-
In C# sealed on the other hand means, that another class cannot inherit from the sealed class. This would be equivalent to a "final specification" class in UML. – Christian Aug 16 '17 at 07:28
The <<utility>>
stereotype is what you are looking for.
It's defined in UML Standard Profile (as per UML 2.5 documentation) as:
A class that has no instances, but rather denotes a named collection of attributes and operations, all of which are static.

- 3,072
- 1
- 24
- 37
Static classes are usually denoted by underlining the class name. Its a convention to underline static features, so it makes sense that underlining the class name would denote a static class.

- 1,503
- 21
- 26
-
1Yes but... an underlined name denotes a class instance (as explained in "Learning UML 2.0", page 102) – Denys Vitali Jun 13 '18 at 13:49
-
Underlining is for static *features* not classes. See chap. 9.4.4 of UML 2.5 – qwerty_so Sep 15 '20 at 09:07