The State pattern is a convenient way to implement a state machine that's more maintainable than a typical switch-statements-in-multiple-places implementation. In this video segment, Allen Holub explains how the individual methods of objects will change behavior based on the specific state that an object is in.

Learn more from Allen Holub in-person by attending his Designing Modular Architecture two-day training course at the O'Reilly Software Architecture Conference in New York.

Article image: Washing machine (source: Kratol).