. Factory and Abstract Factory | dikini.net
 

Factory and Abstract Factory

<?php
Intent
Creating objects (products) without specifying the exact class(type) of object that will be created.
Motivation
We want our program logic to determine the type of logger to be used
Implementation
Classes in php can be considered (weak) runtime objects, the nessessity of the dual factory/product heirarchy is diminished
Invisible in php
Might still want factory objects to handle families of similar objects
Examples
$product_type = which_product(); $probuct = new $product_type();
Powered by Drupal, an open source content management system