why is proxy pattern a structural pattern and why is state pattern a behavioral pattern. What is the criteria for determining a new pattern should be considered structural or behavioral?
2 Answers
Patterns are structural if the focus is on how relationships between objects are organised to form larger components whereas behavioral patterns are focused on the allocation of object responsibilities and the communication between them
The proxy is structural because it acts as a surrogate for another object, state is behavioral because the state is passed in to an object to influence its behaviour at runtime.

- 2,938
- 1
- 27
- 42
Lets begin with the definition of Structural and Behaviroal patterns.
Structural Patterns: Structural patterns focus on how classes and objects are composed to form larger structures. Inheritance is the mechanism the structural class patterns use to compose implementations or interfaces. Structural object patterns illustrate ways to compose objects in ways that provide them with new functionality.
Behavioral Patterns: Behavioral patterns are patterns that implement algorithms and are concerned with assigning responsibilities between objects. They also describe patterns of communications between object and classes. By using behavioral patterns the designer is able channel his/her focus away from flow of control and center his/her attention on the way the objects are interconnected. Behavioral class patterns distribute behavior among classes by using the object-oriented technique of inheritance. Behavioral object patterns on the other hand use object composition to perform their functions.
If you ponder over these the whole premise is if its to do with modelling a class/object structure go for Structural Patterns and if you are dealing with changing behaviour then Behavioral patterns will come to your rescue.
In case of Proxy, you are just wrapping the target and forwarding the call. In case of State you actually use inheritance (as described in definition above) and hence polymorphism to change the run time behavior.
Hope that helps.

- 4,137
- 6
- 39
- 53