I have an UML diagram on which I want to mark some classes as singletons (because they are). How do I do that? Do I invent a new stereotype or do I just add a comment or are there some existing means to do that?
相关问题
- suppress a singleton constructor in java with powe
- System sequence diagram - Can system request input
- Does Visual Studio 2010 Professional support UML m
- Can a [GoF]-ConcreteSubject override the notify me
- How to represent enumeration classes with methods
相关文章
- How to fix a purported lack of an “explicit instan
- Auto-property initializer Singleton implementation
- Dagger 2 - how to create/provide a EagerSingleton
- Code Iris plugin on Android Studio
- How to test a Singleton class?
- Singleton with finalizer but not IDisposable
- Objective-C: Use singleton vs. use class as an obj
-
Is Lazy
a good solution for a thread safe lazy
"What will most clearly represent the concept to your reader."
There is a reasonable example of the basic appearance over on Wikipedia. It shows a private constructor and a public
getInstance()
method that returns an object of typeSingleton
. I'd also find a stereotype to be a perfectly reasonable way to make it explicit without requiring your reader to parse the details of the class object.Craig Larman's "Applying UML and Patterns" book (3rd edition) gives the following notation for a sequence diagram:
Note that it implies that before calling
doA
the:Register
object manages to get access to the singleton via the standard way, e.g.,getInstance()
. This makes the diagram more agile.For a class diagram: