GofPatterns Gofpatterns  





Design Patterns  «Prev  Next»
Lesson 5 Singleton Design Pattern Structure
ObjectiveStudy the structure of the Singleton.

Singleton Design Pattern Structure

Here is a diagram showing the structure of the Singleton pattern.
The pattern of the Singleton is a relatively simple pattern, therefore its diagram is relatively simple.
Diagram Class Distributed Computing
Singleton Design Structure

None of the names here are important. In general, the names of the methods, fields, and classes change in each different implementation. What is important is the relationships between the different parts, and the roles each part plays in the whole pattern.
You should also note that the entire class is not diagrammed here, only the parts relevant to the pattern. For instance, it is almost certain that the class has some other methods and fields. If it's an AudioDevice class discussed in the motivation, it probably has some sort of play() methods for example. However, these are not part of the pattern itself.

Singleton Pattern - Quiz

Click the link below to take a short quiz on the material that was just covered.
Singleton Pattern - Quiz