- 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();
Factory and Abstract Factory
by vlado on Tue, 2006-07-25 09:20
<?php