IT lexicon › Programming › Type object

Type object

Programming På svenska → Updated: 2026-10-25

A pattern that defines a "type" as data in an object rather than as a subclass, so new kinds can be created at runtime without new code.

Instead of one class per monster breed — Goblin, Troll, Dragon — each monster holds a reference to a type object carrying the shared attributes (health, attack, sprite). Adding a new breed becomes a data entry, not a recompile. The pattern is described in Game Programming Patterns and is the backbone of data-driven design and moddable games.

Its kinship with the flyweight is plain: many instances share one common, immutable type object rather than each carrying its own copy of the same data.

← Back to the lexicon