Topics

programming

php drupal scheme scheming macros design patterns da la

design

design css

random thoughts

scribbles

alter ego

other me 'em that link us my space me linked in

Collections

Programmable web
PHP design patterns

PHP Design Patterns

  • A catalogue of php design pattern shorts
    • Accumulator passing
    • Closure
    • Control abstraction
    • Coroutines (generator based)
    • Dynamic dispatch
    • Dynamic loading
    • Facade
    • Factory and Abstract Factory
    • Fluent Interfaces/ Method chaining
    • Generator (iterator protocol based)
    • Generic function
    • Hooks
    • Interpreter
    • Iterator (based on protocol method)
    • Lazy evaluation
    • Memoization
    • Nested scope
    • Observer
    • Partial Evaluation
    • Protocol method
    • Proxy
    • Singleton
    • State
    • Strategy Pattern
  • Models, records, databases, friends and foes

Similar things

  • Learning lessons from Lisp or patterns and languages in PHP
  • Emulating closures in PHP
  • Some ways to use saved state with closures in php
  • Scoped php functions or more ways to abuse php
  • PHP Design Patterns
  • Strategy Pattern
  • Memoization
  • Singleton
  • Factory and Abstract Factory
  • Facade

guild
Home » PHP Design Patterns » A catalogue of php design pattern shorts

State

design patterns | php
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.
‹ SingletonupStrategy Pattern ›
printer-friendly version | add new comment
Home » PHP Design Patterns » A catalogue of php design pattern shorts

dikini.net

spreading confusion by accident since 1970