<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://www.patternsforphp.org/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="http://www.patternsforphp.org/feed.php">
        <title>Patterns For PHP</title>
        <description></description>
        <link>http://www.patternsforphp.org/</link>
        <image rdf:resource="http://www.patternsforphp.org/lib/images/favicon.ico" />
       <dc:date>2010-09-09T00:12:43+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=start&amp;rev=1274242758&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=table_data_gateway&amp;rev=1274242003&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=abstract_factory&amp;rev=1274149456&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=value_object&amp;rev=1274149142&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=strategy&amp;rev=1274149047&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=singleton&amp;rev=1274148995&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=registry&amp;rev=1274148607&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=prototype&amp;rev=1274148524&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=observer&amp;rev=1274148456&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=lazy_initialization&amp;rev=1274148402&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=iterator&amp;rev=1274148171&amp;do=diff"/>
                <rdf:li rdf:resource="http://www.patternsforphp.org/doku.php?id=factory&amp;rev=1274148114&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="http://www.patternsforphp.org/lib/images/favicon.ico">
        <title>Patterns For PHP</title>
        <link>http://www.patternsforphp.org/</link>
        <url>http://www.patternsforphp.org/lib/images/favicon.ico</url>
    </image>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=start&amp;rev=1274242758&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-19T04:19:18+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>start</title>
        <link>http://www.patternsforphp.org/doku.php?id=start&amp;rev=1274242758&amp;do=diff</link>
        <description>Patterns

Behavioral Patterns

Creational Patterns

Object Relational Mapping

Structural Patterns

Misc / Uncategorized Patterns


Abstract Factory

Adaptor

Application Controller

Command

Composite

Data Access Object

Data Mapper

Data Transfer Object</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=table_data_gateway&amp;rev=1274242003&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-19T04:06:43+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>table_data_gateway</title>
        <link>http://www.patternsforphp.org/doku.php?id=table_data_gateway&amp;rev=1274242003&amp;do=diff</link>
        <description>Zend Framework's Zend_Db_Table is a good example of this pattern, it implements a focal point of access for each database table thereby allowing database access logic to remain separate from application logic.


Definition

An object that acts as a Gateway to a database table.  One instance handles all the rows in the table.</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=abstract_factory&amp;rev=1274149456&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:24:16+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>abstract_factory</title>
        <link>http://www.patternsforphp.org/doku.php?id=abstract_factory&amp;rev=1274149456&amp;do=diff</link>
        <description>Introduction


If you have not already done so, read up on the Factory Pattern. The Abstract Factory pattern is often easy to misunderstand because its complexity in certain situations. Here we will present two examples, one simply to demonstrate the concept, and another showing a more typical in-depth use.</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=value_object&amp;rev=1274149142&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:19:02+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>value_object - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=value_object&amp;rev=1274149142&amp;do=diff</link>
        <description>Introduction


Defining a Value Object can be difficult. The simplest way to think of it is as a typical value like any integer or string. The number 10, for example, can appear in numerous objects in an application. However the number has no identity - each is its own separate entity. In contrast, many objects in an application will be reference objects. Reference objects are the result of the pass-by-reference behaviour in PHP. If you create a User_A object and pass it into an application, the…</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=strategy&amp;rev=1274149047&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:17:27+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>strategy - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=strategy&amp;rev=1274149047&amp;do=diff</link>
        <description>The Strategy pattern defines an object that represents an algorithm for a particular task. 


Introduction

In an object oriented application, whenever a new task is identified a programmer's response is usually to create a new class to represent it. Over time however the class may evolve to include numerous sub tasks, each of which adds further complexity to the original class. In some cases, such sub tasks may have many alternatives. An example is a Logger class. It's original task is to write…</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=singleton&amp;rev=1274148995&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:16:35+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>singleton - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=singleton&amp;rev=1274148995&amp;do=diff</link>
        <description>Introduction


The Singleton is one of the simplest Patterns to understand. It's common usage is to ensure that only one instance of a class is ever instantiated. The reason for wanting such behaviour varies but typically it is because only one object instantiated from the source class is required and you want the resulting object to be available throughout an application, i.e. globally available.</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=registry&amp;rev=1274148607&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:10:07+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>registry</title>
        <link>http://www.patternsforphp.org/doku.php?id=registry&amp;rev=1274148607&amp;do=diff</link>
        <description>Introduction


The Registry is one of those Patterns where once you understand it, it seems so incredibly useful. Think of it as a basket; using a Registry you can add data (both values and objects) to the basket, and retrieve them as required from other parts of an application. Since all such data is handled by a single Registry object, it makes passing data and objects around an application far more simple than passing all such values as individual parameters to a constructor or setup method. …</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=prototype&amp;rev=1274148524&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:08:44+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>prototype - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=prototype&amp;rev=1274148524&amp;do=diff</link>
        <description>A prototype pattern is a creational design pattern used in software development when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects. This pattern is used for example when the inherent cost of creating a new object in the standard way (e.g., using the 'new' keyword) is prohibitively expensive for a given application.</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=observer&amp;rev=1274148456&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:07:36+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>observer - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=observer&amp;rev=1274148456&amp;do=diff</link>
        <description>Introduction


The Observer pattern is like a newspaper subscription. You have a subject, which is the object that changes its state (in our example is the newspaper) and a observer, which is the object that receives these changes (the subscriber). 

Implementing the Observer Pattern

First I'll create the subject interface.</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=lazy_initialization&amp;rev=1274148402&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:06:42+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>lazy_initialization - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=lazy_initialization&amp;rev=1274148402&amp;do=diff</link>
        <description>Lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed. 

A Simple PHP Example



class User
{
    protected $_id;
    
    public function getId()
    {
        return $this-&gt;_id;
    }
}
 
class Post
{
    protected $_userId;
    
    protected $_text;
 
    /**
     *
     * @var User
     */
    protected $_user;
    
    
    public function setUser(User $user)
    {
        $this…</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=iterator&amp;rev=1274148171&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:02:51+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>iterator - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=iterator&amp;rev=1274148171&amp;do=diff</link>
        <description>Introduction


PHP has a history of using functions for iteration, but there is now a push to use objects in PHP 5. The Iterator Pattern is not language specific and doesn't need any language enhancements to create. The added benefit in PHP 5 is that objects are allowed in foreach loops with the SPL Iterator interface.</description>
    </item>
    <item rdf:about="http://www.patternsforphp.org/doku.php?id=factory&amp;rev=1274148114&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2010-05-18T02:01:54+00:00</dc:date>
        <dc:creator>Shawn Stratton</dc:creator>
        <title>factory - created</title>
        <link>http://www.patternsforphp.org/doku.php?id=factory&amp;rev=1274148114&amp;do=diff</link>
        <description>Introduction


At some point in PHP development, programmers will discover a need to simplify the creation of some objects. Perhaps the object simply requires a number of detailed steps to create, all of which must be duplicated for every new object of that type. To remove such code duplication and simplify the task, the Factory Pattern offers a solution. In fact the Factory Pattern is something many programmers may discover by themselves since it is a logical step to take all the detailed creat…</description>
    </item>
</rdf:RDF>
