September 2020
Intermediate to advanced
653 pages
10h 37m
English
This chapter covers the State pattern.
Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
The GoF definition is easy to understand. It simply states that an object can change what it does based on its current state.
Suppose that you are dealing with a large-scale application where the codebase is rapidly growing. As a result, the situation becomes complex, and you may need to introduce lots of if-else blocks/switch statements to guard the various conditions. The State pattern fits in such a context. ...
Read now
Unlock full access