The State Pattern seems to use a circular reference. Why is that okay?

Viewed 1598

I'm still trying to understand the dangers of circular references. I often read that they should only be used in rare cases. But, in the canonical State Pattern, the "state" objects need to reference the "context" object in order to cause a transition and the "context" object needs to reference the "state" objects in order to trigger their behaviors.

Isn't this a circular reference? If not, how does it relate to circular references? If so, why is this acceptable?

http://en.wikipedia.org/wiki/State_pattern

http://sourcemaking.com/design_patterns/state

1 Answers
Related