40 likes | 62 Views
Learn about the Object Registry design pattern, its motivation, implementation details, and why it's a non-canonical pattern. Explore how to use a registry as a global object and key-based lookup for common services in your applications.
E N D
Registry Design Pattern keeping track of objects
Registry Motivation & Provenance • non-canonical (not out of Gamma et al) design pattern • described by Martin Fowler in "Patterns of Enterprise Application Architecture" • well-known object that other objects use to find common objects and services
Registry Implementation details • registry is usually a global object • may be implemented as singleton • objects to be looked up register with the registry • object lookup is performed by key • key-ed map is often used as implementation • may be used to pass information to objects withoutlookup evaluation • global object – creates external dependencies • may be preferred to passing them around as parameters
Registry Review • why is it called a non-canonical pattern? • what is Registry and what kind of functionality should it provide? • where and how should Registry be used? • Registry is a global object. How is this implemented in C++? • why can’t just a global queue be used to implement the functionality of a Registry? • What’s wrong with using Registry and why is it used anyway?