State Pattern
Summary
- The State pattern responds to object changes and can change its behaviour by switching to a different set of operations.
- The State pattern can be seen as a dynamic version of the Strategy pattern.
Class diagram: (see State Pattern code review)
Usage
Use the State pattern when you have objects that will:
- Change their behaviour at runtime, based on some context.
- Are becoming complex, with many conditional branches.
Printer Friendly Version
Add to Favourites
DotNet Kicks
Digg
del.icio.us
Live Favourites
ma.gnolia
reddit
Slashdot
Technorati
Yahoo!