State Pattern

The state pattern is also known as objects for states pattern. The state of an object can be defined as the values of its properties,…

A typical example is a drawing program in which there is an interface for colour painting and concrete instances of that class could represent different colours,…

The State pattern is useful in designing a class where a typical instance of which can exist in many different states and behaviours. Such a class is called Context class. A Context object can alter its behaviour when there is a change in its internal state.

See Strategy and Memento.

state.png
page_revision: 5, last_edited: 1230289090|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License