«« Next » « Previous
«« Next » « Previous

Link Details

Link 89669 thumbnail
User 1 avatar

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".
  • 8
  • 2
  • 778
  • 310

Comments

Add your comment
User 301224 avatar

tobinharris replied ago:

0 votes Vote down Vote up Reply

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.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (8)



Voters Against This Link (2)