<?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>Thu, 23 May 2013 01:01:34 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[The Coders Lexicon: My Love / Hate Relationship With PHP Traits]]></title>
      <guid>http://www.phpdeveloper.org/news/19165</guid>
      <link>http://www.phpdeveloper.org/news/19165</link>
      <description><![CDATA[<p>
On the Coder's Lexicon site, there's a recent post talking about the author's <a href="http://www.coderslexicon.com/my-love-hate-relationship-with-php-traits/">love/hate relationship with PHP traits</a>, a relatively new feature of the language that apps for more "drop-in" functionality similar to mixins in other languages.
</p>
<blockquote>
When I saw the introduction of PHP traits in 5.4.0 I was eager to learn all about them and how they worked. [...] PHP traits, in my opinion, are handy and very flexible. I guess that is the "love" part of my relationship with them. [...] However, I feel that traits also meddle with a bit of the inheritance rules that have been proven time and time again. Is it possible to love as well as hate something at the same time?
</blockquote>
<p>
He talks first about "the love" he feels for using traits in his code. He talks about their usefulness for geting around PHP's single inheritance structure and being able to "bolt on" functionality as needed. Then comes "the hate" of them, noting that in the wrong hands, they could lead to very messy and lazy coding practices (including the <a href="http://en.wikipedia.org/wiki/Deadly_Diamond_of_Death#The_diamond_problem">deadly diamond of death</a> problem).
</p>]]></description>
      <pubDate>Mon, 11 Feb 2013 12:50:45 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Under the Hood of Yii's Component Architecture, Part 3]]></title>
      <guid>http://www.phpdeveloper.org/news/17537</guid>
      <link>http://www.phpdeveloper.org/news/17537</link>
      <description><![CDATA[<p>
PHPMaster.com is back with the <a href="http://phpmaster.com/under-the-hood-of-yii%E2%80%99s-component-architecture-part-3/">third part of their series</a> looking at the internals of the Yii framework (specifically, its components). In this latest article <i>Steven O'Brien</i> focuses on how the framework uses behaviors.
</p>
<blockquote>
A behavior, as it is called in Yii, is a manner of combining objects at runtime to extend an object's functionality. Behaviors are an excellent way to decouple code and keep ever expanding systems maintainable. [...] We can not reuse our code effectively because PHP doesn't support multiple inheritance. The Yii behavior system is a way of achieving multiple inheritance by implementing <a href="http://en.wikipedia.org/wiki/Mixin">mixins</a>.
</blockquote>
<p>
He gives an example of working with a user that's connecting to your application just to get to a third-party billing system. They show how to take this functionality our of your generic "User" class and make a behavior out of it. This functionality can then be attached to the User object (via an attachBehavior call) and used directly. He gets into how Yii does this magic, showing how it appends it to a special value in the class and the __call method checks the method call to see if it exists in one of these special classes.
</p>]]></description>
      <pubDate>Tue, 14 Feb 2012 09:28:34 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[RubySource.com: PHP to Ruby: Modules, Mixins and Ducks]]></title>
      <guid>http://www.phpdeveloper.org/news/16722</guid>
      <link>http://www.phpdeveloper.org/news/16722</link>
      <description><![CDATA[<p>
In his latest article comparing some of the functionality of PHP to Ruby, <i>Dave Kennedy</i> looks at <a href="http://rubysource.com/php-to-ruby-modules-mixins-and-ducks/">modules, mixins and ducks</a> and how they compare to PHP's interfaces and abstract classes.
</p>
<blockquote>
If you have been writing PHP for a few years you will no doubt have come across Interfaces and Abstract classes. They were introduced in PHP5 object model and since have had medium usage in the PHP world. If you Google "PHP Interfaces" you will get some results on the official documentation and the rest saying how pointless they are. Why the divide? I believe it is mainly down to lack of understanding to what interfaces give you. They imply what your classes should do, but that's it. Yep, we are talking programming contracts.
</blockquote>
<p>
He starts with some code examples of an interface and a class that implements it (to work with PDFs). He makes an abstract class to extend the functionality even further and allow for different kinds of reporting PDFs to be generated. From there he moves into the Ruby world, showing examples of duck typing and modules to avoid duplication (mixins).
</p>]]></description>
      <pubDate>Tue, 16 Aug 2011 09:11:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ActsAsFlinn Blog:  PHP and ActiveRecord (continued)]]></title>
      <guid>http://www.phpdeveloper.org/news/8441</guid>
      <link>http://www.phpdeveloper.org/news/8441</link>
      <description><![CDATA[<p>
In a response to <a href="http://www.phpdeveloper.org/news/8427">a response</a> (from <i>Arnold Daniels</i>) on his <a href="http://www.phpdeveloper.org/news/8418">article on the ActiveRecord</a> pattern in PHP, <i>Flinn Mueller</i> has come back once again with <a href="http://www.actsasflinn.com/articles/2007/08/10/php-and-activerecord-continued">more comments</a>, both in response and to share some more opinion on the matter.
</p>
<blockquote>
Today I saw a big traffic increase from my <a href="http://www.actsasflinn.com/articles/2007/08/08/php-and-activerecord">PHP and ActiveRecord</a> post. It looks like PHPDeveloper posted a link to the article and response, so I've written a response to the <a href="http://blog.adaniels.nl/?p=40">Arnold's wor(l)ds response post</a>. Arnold's post is insightful, references runkit and has a good implementation of a Sortable tasklist example in PHP.
</blockquote>
<p>
<i>Flinn</i> breaks it out into a few different topics - things like:
<ul>
<li>Ruby objects are (native) Ruby objects
<li>a brief look at "lineage" for both PHP and Ruby
<li>The usefulness of Ruby mix-ins
<li>Issues with static inheritance in PHP
<li>and some of his suggestions on what PHP6 really needs
</ul>
</p>]]></description>
      <pubDate>Mon, 13 Aug 2007 15:35:00 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ivo Jansch's Blog: Mixins in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/6139</guid>
      <link>http://www.phpdeveloper.org/news/6139</link>
      <description><![CDATA[<p>
In <a href="http://www.achievo.org/blog/archives/46-Mixins-in-PHP.html">his latest post</a> today, <i>Ivo Jansch</i> talks about a concpt from Ruby that he likes and wanted to try to implment in PHP - mixins.
</p>
<blockquote>
Mixins are a way of 'mixing in' functionality of other classes. A kind of 'multiple inheritance' like approach, only without actual inheritance. It is similar to interfaces, but interfaces only tell you that an object must implement certain methods, whereas mixins also provide an implementation.
</blockquote>
<p>
To help clear it up a bit he links to <a href="http://c2.com/cgi/wiki?MixIn">two</a> <a href="http://www.rubycentral.com/book/tut_modules.html">articles</a> on the topic. He gives some examples, though, of how it all works by creating a mixin class (Alertable) and the wy to apply it (in the Hello class). The key between the two is the Object class he's created. It allows the two other classes to work with each other without the need for cumbersome includes or passing around objects. All methods are magically available to the Hello object.
</p>
<p>
Of course, it's not a perfect implementation because PHP just can't do some things, but he <a href="http://www.achievo.org/blog/archives/46-Mixins-in-PHP.html">includes a few</a> of these things to watch out for in using this method.
</p>]]></description>
      <pubDate>Fri, 25 Aug 2006 08:02:33 -0500</pubDate>
    </item>
  </channel>
</rss>
