State Design Pattern explained with simple example

State design pattern allows an object to change its behaviour whenever its state changes. This design pattern is very similar to state machines in which behaviour of an object based on an event is dependent on the its state. This design pattern makes the software easily extensible as adding new states are quite easy because it doesn’t affect the behaviour of existing states.

Before going ahead have a look at Design pattern simplified version.

(more…)
State Design Pattern explained with simple example Read More