The 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.
No comments yet, be the first one to post comment.