1
edit
Changes
State
,→Advantages of using State Pattern
'''2. State pattern makes state transition explicit. '''
If the state is defined with an internal data values, its state transition do not have explicit representation. If a variable is used to specify its current state, it will have a structure that contains be difficult to extend and maintain since the states and transitions are handled using many if or and switch statements.
'''3. State objects can be shared by other classes.'''