4. Data Management

Data management patterns handle the state of objects generically, independent of the actual content of those objects.

Memento

Purpose: save and restore an objects internal state.

Flexibility: vary pack/unpack routines.

Implementation: pack/unpack routines for externalizing/restoring state.

Prototype

Purpose: create new objects by cloning an existing one (the prototype).

Flexibility: change prototype.

Implementation: interface for cloning.

Flyweight

Purpose: save space by sharing common state among objects.

Implementation: differentiate between extrinsic state (context) and intrinsic state; share intrinsic (common) state.

Singleton

Purpose: guarantee single instance of a class.

Implementation: record existence of instance in static member

Previous group Next group Back to the top