Glossary Updates12 new terms added to the glossaries · October 2, 2026, 22:44 CEST
AI TechDocKnowledge

Glossary · Automation software engineering and architecture

State pattern

Also known as: State design pattern

German: Zustandsmuster

In software design, the state pattern is a design pattern in which an object delegates its state-dependent behavior to separate state objects, changing its behavior by switching the current state object.

  • Software engineering

In one sentence

The state pattern delegates state-dependent behavior to separate state objects and changes behavior by switching them.

Example

A machine module implements each PackML-style state such as Idle, Execute and Stopped as a separate class with its own reactions to commands.

How it applies

  • Engineering: The pattern replaces large case statements with one unit per state, which makes adding states easier. In PLC code, a CASE-based state machine is more common and often easier for maintenance staff to read.
  • Verification: Whatever the implementation, the state model should be specified first; tests then cover each state and transition.
  • Documentation: The state model, not the code pattern, belongs in user documentation: states, transitions, commands and indications. A diagram from the specification serves developers and operators alike.

State pattern vs. strategy pattern

Both delegate behavior to exchangeable objects. In the state pattern, the object switches states itself as a result of events. In the Strategy pattern, a client chooses the algorithm and it does not change on its own.

By knowledge.aitechdoc.world · Published September 26, 2026 · Last reviewed

Source: AI TechDoc Blog editorial definition, based on the design pattern catalog (Gamma et al., Design Patterns, 1994)

Definitions follow the cited standards and specifications. Where a source is a copyrighted publication, such as an ISO, IEC or EN standard, the definition is a close paraphrase, not a verbatim quotation, so as not to infringe copyright. We recommend reading the original publication. The sections “How it applies” are editorial commentary by AI TechDoc Blog and are not part of any standard.

Seen a mistake? Send us a note!