The Simple Singleton Pattern

The Simple Singleton pattern provides a global reference to an object that requires uniqueness. Figure 6-7 shows the class diagram.

Image

Figure 6-7. Simple Singleton pattern class diagram

This pattern has the following parts:

  • Concrete singleton
  • Class member
  • Client

The pattern's benefits are as follows:

  • Grants global access to an object
  • Maintains access to its unique instance
  • Is easy to create

It also has this drawback:

  • Can't be extended (change is a constant)

A Comprehensive Look

Chapter 4 explained that not all object-oriented languages are built equally, and therefore not all patterns can be implemented equally. ...

Get AdvancED ActionScript 3.0: Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.