<?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 14:03:57 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Reusing Implementation - a Walk-through of Inheritance, Composition, and Delegation]]></title>
      <guid>http://www.phpdeveloper.org/news/18229</guid>
      <link>http://www.phpdeveloper.org/news/18229</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new tutorial posted that wants to <a href="http://phpmaster.com/reusing-implementation-a-walk-through-of-inheritance-composition-and-delegation/">provide a guide</a> to walk you through a trio of ideas to help with code/idea reuse in your applications - inheritance, composition and delegation.
</p>
<blockquote>
The popular belief is that reusing implementation, thus producing DRYer code, boils down to exploiting the benefits that Inheritance provides, right? Well, I wish it was that easy! [...] If you don't know what path to travel when it comes to reusing implementation, in this article I'll be doing a humble walk-through on the Inheritance/Composition/Delegation trio in an attempt to showcase, side by side, some of their most appealing virtues and clunky drawbacks.
</blockquote>
<p>
He starts off with a look at Inheritance, showing with a small code sample showing the creation of an interface and a resulting PDO adapter class implementing it. He also shows the concept of composition, following the ideas of the <a href="http://en.wikipedia.org/wiki/Adapter_pattern">Adapter pattern</a>. In his Delegation example he shows how to implement the creation of the connection object as a part of the class' creation.
</p>]]></description>
      <pubDate>Mon, 16 Jul 2012 11:42:54 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney's Blog: Using Action Helpers To Implement Re-Usable Widgets]]></title>
      <guid>http://www.phpdeveloper.org/news/15229</guid>
      <link>http://www.phpdeveloper.org/news/15229</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> has a new post to his blog today showing you how to use <a href="http://weierophinney.net/matthew/archives/246-Using-Action-Helpers-To-Implement-Re-Usable-Widgets.html">action helpers to make widgets</a> that you can reuse all over your Zend Framework application. His method doesn't use the "action()" helper, either.
</p>
<blockquote>
The situation all started when <a href="http://twitter.com/andriesss">Andries</a> tweeted asking about what he considered some mis-behavior on the part of the action() view helper -- a situation that turned out not to be an issue, per se, but more a case of bad architecture within Zend Framework. [...] The helper was done this way because Zend Framework does not render views a single time -- it instead renders after each action, and accumulates views to render in the layout.
</blockquote>
<p>
Instead, he offers <a href="http://weierophinney.net/matthew/archives/233-Responding-to-Different-Content-Types-in-RESTful-ZF-Apps.html">action</a> <a href="http://weierophinney.net/matthew/archives/235-A-Simple-Resource-Injector-for-ZF-Action-Controllers.html">helpers</a> as a solution. He gives an example of a user module that has views, helpers and forms but no controllers, including a Bootstrap file. This bootstrap defines the helpers, configuration file and adds the helpers into the process flow of the application. Once things are all set up and the action helper is created, adding the module to a page is as easy as calling "createProfileWidget()" into a partial view.
</p>]]></description>
      <pubDate>Tue, 05 Oct 2010 09:12:19 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lukas Smith's Blog: Horizontal Reuse aka Traits Reloaded]]></title>
      <guid>http://www.phpdeveloper.org/news/14254</guid>
      <link>http://www.phpdeveloper.org/news/14254</link>
      <description><![CDATA[<p>
In a quick post to his blog <i>Lukas Smith</i> talks about the <a href="http://pooteeweet.org/blog/0/1717#m1717">proposal for traits support</a> that's been pending for PHP for a while now. Recent updates have been made to it, so it's come back up to the front of developer's minds:
</p>
<blockquote>
Stefan has since <a href="http://wiki.php.net/rfc/nonbreakabletraits">tweaked</a> the proposal and in the <a href="http://wiki.php.net/rfc/horizontalreuse">latest version</a> it includes an alternative approach called Grafts along with the original Traits idea, which is essentially language level delegation pattern support. I am absolutely sure that we will either see Traits or Grafts in the next non patch release of PHP (aka 5.4 or 6.0). 
</blockquote>
<p>
<i>Lukas</i> would like to see the support go in sooner than later, so he requests some comments and thoughts on <a href="http://wiki.php.net/rfc/horizontalreuse">the proposed functionality</a> and to leave them as comments on his blog entry.
</p>]]></description>
      <pubDate>Fri, 26 Mar 2010 10:38:14 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: PHPUnit 3.4.0 (Release)]]></title>
      <guid>http://www.phpdeveloper.org/news/13241</guid>
      <link>http://www.phpdeveloper.org/news/13241</link>
      <description><![CDATA[<p>
<i>Sebastian Bergmann</i> <a href="http://sebastian-bergmann.de/archives/873-PHPUnit-3.4.0.html">has announced</a> the release of the latest version of the popular PHP unit testing software - <a href="http://phpunit.de">PHPUnit</a>.
</p>
<blockquote>
Among the features introduced in this new version, the most notable are the support for <a href="http://sebastian-bergmann.de/archives/826-Test-Dependencies-in-PHPUnit-3.4.html">test dependencies</a> and <a href="http://sebastian-bergmann.de/archives/848-Fixture-Reuse-in-PHPUnit-3.4.html">fixture reuse</a> as well as the possibility to run tests in separate PHP processes for increased test isolation. Please have a look at the <a href="http://www.phpunit.de/wiki/ChangeLog34">ChangeLog</a> for a complete list of changes.
</blockquote>
<p>
As a teaser, he also mentions the work being done on the <a href="http://github.com/sebastianbergmann/php-code-coverage">code coverage features</a> that will be included in the next release.
</p>]]></description>
      <pubDate>Thu, 17 Sep 2009 11:32:36 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: Reusable "generic" actions in Zend Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/11629</guid>
      <link>http://www.phpdeveloper.org/news/11629</link>
      <description><![CDATA[<p>
In <a href="http://codeutopia.net/blog/2008/12/27/reusable-generic-actions-in-zend-framework/">this recent blog entry</a> <i>Jani Hartikainen</i> looks at the creation of generic actions for Zend Framework applications - methods that can be used to help eliminate code duplication:
</p>
<blockquote>
Sometimes you will need nearly the same functionality in many actions. [...] There are several ways to deal with this, such as moving the code into a separate function, or an action helper. But in this post, I'm going to introduce so called "generic actions" - parametrized, easy to reuse actions - which is an idea similar to <a href="http://docs.djangoproject.com/en/dev/ref/generic-views/">django generic views</a>.
</blockquote>
<p>
His example takes a generic action - one that grabs and output records from a table - and modifies it to take in parameters from the defining function as to which action/controller/model and ID to use. Then this action can be used over and over in multiple places without having to do any copy and paste coding. 
</p>]]></description>
      <pubDate>Mon, 29 Dec 2008 07:55:13 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Keeping Superglobals Out Of Classes]]></title>
      <guid>http://www.phpdeveloper.org/news/11521</guid>
      <link>http://www.phpdeveloper.org/news/11521</link>
      <description><![CDATA[<p>
In a <a href="http://www.brandonsavage.net/entry/keeping-superglobals-out-of-classes.html">new post</a> to his blog, <i>Brandon Savage</i> makes a suggestion that could help in maintenance and debugging down the road - keep those superglobals out of your classes.
</p>
<blockquote>
Let's ignore the security implications of the above code for just a moment, and focus on just the use of the superglobal. By using the $_POST superglobal array, we're effectively doing two things [in the example code]: relying on the field names and limiting code reuse.
</blockquote>
<p>
He shows how to refactor the example into something a bit more reusable by changing the method call to pass in the given username and password instead of looking to the global for it. He does note, however, that there are some more correct uses for those superglobals:
</p>
<blockquote>
There are some legitimate uses of superglobals in classes. One example is the use of the $_SESSION superglobal, which is often used for things like a user object. But I urge you to do so sparingly, when appropriate, rather than relying heavily on superglobals which are subject to change and may not give you the data you expect.
</blockquote>]]></description>
      <pubDate>Mon, 08 Dec 2008 07:57:24 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Mutant PHP Blog: Specifications for PHP5]]></title>
      <guid>http://www.phpdeveloper.org/news/11117</guid>
      <link>http://www.phpdeveloper.org/news/11117</link>
      <description><![CDATA[<p>
In a <a href="http://mutantphp.org/blog/2008/09/25/specifications-for-php5/">recent entry</a> to his blog <i>Sean</i> shows off a new <a href="http://mutantphp.org/blog/wp-content/downloads/Specifications.zip">specifications library</a> he's created to replace common comparison functionality with a series of specs.
</p>
<blockquote>
I thought I'd share a PHP library implementing <a href="http://martinfowler.com/apsupp/spec.pdf">this</a> idea by Evans and Fowler. Written for PHP5, it's a library for defining custom specifications using composition and inheritance.
</blockquote>
<p>
He gives the example of "Person" objects with name and age properties. A search might involve looking directly at the properties to location one that's, say, younger than 35 and has a last name of Johnson. His specification class replaces this and makes it more reusable by applying things like GreaterOrEqualSpecifications and EqualSpecifications to standardize the evaluation. Then its just a quick call to the isSatisfiedBy method to check for correctness.
</p>]]></description>
      <pubDate>Tue, 30 Sep 2008 11:17:47 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Maarten Balliauw's Blog: Reuse Excel business logic with PHPExcel]]></title>
      <guid>http://www.phpdeveloper.org/news/10115</guid>
      <link>http://www.phpdeveloper.org/news/10115</link>
      <description><![CDATA[<p>
<i>Maarten Balliauw</i> has <a href="http://blog.maartenballiauw.be/post/2008/03/Reuse-Excel-business-logic-with-PHPExcel.aspx">made a new blog post</a> today about a method he's using to help reuse some of the business logic that Excel spreadsheets can have in a PHP script with help from <a href="http://www.codeplex.com/PHPExcel">PHPExcel</a>.
</p>
<blockquote>
In many companies, business logic resides in Excel. This business logic is sometimes created by business analysts and sometimes by business users who want to automate parts of their everyday job using Excel. [...] Did you know you can use PHPExcel to take advantage of the Excel-based business logic without having to worry about duplicate business logic?
</blockquote>
<p>
He creates a <a href="http://examples.maartenballiauw.be/phpexcel4business/phpexcel4business.zip">quick example</a> of a script that can take in an Excal file and pull it into a PHPExcel object, ready for manipulation. He fills in values for the already defined fields (like "carColor" or "leatherSeats") and uses the getCalculatedValue method to perform the action on the cell. The output is dropped into a variable that can be echoed out or used later on in the PHP script.
</p>]]></description>
      <pubDate>Tue, 06 May 2008 07:51:38 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Developer Tutorials Blog: Zend Framework: The Best Framework for Use With Other Frameworks]]></title>
      <guid>http://www.phpdeveloper.org/news/9717</guid>
      <link>http://www.phpdeveloper.org/news/9717</link>
      <description><![CDATA[<p>
The Developer Tutorials blog has an <a href="http://www.developertutorials.com/blog/php/zend-framework-use-with-other-frameworks-56/">interesting perspective</a> on the whole framework front today - use whatever framework you choose, but be sure to "add a little Zend" when you need it.
</p>
<blockquote>
The Zend Framework is a fairly standard, (optionally) MVC PHP application framework. It comes with all the usual functionality; request routing, database access, templates (through view files) etc. [...] But here's the kicker: it works entirely standalone. The classes and their methods can, generally, be used statically in any context, or at least independently of the framework.
</blockquote>
<p>
They <a href="http://www.developertutorials.com/blog/php/zend-framework-use-with-other-frameworks-56/">point out</a> that the components of the Zend Framework, while able to happily live in their self-contained MVC bubble, can also break "out of the box" and live their own happy, separate lives. He even points out <a href="http://thislab.com/2008/02/21/using-zend-framework-with-codeigniter/">another blog entry</a> looking at using the Zend Framework right along side CodeIgniter in a web application.
</p>]]></description>
      <pubDate>Thu, 28 Feb 2008 08:47:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Nick Halstead's Blog: Programming Tips Series]]></title>
      <guid>http://www.phpdeveloper.org/news/9008</guid>
      <link>http://www.phpdeveloper.org/news/9008</link>
      <description><![CDATA[<p>
<i>Nick Halsted</i> has posted the first two in a series of programming tips, not necessarily specific to PHP, but still very useful.
</p>
<blockquote>
Over the years I have built up what I call my 'programming wisdom' this is what has replaced my early years of supposed 'raw talent'. [...] So I thought to myself what have I learnt that I can put across that will be useful to my fellow programmers who have not made all the mistakes I have. I plan on writing a long series of programming tips over the coming weeks (disturbed only by solicitors, investors and other scary programming time eating monsters).
</blockquote>
<p>
The first two of the series are:
</p>
<ul>
<li><a href="http://feeds.feedburner.com/~r/assembleron/~3/180749130/">Don't Repeat Yourself</a> - make reusable code to save you time in the long run.
<li><a href="http://feeds.feedburner.com/~r/assembleron/~3/181550209/">Test, test, test</a> - finding bugs in software before it's too late.
</ul>]]></description>
      <pubDate>Fri, 09 Nov 2007 09:38:00 -0600</pubDate>
    </item>
  </channel>
</rss>
