<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Runtime Checks for Abstract Classes and Methods in ActionScript 3.0</title>
	<atom:link href="http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/</link>
	<description>OOP Techniques for Flash and Flex Developers</description>
	<lastBuildDate>Wed, 10 Mar 2010 17:32:01 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ozgur uksal</title>
		<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/comment-page-1/#comment-3283</link>
		<dc:creator>ozgur uksal</dc:creator>
		<pubDate>Thu, 05 Nov 2009 16:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=9#comment-3283</guid>
		<description>I think, interfaces take care most of the things therefore abstract classes are not necessary, but would like to have the &quot;private&quot; constructors in as3.</description>
		<content:encoded><![CDATA[<p>I think, interfaces take care most of the things therefore abstract classes are not necessary, but would like to have the &#8220;private&#8221; constructors in as3.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chandima Cumaranatunge</title>
		<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/comment-page-1/#comment-2711</link>
		<dc:creator>Chandima Cumaranatunge</dc:creator>
		<pubDate>Tue, 21 Jul 2009 16:59:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=9#comment-2711</guid>
		<description>Hi Arek, Thanks for your comments and suggestions. As described in my previous comment to Kevin Freund, this was not intended to be a robust solution to implementing abstract classes in AS3. All your suggestions are sound - in fact, I don&#039;t use use this method myself, but simply name classes AbstractClassName as you suggest. Interfaces only solve one aspect of the abstract class issue. They make sure that you implement the method, but don&#039;t allow for a default implementation. Of course, you can solve the abstract class issue quite nicely by Declaring a parent class that the abstract class needs to extend and a pure interface that it needs to implement. I didn&#039;t dismiss pure interfaces out-of-hand, but the intention here was to try and implement abstract classes as they are found in other languages that support them. I do hope that abstract classes will be implemented in a future version of AS3 so that we don&#039;t have to implement these convoluted solutions.</description>
		<content:encoded><![CDATA[<p>Hi Arek, Thanks for your comments and suggestions. As described in my previous comment to Kevin Freund, this was not intended to be a robust solution to implementing abstract classes in AS3. All your suggestions are sound &#8211; in fact, I don&#8217;t use use this method myself, but simply name classes AbstractClassName as you suggest. Interfaces only solve one aspect of the abstract class issue. They make sure that you implement the method, but don&#8217;t allow for a default implementation. Of course, you can solve the abstract class issue quite nicely by Declaring a parent class that the abstract class needs to extend and a pure interface that it needs to implement. I didn&#8217;t dismiss pure interfaces out-of-hand, but the intention here was to try and implement abstract classes as they are found in other languages that support them. I do hope that abstract classes will be implemented in a future version of AS3 so that we don&#8217;t have to implement these convoluted solutions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arek Bal</title>
		<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/comment-page-1/#comment-2706</link>
		<dc:creator>Arek Bal</dc:creator>
		<pubDate>Mon, 20 Jul 2009 20:58:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=9#comment-2706</guid>
		<description>If I can suggest some improvements:
- you can use functions names to recognise abstract ones. For instance
&quot;abstract_FunctionName&quot;.
- you can use compiler constants to make &quot;debug&quot;, &quot;test&quot; and &quot;release&quot; versions of your code.
- there is no word of explanation on why have you dismissed interfaces. I know those aren&#039;t enough but while reading this I was wondering about your reasons.</description>
		<content:encoded><![CDATA[<p>If I can suggest some improvements:<br />
- you can use functions names to recognise abstract ones. For instance<br />
&#8220;abstract_FunctionName&#8221;.<br />
- you can use compiler constants to make &#8220;debug&#8221;, &#8220;test&#8221; and &#8220;release&#8221; versions of your code.<br />
- there is no word of explanation on why have you dismissed interfaces. I know those aren&#8217;t enough but while reading this I was wondering about your reasons.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chase Brammer &#187; Blog Archive &#187; Unknown classes, and classes to XML</title>
		<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/comment-page-1/#comment-1147</link>
		<dc:creator>Chase Brammer &#187; Blog Archive &#187; Unknown classes, and classes to XML</dc:creator>
		<pubDate>Fri, 09 Jan 2009 17:02:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=9#comment-1147</guid>
		<description>[...] to my testSuite.  To get the xml of an object (or class), it is actually really simple, here is an example.  Then it was just a matter of looping the code to find the right methods and add them to the test [...]</description>
		<content:encoded><![CDATA[<p>[...] to my testSuite.  To get the xml of an object (or class), it is actually really simple, here is an example.  Then it was just a matter of looping the code to find the right methods and add them to the test [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chandima</title>
		<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/comment-page-1/#comment-486</link>
		<dc:creator>chandima</dc:creator>
		<pubDate>Fri, 08 Feb 2008 17:43:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=9#comment-486</guid>
		<description>Hi Kevin,

Thanks for the insightful comments - I agree 100% with everything you said. This was more like a &quot;Look! abstract classes in AS3&quot; exercise than a robust solution. I myself, just name abstract classes in AS starting with the word &quot;Abstract&quot;, heavily comment stuff, and rarely throw any runtime exceptions.

Like you, I&#039;m hoping that abstract classes will be baked into future versions of AS. However, I don&#039;t see any movement in that direction in the ECMA proposals :/</description>
		<content:encoded><![CDATA[<p>Hi Kevin,</p>
<p>Thanks for the insightful comments &#8211; I agree 100% with everything you said. This was more like a &#8220;Look! abstract classes in AS3&#8243; exercise than a robust solution. I myself, just name abstract classes in AS starting with the word &#8220;Abstract&#8221;, heavily comment stuff, and rarely throw any runtime exceptions.</p>
<p>Like you, I&#8217;m hoping that abstract classes will be baked into future versions of AS. However, I don&#8217;t see any movement in that direction in the ECMA proposals :/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Freund</title>
		<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/comment-page-1/#comment-481</link>
		<dc:creator>Kevin Freund</dc:creator>
		<pubDate>Thu, 07 Feb 2008 07:14:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=9#comment-481</guid>
		<description>Folks, this works all well and good, but three comments:

This could should always be wrapped in something like &quot;if (Debug)&quot; to slap any of your developer peers who may not understand the abstract pattern; you wouldn&#039;t want to enable this code in production because:
     1) it&#039;s inefficient;
     2) if you catch this in production, it&#039;s too late to do anything about what should have been a compile-time exception anyway.

Chandima, the type introspection you do in the above code only works if you scope your virtual functions as &quot;public&quot;.  At times this is somewhat inconvenient, since you may want to protect your functions from the above mentioned developer peers (you know who they are) who try to call your functions out of context.

Mims, although it is possible that I haven&#039;t seen your latest code, it seems to me that you are only enforcing 50% of what an abstract class  requires.  In addition to the prohibition of the abstract class being instantiated (which you do correctly), a subclass of an abstract class must implement ALL of the virtual functions of the abstract class.  With your code, you only throw an exception if the virtual method is called directly (because that particular method has no override).  With this implementation, the oversight of overriding a single virtual function among many may not pop up while you&#039;re developing (if you don&#039;t test every possible use case).  I like Chandima&#039;s solution which front-loads all the checks using type introspection.

In summary, I&#039;ve found implementing this pattern in AS3 to be a real pain in the butt, not to mention an ugly hack at best.  I&#039;m definitely putting my vote in for the abstract keyword in AS4.</description>
		<content:encoded><![CDATA[<p>Folks, this works all well and good, but three comments:</p>
<p>This could should always be wrapped in something like &#8220;if (Debug)&#8221; to slap any of your developer peers who may not understand the abstract pattern; you wouldn&#8217;t want to enable this code in production because:<br />
     1) it&#8217;s inefficient;<br />
     2) if you catch this in production, it&#8217;s too late to do anything about what should have been a compile-time exception anyway.</p>
<p>Chandima, the type introspection you do in the above code only works if you scope your virtual functions as &#8220;public&#8221;.  At times this is somewhat inconvenient, since you may want to protect your functions from the above mentioned developer peers (you know who they are) who try to call your functions out of context.</p>
<p>Mims, although it is possible that I haven&#8217;t seen your latest code, it seems to me that you are only enforcing 50% of what an abstract class  requires.  In addition to the prohibition of the abstract class being instantiated (which you do correctly), a subclass of an abstract class must implement ALL of the virtual functions of the abstract class.  With your code, you only throw an exception if the virtual method is called directly (because that particular method has no override).  With this implementation, the oversight of overriding a single virtual function among many may not pop up while you&#8217;re developing (if you don&#8217;t test every possible use case).  I like Chandima&#8217;s solution which front-loads all the checks using type introspection.</p>
<p>In summary, I&#8217;ve found implementing this pattern in AS3 to be a real pain in the butt, not to mention an ugly hack at best.  I&#8217;m definitely putting my vote in for the abstract keyword in AS4.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mims Wright</title>
		<link>http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/comment-page-1/#comment-2</link>
		<dc:creator>Mims Wright</dc:creator>
		<pubDate>Fri, 11 May 2007 21:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=9#comment-2</guid>
		<description>Hey Chandima,

I actually did figure out a way to enforce methods as well as classes with my implementation. The AbstractEnforcer class contains two methods, 
AbstractEnforcer.enforceConstructor() for making a constructor abstract
and 
AbstractEnforcer.enforceMethod() for making a method abstract.
You can use both independently of each other - in other words, you can have an abstract method without having an abstract class. 
Both work at runtime. What would be really great is to get one that works at compile time but I haven&#039;t figured that out yet. 
Your solution is interesting too. There&#039;s probably more to learn from the introspection that I haven&#039;t found yet.

Mims</description>
		<content:encoded><![CDATA[<p>Hey Chandima,</p>
<p>I actually did figure out a way to enforce methods as well as classes with my implementation. The AbstractEnforcer class contains two methods,<br />
AbstractEnforcer.enforceConstructor() for making a constructor abstract<br />
and<br />
AbstractEnforcer.enforceMethod() for making a method abstract.<br />
You can use both independently of each other &#8211; in other words, you can have an abstract method without having an abstract class.<br />
Both work at runtime. What would be really great is to get one that works at compile time but I haven&#8217;t figured that out yet.<br />
Your solution is interesting too. There&#8217;s probably more to learn from the introspection that I haven&#8217;t found yet.</p>
<p>Mims</p>
]]></content:encoded>
	</item>
</channel>
</rss>
