Design Patterns – State Pattern

added by atanashristov
3/15/2010 10:25:11 AM

0 Kicks, 112 Views

The State design pattern is a behavioural pattern. The behaviour of object changes accordingly to its internal state. We move the logic to property "State" which has method Handle() and call this method. We change the behaviour of the object as we just switch the value of the "State" property. This is an exapmple of using the State pattern to implement a traffic light.