<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Tip: Classes Aren&#8217;t Derived From stdClass</title>
	<atom:link href="http://www.otton.org/2008/11/11/php-base-class-stdclass/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/</link>
	<description>Look! Bunnies!</description>
	<lastBuildDate>Wed, 08 Sep 2010 15:09:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Michael Anderson</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-24758</link>
		<dc:creator>Michael Anderson</dc:creator>
		<pubDate>Wed, 22 Apr 2009 01:38:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-24758</guid>
		<description>A concrete example of Janis comment.

abstract class Base
{
  abstract function foo();
}

class DerivedA extends Base
{
   function foo() { print &quot;In A foo()\n&quot;; }
}

class DerivedB extends Base
{
   function foo() { print &quot;In B foo()\n&quot;; }
}

function do_foo( $obj )
{
   if( ! is_subclass_of( $obj, &#039;Base&#039; ) )
   {
      throw new Something();
   }
   $obj-&gt;foo();
}</description>
		<content:encoded><![CDATA[<p>A concrete example of Janis comment.</p>
<p>abstract class Base<br />
{<br />
  abstract function foo();<br />
}</p>
<p>class DerivedA extends Base<br />
{<br />
   function foo() { print &#8220;In A foo()\n&#8221;; }<br />
}</p>
<p>class DerivedB extends Base<br />
{<br />
   function foo() { print &#8220;In B foo()\n&#8221;; }<br />
}</p>
<p>function do_foo( $obj )<br />
{<br />
   if( ! is_subclass_of( $obj, &#8216;Base&#8217; ) )<br />
   {<br />
      throw new Something();<br />
   }<br />
   $obj-&gt;foo();<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Base classes in OOP programming languages &#124; CodeUtopia</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4939</link>
		<dc:creator>Base classes in OOP programming languages &#124; CodeUtopia</dc:creator>
		<pubDate>Wed, 19 Nov 2008 14:21:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4939</guid>
		<description>[...] Otton posted a short but thought-provoking post about stdClass, which many think is the &#8220;base class&#8221; all PHP classes automatically inherit from. I [...]</description>
		<content:encoded><![CDATA[<p>[...] Otton posted a short but thought-provoking post about stdClass, which many think is the &#8220;base class&#8221; all PHP classes automatically inherit from. I [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jani Hartikainen</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4935</link>
		<dc:creator>Jani Hartikainen</dc:creator>
		<pubDate>Tue, 18 Nov 2008 13:33:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4935</guid>
		<description>I fail to see how lack of the explicit casting syntax makes polymorphism or interfaces a waste of time. You can still put an interface as the type hint for a method, or check if an object implements an interface and use the object like you would use the interface.

Sure, you could ignore the fact that you&#039;re supposed to use the interface in this case, and use the object&#039;s other methods, but that&#039;s just you being ignorant.</description>
		<content:encoded><![CDATA[<p>I fail to see how lack of the explicit casting syntax makes polymorphism or interfaces a waste of time. You can still put an interface as the type hint for a method, or check if an object implements an interface and use the object like you would use the interface.</p>
<p>Sure, you could ignore the fact that you&#8217;re supposed to use the interface in this case, and use the object&#8217;s other methods, but that&#8217;s just you being ignorant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Kimsal</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4931</link>
		<dc:creator>Mark Kimsal</dc:creator>
		<pubDate>Mon, 17 Nov 2008 00:14:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4931</guid>
		<description>Yet another reason that I don&#039;t consider PHP to be truely OOP (stress on the &#039;oriented&#039; part).

Yes, it has support for objects.  Yes, it has support for PPP access, but it doesn&#039;t have casting:

$b = new Foo();
$a = (Foo)$b;

Casting to a specific object class generates a syntax error.  This completely removes the OOP tenant of &quot;polymorphism&quot; off the table.  It also makes Interfaces a waste of time in PHP.  These aren&#039;t necessarily bad things if you consider PHP to be it&#039;s own unique language.  But if you&#039;re going to jump on the OOP bandwagon, at least get all the way on it.

Still, in the 4 branch, objects without defined member variables equal null (but they don&#039;t === null).  I point this out because it should never have happened in a language where objects are &quot;first class citizens&quot;.

I won&#039;t go into the problems with mixing static and non-static contexts. 

It seems to me that if you don&#039;t think about objects the same way that the developers of PHP do (and it doesn&#039;t appear that they think about OOP even close to any other modern language), you are SOL.</description>
		<content:encoded><![CDATA[<p>Yet another reason that I don&#8217;t consider PHP to be truely OOP (stress on the &#8216;oriented&#8217; part).</p>
<p>Yes, it has support for objects.  Yes, it has support for PPP access, but it doesn&#8217;t have casting:</p>
<p>$b = new Foo();<br />
$a = (Foo)$b;</p>
<p>Casting to a specific object class generates a syntax error.  This completely removes the OOP tenant of &#8220;polymorphism&#8221; off the table.  It also makes Interfaces a waste of time in PHP.  These aren&#8217;t necessarily bad things if you consider PHP to be it&#8217;s own unique language.  But if you&#8217;re going to jump on the OOP bandwagon, at least get all the way on it.</p>
<p>Still, in the 4 branch, objects without defined member variables equal null (but they don&#8217;t === null).  I point this out because it should never have happened in a language where objects are &#8220;first class citizens&#8221;.</p>
<p>I won&#8217;t go into the problems with mixing static and non-static contexts. </p>
<p>It seems to me that if you don&#8217;t think about objects the same way that the developers of PHP do (and it doesn&#8217;t appear that they think about OOP even close to any other modern language), you are SOL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Kimsal</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4930</link>
		<dc:creator>Mark Kimsal</dc:creator>
		<pubDate>Sun, 16 Nov 2008 23:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4930</guid>
		<description>Code from above comment:

php -r &#039;var_dump((object)1 instanceof stdClass);&#039;</description>
		<content:encoded><![CDATA[<p>Code from above comment:</p>
<p>php -r &#8216;var_dump((object)1 instanceof stdClass);&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Kimsal</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4929</link>
		<dc:creator>Mark Kimsal</dc:creator>
		<pubDate>Sun, 16 Nov 2008 23:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4929</guid>
		<description>Very strange that anyone would think this.  The stdClass is really only used for unit testing Zend Engine bugs.

What&#039;s even weirder is that the follow is true

</description>
		<content:encoded><![CDATA[<p>Very strange that anyone would think this.  The stdClass is really only used for unit testing Zend Engine bugs.</p>
<p>What&#8217;s even weirder is that the follow is true</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brenton Alker</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4928</link>
		<dc:creator>Brenton Alker</dc:creator>
		<pubDate>Sun, 16 Nov 2008 23:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4928</guid>
		<description>@Will The point is that if you don&#039;t explicitly extend stdClass in php it isn&#039;t done implicitly. If you were to perform the equivalent test in Java, Ruby or .NET (as mentioned in the post) both instanceofs would yield a true, as all classes implicitly extend the base class.</description>
		<content:encoded><![CDATA[<p>@Will The point is that if you don&#8217;t explicitly extend stdClass in php it isn&#8217;t done implicitly. If you were to perform the equivalent test in Java, Ruby or .NET (as mentioned in the post) both instanceofs would yield a true, as all classes implicitly extend the base class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Titcumb &#187; Blog Archive &#187; stdClass is NOT the PHP Base Class!!!</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4924</link>
		<dc:creator>James Titcumb &#187; Blog Archive &#187; stdClass is NOT the PHP Base Class!!!</dc:creator>
		<pubDate>Fri, 14 Nov 2008 10:20:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4924</guid>
		<description>[...] posted this a few days ago, inspired by David Otton&#8217;s post on this topic. A chap called Will commented about it, and after doing a quick Google, I got angry [...]</description>
		<content:encoded><![CDATA[<p>[...] posted this a few days ago, inspired by David Otton&#8217;s post on this topic. A chap called Will commented about it, and after doing a quick Google, I got angry [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4923</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Fri, 14 Nov 2008 09:20:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4923</guid>
		<description>Sorry, but I am unsure of your example.  By extending the stdClass and instantiating the resultant construct, a var_dump call with the object returns true, whereas without extending it, var_dump returns false... why?</description>
		<content:encoded><![CDATA[<p>Sorry, but I am unsure of your example.  By extending the stdClass and instantiating the resultant construct, a var_dump call with the object returns true, whereas without extending it, var_dump returns false&#8230; why?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asgrim &#187; Blog Archive &#187; PHP Base Classes</title>
		<link>http://www.otton.org/2008/11/11/php-base-class-stdclass/comment-page-1/#comment-4916</link>
		<dc:creator>Asgrim &#187; Blog Archive &#187; PHP Base Classes</dc:creator>
		<pubDate>Tue, 11 Nov 2008 19:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.otton.org/?p=324#comment-4916</guid>
		<description>[...] David Otton points out, PHP is different from most other OO languages such as Java, or even Delphi, in the fact that most [...]</description>
		<content:encoded><![CDATA[<p>[...] David Otton points out, PHP is different from most other OO languages such as Java, or even Delphi, in the fact that most [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
