<?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>Fri, 24 May 2013 12:08:10 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Layer Supertype Pattern: Encapsulating Common Implementation in Multi-Tiered Systems]]></title>
      <guid>http://www.phpdeveloper.org/news/18176</guid>
      <link>http://www.phpdeveloper.org/news/18176</link>
      <description><![CDATA[<p>
On PHPMaster.com there's a new post looking at a design pattern that's commonly in use by developers but they might not know its name - the <a href="http://phpmaster.com/the-layer-supertype-pattern-encapsulating-common-implementation-in-multi-tiered-systems/">Layer Supertype</a> pattern and its use in multi-tiered systems.
</p>
<blockquote>
Inheritance offers a straightforward way to easily spawn a large number of objects that are semantically related to each other without having duplicate code. The concept is ridiculously simple - yet powerful: you first drop as much logic as possible within the boundaries of a base type (usually an abstract class, but it could be a concrete one), and then start deriving refined subtypes according to more specific requirements. [...] Not surprisingly, this repetitive encapsulation/derivation cycle lays down on the formalities of a design pattern known as <a href="http://martinfowler.com/eaaCatalog/layerSupertype.html">Layer Supertype</a>.
</blockquote>
<p>
They describe the "supertype" as a replacement for an overly bloated domain-related model. Their example replaces a PostInterface/CommentInterface with a more generic "AbstractEntity" that handles some of the basics for you - getting/setting, checking a field, setting an ID and outputing the information to an array.
</p>]]></description>
      <pubDate>Wed, 04 Jul 2012 17:13:39 -0500</pubDate>
    </item>
  </channel>
</rss>
