<?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>Sun, 19 May 2013 00:59:19 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DevShed:  PHP and the Law of Demeter]]></title>
      <guid>http://www.phpdeveloper.org/news/16723</guid>
      <link>http://www.phpdeveloper.org/news/16723</link>
      <description><![CDATA[<p>
On DevShed today there's a new tutorial looking at how to <a href="http://www.devshed.com/c/a/PHP/PHP-and-the-Law-of-Demeter-43810/">use dependency injection</a> to help prevent you from breaking the "Law of Demeter" in your application's structure.
</p>
<blockquote>
When [responsibilities aren't well defined for classes], it's a clear symptom of a common issue known as the "Law of Demeter" breakage. In case the name doesn't ring any bells, the "Law of Demeter" (<a href="http://en.wikipedia.org/wiki/Law_of_Demeter">http://en.wikipedia.org/wiki/Law_of_Demeter</a>) - or the Principle of Least Knowledge - is a paradigm that allows to create loosely-coupled classes, based on a simple concept: each class should be designed to work properly using only the dependencies that it really needs.
</blockquote>
<p>
He talks about how violation of this law (whether you knew you were or not) can lead to some bad coupling practices. He includes a few classes under a SampleApp that handles the interface between a database and the domain model. The violation of the law comes in when the database and service layers are introduced - a fetch the code does to get an adapter from the service locator rather than directly from the database functionality as it should.
</p>
<p>
There's <a href="http://www.devshed.com/c/a/PHP/PHP-and-the-Law-of-Demeter-43810/">code for everything</a> included in the post 
</p>]]></description>
      <pubDate>Tue, 16 Aug 2011 10:20:26 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Pim Elshoff's Blog: SOLID design]]></title>
      <guid>http://www.phpdeveloper.org/news/16707</guid>
      <link>http://www.phpdeveloper.org/news/16707</link>
      <description><![CDATA[<p>
In your development time, you might have heard of the SOLID development design principles that aim to keep you and your application well structured and on track. If you haven't had the time to learn much about them, you should consider <a href="http://www.pelshoff.com/2011/08/solid-design">this new post</a> from <i>Pim Elshoff</i> that briefly covers each principle (with some code examples along the way).
</p>
<blockquote>
Oh how we love acronyms. We've discussed a lot about writing a class, but we haven't talked about writing classes yet. How do you know if your solution is right? It is not enough to have a working program. SOLID is a set of principles that define severable measurable properties your architecture should have at least, in order to be dubbed right.&#65279;
</blockquote>
<p>
He goes through each of the principles (single responsibility principle, Liskov substitution principle, etc) and gives a summary statement, a definition and code illustrating it in use. The examples aren't all based on the same code as implementing all of these principles at once as been <a href="http://phpdeveloper.org/news/16431">found</a> to <a href="http://phpdeveloper.org/news/16436">be difficult</a>. He also includes another principle to keep in mind - the "Law of Demeter" dealing with calling scope of properties and methods.
</p>]]></description>
      <pubDate>Thu, 11 Aug 2011 12:15:01 -0500</pubDate>
    </item>
  </channel>
</rss>
