Vo Xuan Tien
Object creation, persistence, delivery are outside of the core
Dependencies point only toward the business logic.
What?
Connect business logic, factories and persistence.
When?
Any application has to work with persistence and with some kind of list of items.
What?
It’s a class that acts as a factory of object instances.
What?
It will know how to take all the information needed to build an object.
What?
$buttons = array('image', 'input', 'flash');
foreach($buttons as $b) {
echo ButtonFactory::createButton($b)->getHtml();
}
What?
Offers the connection between the business logic and the database itself.
What?
Do the queries on the database and get raw data.
What?
Raw data must then be passed to the Factories.
Duplication by Data Handling
Duplication by Data Retrieval Logic
Duplication by Data Persistence Logic