<?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 17:34:41 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DZone.com: The Duck is a Lie]]></title>
      <guid>http://www.phpdeveloper.org/news/18144</guid>
      <link>http://www.phpdeveloper.org/news/18144</link>
      <description><![CDATA[<p>
In <a href="http://css.dzone.com/articles/duck-lie">this recent post</a> to DZone.com <i>Giorgio Sironi</i> looks at duck typing and compares it in a few different languages (PHP, Ruby and Java). "Duck typing" is where the methods/functions define the structure or common interface rather than being functional.
</p>
<blockquote>
What follows is my experience with Java, PHP and Ruby. I mainly use PHP as a dynamic language that supports duck typing but also the definition of Java-like interfaces, but does not force any of the two approaches as you can define interfaces whose method arguments accept any variable or not using interfaces at all. Is duck typing that a revolution?
</blockquote>
<p>
He shares some of the common misconceptions he's seen including the idea that duck typing can help completely different objects work together and that, sometimes, despite naming conventions, functionality was intended to be different. He shows how even interfaces in PHP can be implemented loosely and the "acts as" and "single callback" architecture ideas.
</p>]]></description>
      <pubDate>Wed, 27 Jun 2012 09:55:22 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP 10.0 Blog: duck operator]]></title>
      <guid>http://www.phpdeveloper.org/news/10352</guid>
      <link>http://www.phpdeveloper.org/news/10352</link>
      <description><![CDATA[<p>
In <a href="http://php100.wordpress.com/2008/06/05/duck-operator/">this new post</a> to the PHP 10.0 blog today, <i>Stas</i> talks about <a href="http://en.wikipedia.org/wiki/Duck_typing">duck typing</a>, a method that lets the code decide the functionality to use rather than a direct relation to a parent.
</p>
<blockquote>
Well, if you are into <a href="http://en.wikipedia.org/wiki/Duck_typing">duck typing</a> style of programming, it may be interesting for you to have an object that implements certain set of functions, but not necessary declares it at class definition. Languages like Smalltalk do it all day along, so why PHP couldn't?
</blockquote>
<p>
His example defines an interface Cow and a class MooingGrassEater and a function, CowConsumer, that does the work. A classname is passed in and an instance of that class is checked with "implements" rather than "instanceof" to see if it uses the Cow interface. He points out a place where PHP itself uses something similar in <a href="http://php.net/manual/en/function.stream-wrapper-register.php">user defined streams</a>.
</p>]]></description>
      <pubDate>Thu, 05 Jun 2008 14:36:31 -0500</pubDate>
    </item>
  </channel>
</rss>
