by vlado on Tue, 2006-07-25 16:41
- Intent
- Allow an object to alter its behavior when its internal state changes.
- Motivation
- An article in a typical editorial workflow exibits different behaviours in different publication stages. We want an object that hides the complex logic.
- Implementation
- Similar to the strategy pattern. Need to handle state change and behaviour change.
- Examples
$new_state="edit";
$new_protocol="edit";
//change the behaviour
list($view,$update,$get, $set) = $object->protocol($new_protocol);
- Related patterns
- Protocol Method, Builder, Strategy
- Note
- Too many different implementations exists. This means that there is probably a need to clean up the intent.