The Prototype Pattern

archetype ManufacturingObject-Oriented Design

Categories: software-engineering

What It Brings

Call something a “prototype” and you invoke the industrial design workshop: a master model sits on the bench, and every copy is stamped, cast, or molded from it. The GoF Prototype pattern maps this onto software: instead of constructing objects from scratch via a class constructor, you clone an existing instance. The copy is the specification.

Key structural parallels:

Where It Breaks

Expressions

Origin Story

The Prototype pattern was codified in Design Patterns (1994) by the Gang of Four. Its immediate metaphorical source is industrial prototyping — the practice of building a reference model from which production copies are derived. But the deeper root is older: “prototype” comes from Greek prototypon (first impression, original form), itself from protos (first) + typos (impression, mold). The etymology preserves the manufacturing metaphor: a prototype is the first thing struck from a mold.

The pattern has an interesting relationship with prototype-based programming languages, particularly Self (1986) and later JavaScript (1995). In these languages, prototypal inheritance is the primary object model — objects inherit directly from other objects, with no classes involved. Brendan Eich chose the word “prototype” for JavaScript deliberately, drawing on the same manufacturing metaphor but applying it to delegation rather than cloning. The result is that “prototype” in software carries two distinct but etymologically related meanings, and developers regularly conflate them.

The GoF Prototype pattern itself sees moderate use compared to Factory and Builder. It appears most often in systems that need to create objects whose types are determined at runtime (plugin architectures, graphical editors with palettes of shapes, game engines with entity templates). The manufacturing metaphor works well in these contexts because the user literally selects a sample and says “give me another one like that.”

References

Related Mappings