Context:

  • Selecting objects by visual example.
  • Creating objects by content (rather than type).
  • Copying heterogeneous collections.

Challenge:

To copy each object without having to tell its type.

Skill:

Participants:

Prototype:

represents the capability to copy any object of a type family.

Concrete Prototype:

knows how to copy itself.

Signature:

prototype responds to clone message, returning base object.

Used by:

Dynamic Pluggable Factory, selection bars, deep copy of heterogeneous collections.

Scope:

General. (Preferably, languages that support deep-copying by default.)