The state pattern
A finite state machine is an important concept in computer science. It has a strong mathematical base and it represents an abstract machine that can be in a finite number of states. Finite state machines are used in all fields of computer science.
The state pattern is just an implementation of a finite state machine in object-oriented design. The class diagram is as follows:
