<?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>Wed, 19 Jun 2013 10:41:02 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Freek Lijten's Blog: SOLID - The O is for Open Closed Principle]]></title>
      <guid>http://www.phpdeveloper.org/news/17916</guid>
      <link>http://www.phpdeveloper.org/news/17916</link>
      <description><![CDATA[<p>
<i>Freek Lijten</i> has posted the <a href="http://www.freeklijten.nl/home/2012/05/07/SOLID-the-O-is-for-Open-Closed-Principle">second part</a> of his series looking at the <a href="http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)">SOLID</a> development methodology. In this latest post his looks at the second letter in the acronym - "O" for "Open Closed Principle."
</p>
<blockquote>
Software that requires an enormous amount of changes to implement one new feature or fix a bug is unstable and should be considered as "bad". Software should be designed so, that in case of a new feature, no existing classes should have to change. In other words: it is closed for modification. Existing software may be extended to achieve new features however.
</blockquote>
<p>
He starts off with a "What" section explaining a bit more about what this open/closed means for your code and gets into an example showing it in a more practical way. He shows how to take the principle and refactor an API connector class to pass in the object it needs (Bike) and use that to get information (rather than just passing in the data). He uses a <a href="http://en.wikipedia.org/wiki/Factory_pattern">Factory</a> to get the object type he needs based on the Bike type.
</p>]]></description>
      <pubDate>Mon, 07 May 2012 10:45:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Josh Adell's Blog: Command Invoker Pattern with the Open/Closed Principle]]></title>
      <guid>http://www.phpdeveloper.org/news/17398</guid>
      <link>http://www.phpdeveloper.org/news/17398</link>
      <description><![CDATA[<p>
In a response to a <a href="http://phpdeveloper.org/news/17389">recent post</a> on DZone.com about the "Open/Closed Principle" <i>Josh Adell</i> has <a href="http://blog.everymansoftware.com/2012/01/command-invoker-pattern-with-openclosed.html">posted an example</a> of a " flexible and extendable command invocation solution" implementing this <a href="http://en.wikipedia.org/wiki/SOLID_(object-oriented_design)">SOLID</a> idea.
</p>
<blockquote>
Let's overcome some of these issues [with only being able to extend the invoker class and that the invoker needs to know how to create commands], and also make the code even more extensible. I'll use a simplified command invoker to demonstrate.
</blockquote>
<p>
His code is included - the creation of a "Command" interface and two comments that implement it: "HelloCommand" and "PwdCommand", each with "register" and "execute" methods. His "Invoker" class then only needs to be told how to map these commands and the "register" is called as they're needed. You can find the full example code for this invocation example <a href="http://gist.github.com/1610148">in this gist</a>.
</p>]]></description>
      <pubDate>Mon, 16 Jan 2012 10:04:42 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DZone.com: Open/Closed Principle on real world code]]></title>
      <guid>http://www.phpdeveloper.org/news/17389</guid>
      <link>http://www.phpdeveloper.org/news/17389</link>
      <description><![CDATA[<p>
In a new post to DZone.com <i>Giorgio Sironi</i> talks about the "open/closed principle" in software development and shows an example based on the design of the <a href="https://github.com/giorgiosironi/phpunit-selenium">PHPUnit_Selenium</a> project.
</p>
<blockquote>
This article shows an example of how the application of the Open/Closed Principle improved the design of a real project, the open source library <a href="https://github.com/giorgiosironi/phpunit-selenium">PHPUnit_Selenium</a>. These design concepts apply to every object-oriented language, including Java, Ruby or even C++. The <a href="http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod">Open Closed Principle</a>, part of SOLID set, states that software should be open for extension and at the same time closed for modification.
</blockquote>
<p>
He starts with a little background on the project, pointing out that there's a Session object it uses for all of its testing with a magic "__call" method that handles any kind of method call to the object. This method has issues (dependencies, strict requirements for use) but can be refactored according to the Open/Closed idea to set up an array of anonymous functions that can be called as a "command". Examples of these types of classes are also included (one for the "click" action on a button and another for getting the current location).
</p>]]></description>
      <pubDate>Fri, 13 Jan 2012 09:05:53 -0600</pubDate>
    </item>
  </channel>
</rss>
