
Software Design – The State Pattern
In this episode, we look at the state pattern. It is a design that uses object-oriented tactics to provide a class with very different functionality based on its current state. I think you will find this to be one that is not often going to be evident in your first pass of a design. The State Pattern Defined As always, we will start with the “Gang of Four” intent to set the stage for our discussion. “Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.” We have not had many cases of helpers or partner classes in the patterns we have explored so far. This pattern uses a primary (context)... Read more