By rick
via tobinharris.com
Published: Jun 24 2008 / 04:55
I've been looking at the state pattern today, with the goal of allowing business entities to behave differently depending on their state. So, an Order in "Shipped" state would have a completely different behavior to an order in "Placed" state; I might not be able to update an order in Shipped state, but I could if it were merely "Placed".
SaveShareSend
Tags: .net, methodology
Comments
tobinharris replied ago:
Tad made some interesting comments:
* The State Design Pattern compromises the encapsulation of the context class, which typically requires granting friendship to all State classes.
* It enforces indirect access to the context’s parameters from the methods of the concrete state subclasses (via the context pointer).
* It isn’t hierarchical. That is, it can’t be used to directly implement statecharts.
Voters For This Link (8)
Voters Against This Link (2)