<?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: Stop including class files and use __autoload() instead</title>
	<atom:link href="http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/</link>
	<description>A blog about killer code</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:11:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: San Diego Therapist</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-1245</link>
		<dc:creator>San Diego Therapist</dc:creator>
		<pubDate>Sun, 04 Apr 2010 07:21:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-1245</guid>
		<description>Wow...this really works well.  No more require or includes of object classes and the memory savings is great!

Thanks!</description>
		<content:encoded><![CDATA[<p>Wow&#8230;this really works well.  No more require or includes of object classes and the memory savings is great!</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Les</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-620</link>
		<dc:creator>Les</dc:creator>
		<pubDate>Thu, 02 Jul 2009 14:58:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-620</guid>
		<description>Marc

You use lower case characters not because of __autoload(); but purely because it&#039;s stable across platforms and increases portability.

It&#039;s also a convention, a best practice so go with it, rather than chop and change as you see fit (if that&#039;s what your doing).</description>
		<content:encoded><![CDATA[<p>Marc</p>
<p>You use lower case characters not because of __autoload(); but purely because it&#8217;s stable across platforms and increases portability.</p>
<p>It&#8217;s also a convention, a best practice so go with it, rather than chop and change as you see fit (if that&#8217;s what your doing).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Mescalchin</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-223</link>
		<dc:creator>Peter Mescalchin</dc:creator>
		<pubDate>Fri, 04 Jul 2008 08:16:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-223</guid>
		<description>@jaisen: I remember reading similar reports with APC. With eAccelerator at least hits are certainly made to the bytecode cache when using this method after checking its stats.

I think the issue with APC might be to do with paths to scripts being relative, rather than absolute, which would be a problem __autoload() or not. The autoload wrapper I use uses a full path from the root of the file system - so maybe that&#039;s why I am having success?</description>
		<content:encoded><![CDATA[<p>@jaisen: I remember reading similar reports with APC. With eAccelerator at least hits are certainly made to the bytecode cache when using this method after checking its stats.</p>
<p>I think the issue with APC might be to do with paths to scripts being relative, rather than absolute, which would be a problem __autoload() or not. The autoload wrapper I use uses a full path from the root of the file system &#8211; so maybe that&#8217;s why I am having success?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jaisen</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-222</link>
		<dc:creator>jaisen</dc:creator>
		<pubDate>Fri, 04 Jul 2008 06:23:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-222</guid>
		<description>@Mike, While I see troelskn&#039;s point...I&#039;m going to have to agree with you on this one.  The points he brings up are extremely valid but I don&#039;t think this specific case is the best example of when the case insensitivity of PHP can &quot;taken advantage of&quot;.</description>
		<content:encoded><![CDATA[<p>@Mike, While I see troelskn&#8217;s point&#8230;I&#8217;m going to have to agree with you on this one.  The points he brings up are extremely valid but I don&#8217;t think this specific case is the best example of when the case insensitivity of PHP can &#8220;taken advantage of&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jaisen</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-221</link>
		<dc:creator>jaisen</dc:creator>
		<pubDate>Fri, 04 Jul 2008 06:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-221</guid>
		<description>@Peter, I know internally here at Yahoo there&#039;s been some discussion on times when apc does not cache require/include calls.  I don&#039;t want to speak out of ignorance because I can&#039;t remember the specifics but I  thought it had to do with dynamically created paths.  I want to find out for sure...I&#039;m sure it&#039;ll be another blog post of it&#039;s own as that&#039;s a very important behavior to understand.</description>
		<content:encoded><![CDATA[<p>@Peter, I know internally here at Yahoo there&#8217;s been some discussion on times when apc does not cache require/include calls.  I don&#8217;t want to speak out of ignorance because I can&#8217;t remember the specifics but I  thought it had to do with dynamically created paths.  I want to find out for sure&#8230;I&#8217;m sure it&#8217;ll be another blog post of it&#8217;s own as that&#8217;s a very important behavior to understand.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Mescalchin</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-219</link>
		<dc:creator>Peter Mescalchin</dc:creator>
		<pubDate>Thu, 03 Jul 2008 11:24:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-219</guid>
		<description>@wesley - __autoload() doesn&#039;t do the require/include itself, you need to define the function - which in most cases will wrap a require/include call - so to answer your question, yes APC/eAccelerator will still function - its still require/include under the covers.

Another great thing with __autoload() it works with &#039;extends&#039;... e.g.


class myclass extends baseclass {}


__autoload() will be called for both &#039;myclass&#039; and &#039;baseclass&#039;.

I do a similar system to &quot;troelskn/PEAR&quot;, using underscores to name my classes, then breaking that down into subfolders in my class folder. One file per class works really well for me. __autoload() is a godsend.</description>
		<content:encoded><![CDATA[<p>@wesley &#8211; __autoload() doesn&#8217;t do the require/include itself, you need to define the function &#8211; which in most cases will wrap a require/include call &#8211; so to answer your question, yes APC/eAccelerator will still function &#8211; its still require/include under the covers.</p>
<p>Another great thing with __autoload() it works with &#8216;extends&#8217;&#8230; e.g.</p>
<p>class myclass extends baseclass {}</p>
<p>__autoload() will be called for both &#8216;myclass&#8217; and &#8216;baseclass&#8217;.</p>
<p>I do a similar system to &#8220;troelskn/PEAR&#8221;, using underscores to name my classes, then breaking that down into subfolders in my class folder. One file per class works really well for me. __autoload() is a godsend.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Cubes</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-218</link>
		<dc:creator>Mike Cubes</dc:creator>
		<pubDate>Wed, 02 Jul 2008 19:55:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-218</guid>
		<description>@troelskn Just because it is valid PHP to write a class name in whatever case you want to at the time, doesn&#039;t mean it is a good idea. Writing all your code under the assumption that the language and the OS are both case-sensitive is a great way to have maintainable, portable, well written code. Yes, I know that PHP is case-insensitive, but that doesn&#039;t mean we as developers have to be. Defining MyClass, then using myClass looks amateur and doesn&#039;t follow a consistent pattern. The hack of running strtolower() inside of __autoload() to account for lazy programmers seams like a waste of a function call to me.</description>
		<content:encoded><![CDATA[<p>@troelskn Just because it is valid PHP to write a class name in whatever case you want to at the time, doesn&#8217;t mean it is a good idea. Writing all your code under the assumption that the language and the OS are both case-sensitive is a great way to have maintainable, portable, well written code. Yes, I know that PHP is case-insensitive, but that doesn&#8217;t mean we as developers have to be. Defining MyClass, then using myClass looks amateur and doesn&#8217;t follow a consistent pattern. The hack of running strtolower() inside of __autoload() to account for lazy programmers seams like a waste of a function call to me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wesley</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-216</link>
		<dc:creator>wesley</dc:creator>
		<pubDate>Wed, 02 Jul 2008 16:51:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-216</guid>
		<description>What about APC and others, will they still be able to optimize/cache php requests equally well as when you use require?</description>
		<content:encoded><![CDATA[<p>What about APC and others, will they still be able to optimize/cache php requests equally well as when you use require?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jasper</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-214</link>
		<dc:creator>Jasper</dc:creator>
		<pubDate>Sat, 28 Jun 2008 22:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-214</guid>
		<description>I love the autoload function, but have found it quite difficult to convince people of its benefits!

I personally do what troelskn said in the first comment - lowercase all directories and filenames, classes are like Model_Core and User_Model are in core/model.php and model/user.php for portability - never know what sort operating systems clients are going to be using on their servers!</description>
		<content:encoded><![CDATA[<p>I love the autoload function, but have found it quite difficult to convince people of its benefits!</p>
<p>I personally do what troelskn said in the first comment &#8211; lowercase all directories and filenames, classes are like Model_Core and User_Model are in core/model.php and model/user.php for portability &#8211; never know what sort operating systems clients are going to be using on their servers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: troelskn</title>
		<link>http://www.jaisenmathai.com/blog/2008/06/25/stop-including-class-files-and-use-__autoload-instead/comment-page-1/#comment-206</link>
		<dc:creator>troelskn</dc:creator>
		<pubDate>Fri, 27 Jun 2008 08:36:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.jaisenmathai.com/blog/?p=31#comment-206</guid>
		<description>@Marc But you&#039;re _not_ trying to load a file; You&#039;re trying to instantiate a class. It is valid PHP syntax, to write the classname in whichever case, you want. So you will get no error on Windows, but you would on unix. That makes your program non-portable. That&#039;s a pretty good reason in my book.</description>
		<content:encoded><![CDATA[<p>@Marc But you&#8217;re _not_ trying to load a file; You&#8217;re trying to instantiate a class. It is valid PHP syntax, to write the classname in whichever case, you want. So you will get no error on Windows, but you would on unix. That makes your program non-portable. That&#8217;s a pretty good reason in my book.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
