How to differentiate static nested classes and inner classes in UML class diagram
posted 2 years ago
I wonder how it is possible to depict different types of Java nested classes in UML class diagram. Official Java documentation divides nested classes into two categories: static nested classes and inner classes. In the book UML for Java Programmers by Robert Cecil Martin (p. 37) it is proposed to draw inner classes with an association adorned with a cross cicle. Some topic were created on this site, devoted to this issue. And what I understood is that an alternative approach for inner classes is composition relationship (1).
Static nested classes are easier than inner classes, so I suppose that static nested classes can be represented as top-level classes but with the title "OuterClass$InnerClass" or "OuterClass.InnerClass".
I consider the placement of classes as an implementation detail and adding that much detail to the design doc doesn't help. However, if I have to, I would tend to use the dot notation.
Remember that the chief reason for drawing UML is to aid communication, so you should use a convention that your audience will understand. Most Java developers understand dot notations, and will get confused by adornments