Context:

Application framework is responsible for initializing some resources and make them globally available (e.g. to each other), but does not - itself - use them.

Challenge:

To make each resource ready on time (without applying the singleton pattern).

Skill:

Participants:

Application Framework:

Responsible for driving the Initialization Manager.

Initialization Manager:

A singleton. Registers prioritized initialization commands. Responsible for activating the initialization commands in the correct order.

Resource:

The target of the initialization. Its constructor leaves it in undefined state. Optionally, responsible for launching the initialization command during its own (empty) initialization.

Resource initializer:

A command, waiting at the initialization manager, in order of priority. Responsible for waking the resource to finish it initialization process.

Signature:

Initialization Manager references Resource Initializers, each referencing a Resource. Resource typically creates a Resource Initializer which typically registers itself at the Initialization Manager. The application-Framework uses the (singleton) Initialization Manager.

Used patterns and idioms:

Command, Singleton.

Used by:

generalized application frameworks.

Scope:

General (infrastructure).