<?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: Partial Classes in PHP</title>
	<atom:link href="http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/</link>
	<description>Far Too Sweet To Be Sour</description>
	<lastBuildDate>Fri, 12 Mar 2010 14:46:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Prasanna Shetye</title>
		<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/comment-page-1/#comment-2125</link>
		<dc:creator>Prasanna Shetye</dc:creator>
		<pubDate>Fri, 12 Mar 2010 14:46:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.toosweettobesour.com/?p=46#comment-2125</guid>
		<description>nice logic. it saved my time on thinking for this logic :) thanks</description>
		<content:encoded><![CDATA[<p>nice logic. it saved my time on thinking for this logic :) thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kris</title>
		<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/comment-page-1/#comment-2120</link>
		<dc:creator>Kris</dc:creator>
		<pubDate>Tue, 09 Feb 2010 22:45:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.toosweettobesour.com/?p=46#comment-2120</guid>
		<description>There is an easier way to do this for those of us also writing the code that generates the classes...

insert a file into the generated class during generation.

This way, you don&#039;t need to add any glue code to make anything work at runtime and your changes remain intact after regenerating the code.

I&#039;m doing this for my Data Entities and it works great. Also has much less runtime overhead (the __call, __get and __set methods do have a performance penalty, even if it&#039;s not much, it adds up over time.</description>
		<content:encoded><![CDATA[<p>There is an easier way to do this for those of us also writing the code that generates the classes&#8230;</p>
<p>insert a file into the generated class during generation.</p>
<p>This way, you don&#8217;t need to add any glue code to make anything work at runtime and your changes remain intact after regenerating the code.</p>
<p>I&#8217;m doing this for my Data Entities and it works great. Also has much less runtime overhead (the __call, __get and __set methods do have a performance penalty, even if it&#8217;s not much, it adds up over time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ray</title>
		<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/comment-page-1/#comment-1807</link>
		<dc:creator>Ray</dc:creator>
		<pubDate>Wed, 01 Jul 2009 22:59:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.toosweettobesour.com/?p=46#comment-1807</guid>
		<description>A good start, but with one sneaky lurking problem.  It won&#039;t work with any methods that require reference parameters unless you pass them in by reference, which is deprecated and may throw warnings.

Perhaps extensive use of reflection could solve that, but if the $args in __call have all come in by value, then it&#039;s too late to make them references by the time you get them.

I imagine returning references might also be a problem.</description>
		<content:encoded><![CDATA[<p>A good start, but with one sneaky lurking problem.  It won&#8217;t work with any methods that require reference parameters unless you pass them in by reference, which is deprecated and may throw warnings.</p>
<p>Perhaps extensive use of reflection could solve that, but if the $args in __call have all come in by value, then it&#8217;s too late to make them references by the time you get them.</p>
<p>I imagine returning references might also be a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/comment-page-1/#comment-96</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 08 Jul 2008 00:00:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.toosweettobesour.com/?p=46#comment-96</guid>
		<description>Thanks for the resource. I&#039;ll also throw in my vote for support of partial classes in the next versions of PHP. In case someone of influence comes across this post.


-- Alex</description>
		<content:encoded><![CDATA[<p>Thanks for the resource. I&#8217;ll also throw in my vote for support of partial classes in the next versions of PHP. In case someone of influence comes across this post.</p>
<p>&#8211; Alex</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Cousineau</title>
		<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/comment-page-1/#comment-78</link>
		<dc:creator>Daniel Cousineau</dc:creator>
		<pubDate>Wed, 25 Jun 2008 19:22:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.toosweettobesour.com/?p=46#comment-78</guid>
		<description>@iongion: While this code sample was just an exercise in fun, partial classes do have their uses.

Partial classes are not used to fill in or expand any OOP design pattern, and aren&#039;t used to do MVC either. Visual Studio does a lot of code generation and partial classes allow you to alter generated code without having to edit the usually unreadable generated code nor worry about losing your changes the next time Visual Studio auto generates code.

The best example I can think of is a class pertaining to a GUI window. Visual Studio (and others like GLADE for GTK, QT Designer, etc.) gives you a visual interface to design a GUI window and generates the code for the window. If you&#039;ve ever looked at a generated class, while cleaner in C# than other languages, it&#039;s still long, terse, and difficult to follow changes. You cannot simply extend the class as launching the window is very dependent on the current class name and you run into issues of Privately scoped variables not being visible to it&#039;s children (the extended class).

So partial classes came into existence to allow you to maintain separate files containing code for the same class. While Visual Studio operates on foo.cs, auto generating and regenerating code, you can make all your changes in bar.cs and they merge transparently, allowing you to not worry about losing code to an overwrite or things breaking if an action causes Visual Studio to somewhat radically change the structure of the class or remove methods you had custom code in.</description>
		<content:encoded><![CDATA[<p>@iongion: While this code sample was just an exercise in fun, partial classes do have their uses.</p>
<p>Partial classes are not used to fill in or expand any OOP design pattern, and aren&#8217;t used to do MVC either. Visual Studio does a lot of code generation and partial classes allow you to alter generated code without having to edit the usually unreadable generated code nor worry about losing your changes the next time Visual Studio auto generates code.</p>
<p>The best example I can think of is a class pertaining to a GUI window. Visual Studio (and others like GLADE for GTK, QT Designer, etc.) gives you a visual interface to design a GUI window and generates the code for the window. If you&#8217;ve ever looked at a generated class, while cleaner in C# than other languages, it&#8217;s still long, terse, and difficult to follow changes. You cannot simply extend the class as launching the window is very dependent on the current class name and you run into issues of Privately scoped variables not being visible to it&#8217;s children (the extended class).</p>
<p>So partial classes came into existence to allow you to maintain separate files containing code for the same class. While Visual Studio operates on foo.cs, auto generating and regenerating code, you can make all your changes in bar.cs and they merge transparently, allowing you to not worry about losing code to an overwrite or things breaking if an action causes Visual Studio to somewhat radically change the structure of the class or remove methods you had custom code in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iongion</title>
		<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/comment-page-1/#comment-77</link>
		<dc:creator>iongion</dc:creator>
		<pubDate>Wed, 25 Jun 2008 19:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.toosweettobesour.com/?p=46#comment-77</guid>
		<description>Why wont you simply extend the class ?

&quot;For the uninitiated, it is a way of defining a class in two separate locations.&quot; - its not a clean reason to emulate partial classes.

Partial classes in C grill (:P) are imho invented for offering MVC support through the language(why would one do that) in .net framework.

Don&#039;t get me wrong, i like the language, i worked with it for 6 years now, but this partial class creation is such a hard to grasp feature, i do not see any concrete OOP pattern (and by this i mean real world concepts), i do not thing they have any concrete representation for the real world, as all the other oop patterns do.</description>
		<content:encoded><![CDATA[<p>Why wont you simply extend the class ?</p>
<p>&#8220;For the uninitiated, it is a way of defining a class in two separate locations.&#8221; &#8211; its not a clean reason to emulate partial classes.</p>
<p>Partial classes in C grill (:P) are imho invented for offering MVC support through the language(why would one do that) in .net framework.</p>
<p>Don&#8217;t get me wrong, i like the language, i worked with it for 6 years now, but this partial class creation is such a hard to grasp feature, i do not see any concrete OOP pattern (and by this i mean real world concepts), i do not thing they have any concrete representation for the real world, as all the other oop patterns do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adam</title>
		<link>http://www.toosweettobesour.com/2008/05/01/partial-classes-in-php/comment-page-1/#comment-76</link>
		<dc:creator>adam</dc:creator>
		<pubDate>Mon, 23 Jun 2008 15:41:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.toosweettobesour.com/?p=46#comment-76</guid>
		<description>just what i was looking for... i needed a way to separate my generated code from custom hand written code, but wanted both within the same class instance. thanks for posting</description>
		<content:encoded><![CDATA[<p>just what i was looking for&#8230; i needed a way to separate my generated code from custom hand written code, but wanted both within the same class instance. thanks for posting</p>
]]></content:encoded>
	</item>
</channel>
</rss>
