CSC/ECE 517 Fall 2012/ch1b 2w41 dc

From Expertiza_Wiki
Revision as of 20:05, 18 November 2012 by Vmunuku (talk | contribs) (Created page with "2w41. State pattern and the related patterns (Bridge, Strategy) State and Bridge patterns use the same structure to solve different problems: State allows an object’s beha...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

2w41. State pattern and the related patterns (Bridge, Strategy)

   State and Bridge patterns use the same structure to solve different problems: State allows an object’s behavior to change along with its state, while Bridge’s intent is to decouple an abstraction from its implementation so that the two can vary independently.
   Strategy has 2 different implementations, the first is similar to State. The difference is in binding times (Strategy is a bind-once pattern, whereas State is more dynamic).


Based on these lines, explain how the State pattern is related to or differ from the above patterns. Give suitable examples to explain the relationship or difference between the patterns.