wood burning stoves*
The moose likes OO, Patterns, UML and Refactoring and the fly likes How to differentiate static nested classes and inner classes in UML class diagram Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "How to differentiate static nested classes and inner classes in UML class diagram" Watch "How to differentiate static nested classes and inner classes in UML class diagram" New topic
Author

How to differentiate static nested classes and inner classes in UML class diagram

Sergey Zhylinsky
Greenhorn

Joined: Nov 15, 2013
Posts: 26
Hello,

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".
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2383
    
  28

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to differentiate static nested classes and inner classes in UML class diagram