8 Singleton

OBJECTS CAN USUALLY act responsibly simply by performing their own work on their own attributes, without incurring obligations beyond self-consistency. Some objects, though, take on further responsibilities, such as modeling real-world entities, coordinating work, or modeling the overall state of a system. When a particular object in a system bears a responsibility on which other objects rely, you need some way of finding the responsible object. For example, you might need to find an object that represents a particular machine, a customer object that can construct itself from data in a database, or an object that initiates system memory recovery.

In some cases, when you need to find a responsible object, the object that you need ...

Get Design Patterns in Java™, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.