You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where does the <<role/purpose>> come in for the Singletons? Is it in the naming of the singleton?
I realize that Singletons have <<Singleton>> UML Notation above the class name, I just wanted to clarify that according to the textbook it is optional. And also Facade Classes would not require such an UML Notation?
The text was updated successfully, but these errors were encountered:
Where does the <<role/purpose>> come in for the Singletons? Is it in the naming of the singleton?
It's just a way to specify that the class is a singleton. There isn't a specific programming language construct for it like in the case for <<interface>> or {abstract}.
Suppose <<Singleton>> is removed, now it becomes a bit unclear whether the class is a singleton or not. In practice, singleton classes often have a lot more methods and variables than what is shown in the example. The specific names theOne and getInstance() (from my understanding) aren't conventions either and different developers may name them differently or even implement Singletons differently (e.g. using a Singleton<T> generic class). Hence, determining whether something is a singleton purely base on the methods and variables is not as straightforward as it may look. Thus the <<Singleton>> notation is good for being explicit and clear.
I realize that Singletons have <> UML Notation above the class name, I just wanted to clarify that according to the textbook it is optional.
Seems like the textbook does imply that it is optional. From what I gather, most things in UML class diagrams are optional. The bare minimum seems to just be class names (for representing classes) and a solid line (for representing associations). But then again, you can omit specific classes and associations (as many have done in the TP) if they are not necessary for what you're trying to convey. Not sure what the convention is for our final exam though.
And also Facade Classes would not require such an UML Notation?
Pretty sure you can specify it if you feel it is necessary. I remember one of the tutorials had a UML class diagram where <<Facade>> was specified. I have no screenshots of it though :(
Question regarding Singletons:
<<role/purpose>>
come in for the Singletons? Is it in the naming of the singleton?<<Singleton>>
UML Notation above the class name, I just wanted to clarify that according to the textbook it is optional. And also Facade Classes would not require such an UML Notation?The text was updated successfully, but these errors were encountered: