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
  • Partial Evaluation

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

Facade

design patterns | php
Intent
provide a simple interface to a subsystem.
Motivation
a complex system can have many parts that need to be exposed, but it could be confusing ergo - provide a simple interface to the system. For example a read-evaluate-print process of an interpreter
Implementation
Hide the construction of the required objects inside the facade
Example
class rep_facade { function __construct() { $this->firewall = new firewall(); $this->reader = new reader(); $this->evaluator = new evaluator(); $this->printer = new printer(); } function rep($text) { $text = $this->firewall($text); $ts = $this->reader($text); $result = $this->evaluator($ts); return $this->printer($result); } }
Complications
The lack of modules and/or nested classes in php means that this is a comfort interface, not an enforcing interface
‹ Dynamic loadingupFactory and Abstract Factory ›
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