Making States Constant
Suppose that you decide to move the state constants to a _DoorConstants interface. For this approach to work, you have to eliminate the Door instance variable from the DoorState class. You can drop this variable by changing the click(), complete(), and timeout() transition methods in the DoorState class to require a Door object as an input parameter. In this design, a Door object that receives, for example, a click() method from the carousel forwards this call as state.click(this).