<?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 22:14:31 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Freek Lijten: SOLID - The D is for Dependency Inversion Principle]]></title>
      <guid>http://www.phpdeveloper.org/news/18980</guid>
      <link>http://www.phpdeveloper.org/news/18980</link>
      <description><![CDATA[<p>
<i>Freek Lijten</i> has posted the <a href="http://www.freeklijten.nl/home/2013/01/02/SOLID-The-D-is-for-Dependency-Inversion-Principle">last article in his series</a> looking at the <a href="http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)">SOLID</a> development principles, this time looking at "D", the Dependency Inversion Principle.
</p>
<blockquote>
The DIP deals with avoiding mixing different levels of abstraction in your code. In this article we will explore the last of these principles in depth. [...] I want to show you how depending on abstractions makes our lives easier in a larger example. Since we're going to be loading, updating and storing bikes a lot in our application I would like an Api for that. It would not be such a good idea to write the same queries or perform the same validation over and over.
</blockquote>
<p>
He includes two examples - one a bit simplistic involving bike storage and another more complex that uses interfaces to define structure and object injection rather than passing data around. He also tries to help clear up some of the confusion that might happen around dependency inversion and dependency injection.
</p>]]></description>
      <pubDate>Wed, 02 Jan 2013 10:25:46 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: The Dependency Inversion Principle]]></title>
      <guid>http://www.phpdeveloper.org/news/17938</guid>
      <link>http://www.phpdeveloper.org/news/17938</link>
      <description><![CDATA[<p>
Continuing on in their series looking at the <a href="http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)">SOLID</a> development principles, <i>Alejandro Gervasio </i> picks back up and looks at the "D" in the set - the <a href="http://phpmaster.com/dip-intro/">dependency inversion principle</a>.
</p>
<blockquote>
While some central concepts in the realm of object-oriented design are generally harder to digest at first, such as separation of concerns and implementation switching, more intuitive and untangled paradigms on the other hand are simpler, like programming to interfaces. Unfortunately, the DIP's formal definition is surrounded by a double-edged curse/blessing that often makes programmers gloss over it, as in many cases there's an implicit assumption that the principle is nothing but a fancy expression for the aforementioned "programming to interfaces" commandment.
</blockquote>
<p>
He talks about how decoupling your code and working against interfaces is only part of the equation. The other half is the actual "inversion" part of the process - the ownership that the high-level modules must have over the abstractions. He illustrates with an example, a storage module that is highly dependent on a Serializer. Using the DIP principle, he turns this around and refactors his storage class to take in an Encoder object as a part of its construction. Complete source for both versions is included.
</p>]]></description>
      <pubDate>Thu, 10 May 2012 08:52:19 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Devis Lucato's Blog: Select: Inversion of Control]]></title>
      <guid>http://www.phpdeveloper.org/news/17260</guid>
      <link>http://www.phpdeveloper.org/news/17260</link>
      <description><![CDATA[<p>
In a recent post to his blog <i>Devis Lucato</i> introduces the "Inversion of Control" design pattern and <a href="http://lucato.it/inversion-of-control">shares an implementation</a> he's created as an illustration - a Service Locator called <a href="https://github.com/dluc/Select">Select</a>.
</p>
<blockquote>
[In a Service Locator] all the dependencies are provided by a builder, which serves as a registry of dependencies and/or service definitions. The service locator knows how to instantiate each dependency.   Such service exposes methods like 'getMailer()', 'getLogger()' etc.  A service locator centralises the configuration detailing classes and parameters involved on objects instantiations.
</blockquote>
<p>
He includes some sample code showing the structure of a Select implementation using a "Mailer" identifier and definitions of the classes to load for it. He also includes a bit of documentation of the (simple) API you can use to work with the tool - setting namespaces, replacing class definitions, creating definitions and finding the resource associated with a definition (to name a few).
</p>]]></description>
      <pubDate>Wed, 14 Dec 2011 13:34:53 -0600</pubDate>
    </item>
  </channel>
</rss>
