<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 21 May 2013 05:22:26 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Overriding Strategy Logic - The Template Method Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/18514</guid>
      <link>http://www.phpdeveloper.org/news/18514</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial posted talking about <a href="http://phpmaster.com/overriding-strategy-logic-the-template-method-pattern/">the Template Method Pattern</a> to help make some sense (and make easier to use) your implementation of the Strategy pattern.
</p>
<blockquote>
This bring us back to the question whether it's feasible to eliminate duplicated strategy logic via Inheritance rather than switching over to plain Composition. Indeed it is, and the clean up process can be conducted through an ubiquitous pattern known as <a href="http://en.wikipedia.org/wiki/Template_method_pattern">Template Method</a>. [...] Simply put, there's a base class (usually an abstract one), which declares a concrete method (a.k.a. the template) responsible for outlining the steps or hooks of a certain algorithm. Most of the time the base type provides boilerplate implementation for some of those steps and the remaining ones are delegated to subclasses.
</blockquote>
<p>
The subtypes then override the base's functionality and extend it with their own. They show an example of this by making a jQuery image slider (using <a href="http://jquery.malsup.com/cycle/">this plugin</a>) , an "AbstractCycleSlider" class and two subclasses for two other types - "FadeSlider" and "ScrollSlider", each outputting their own HTML. It also shows how to implement a slider using a <a href="http://www.zurb.com/playground/orbit-jquery-image-slider">different plugin</a> and output both in the same script.
</p>]]></description>
      <pubDate>Tue, 25 Sep 2012 08:58:01 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Subtype Polymorphism - Swapping Implementation at Runtime]]></title>
      <guid>http://www.phpdeveloper.org/news/18484</guid>
      <link>http://www.phpdeveloper.org/news/18484</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new tutorial from <i>Alejandro Gervasio</i> about <a href="http://phpmaster.com/subtype-polymophism/">subtype polymorphism</a>. It sounds a little scary, but really it's just a look at sub-objects that inherit from parents and how to swap them around at runtime to do different things.
</p>
<blockquote>
In this article I'll show you how to exploit the virtues that Polymorphism offers through the development of a pluggable cache component. The core functionality can be expanded later to suit your needs through the development of additional cache drivers.
</blockquote>
<p>
He starts off with the definition of an interface to provide structure to the sample application (the CacheInterface) and implements it in two different subtypes - a FileCache and an AppCache (using the file system and APC, respectively). He builds on these and creates a "View" that uses these caching systems to generate and save the output to a cache for use later in the execution.
</p>]]></description>
      <pubDate>Mon, 17 Sep 2012 12:48:52 -0500</pubDate>
    </item>
  </channel>
</rss>
