Talk:Strategy

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: I'm still not quite sure if I do understand the difference of the State and Strategy pattern. I added what I think is important to my understand.... --~~~~)
 
Line 1: Line 1:
 
I'm still not quite sure if I do understand the difference of the State and Strategy pattern. I added what I think is important to my understand.... --[[User:Dominic Winkler|Dom]] 03:08, 20 August 2008 (UTC)
 
I'm still not quite sure if I do understand the difference of the State and Strategy pattern. I added what I think is important to my understand.... --[[User:Dominic Winkler|Dom]] 03:08, 20 August 2008 (UTC)
 +
 +
The difference between strategy and state is the intent. The [[Strategy|Strategy pattern]] is used when the purpose is to provide different functionality, using different algorithms. The [[State|State Pattern]] is used when the propose is to represent the different internal states that the object can have. Doing this using the state pattern has some advantages such as explicitly defining valid stated and preventing the object from entering a possibly invalid state. Strategy provides functionality.  State stores information. Does that help? -[[User:Jason Clutterbuck|Jason Clutterbuck]] 23:07, 11 September 2008 (UTC)

Revision as of 23:07, 11 September 2008

I'm still not quite sure if I do understand the difference of the State and Strategy pattern. I added what I think is important to my understand.... --Dom 03:08, 20 August 2008 (UTC)

The difference between strategy and state is the intent. The Strategy pattern is used when the purpose is to provide different functionality, using different algorithms. The State Pattern is used when the propose is to represent the different internal states that the object can have. Doing this using the state pattern has some advantages such as explicitly defining valid stated and preventing the object from entering a possibly invalid state. Strategy provides functionality. State stores information. Does that help? -Jason Clutterbuck 23:07, 11 September 2008 (UTC)

Personal tools