June 2018
Intermediate to advanced
310 pages
6h 32m
English
You can think of the State design pattern as an opinionated Strategy, which we discuss at the beginning of this chapter. But while Strategy is changed from the outside, by the client, the State may change internally, based solely on the input it gets.
Look at this dialog a client wrote with Strategy:
Compare it with this one:
The client should also expect that the State may even reject some of its inputs:
Read now
Unlock full access