Talk:Strategy
m (Reverted edits by Ebybymic (Talk); changed back to last version by Jason Clutterbuck) |
|||
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) | |
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 states 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) | 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 states 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) | ||
As per conversation with [[User:Dominic Winkler|Dom]] the right word here is behaviour. So the State pattern is for capturing behaviour that is state dependent. -[[User:Jason Clutterbuck|Jason Clutterbuck]] 02:51, 12 September 2008 (UTC) | As per conversation with [[User:Dominic Winkler|Dom]] the right word here is behaviour. So the State pattern is for capturing behaviour that is state dependent. -[[User:Jason Clutterbuck|Jason Clutterbuck]] 02:51, 12 September 2008 (UTC) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 03:21, 25 November 2010
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 states 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)
As per conversation with Dom the right word here is behaviour. So the State pattern is for capturing behaviour that is state dependent. -Jason Clutterbuck 02:51, 12 September 2008 (UTC)