<?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: Abstract is as Abstract Does: A Forrest Gump Approach to Abstract Classes in ActionScript 3.0</title>
	<atom:link href="http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/</link>
	<description>OOP Techniques for Flash and Flex Developers</description>
	<lastBuildDate>Mon, 26 Jul 2010 13:40:37 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Dale Beermann</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1230</link>
		<dc:creator>Dale Beermann</dc:creator>
		<pubDate>Thu, 15 Jan 2009 22:30:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1230</guid>
		<description>Glad that made sense :)  I forget that some people may not have used languages that are a bit more &quot;true&quot; to OOP.  We&#039;ve come across a lot of things like this actually.  Personally, I think that, for the reasons I stated above, the lack of abstract classes leads to poor programming practices because you have to bend some of the fundamental rules of OOP in order to do what you want.</description>
		<content:encoded><![CDATA[<p>Glad that made sense :)  I forget that some people may not have used languages that are a bit more &#8220;true&#8221; to OOP.  We&#8217;ve come across a lot of things like this actually.  Personally, I think that, for the reasons I stated above, the lack of abstract classes leads to poor programming practices because you have to bend some of the fundamental rules of OOP in order to do what you want.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1229</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Thu, 15 Jan 2009 22:03:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1229</guid>
		<description>Hi Dale,

I cannot thank you enough for that example! Virtually all of the best examples of design patterns seem to come from Java, but like Small Talk, Java has abstract classes as well as other features not found in ActionScript. Those of us who come from ActionScript there&#039;s a double frustration. If we do not know Java well, then it&#039;s a bear to find a workaround. If we do know Java well, as is your case, we&#039;re frustrated by what Java has and ActionScript does not.

However, in all fairness to both ActionScript and the engineers at Adobe, ActionScript is faithful to the ECMA 262 r4 standards. I&#039;ve heard some scuttlebutt that ECMA may deign to change that feature for 262. ECMAScript 334 [C#] &lt;em&gt;does have&lt;/em&gt; abstract classes, and I have no idea why it does and we don&#039;t, unless it has something to do with JavaScript.

Thanks again,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Dale,</p>
<p>I cannot thank you enough for that example! Virtually all of the best examples of design patterns seem to come from Java, but like Small Talk, Java has abstract classes as well as other features not found in ActionScript. Those of us who come from ActionScript there&#8217;s a double frustration. If we do not know Java well, then it&#8217;s a bear to find a workaround. If we do know Java well, as is your case, we&#8217;re frustrated by what Java has and ActionScript does not.</p>
<p>However, in all fairness to both ActionScript and the engineers at Adobe, ActionScript is faithful to the ECMA 262 r4 standards. I&#8217;ve heard some scuttlebutt that ECMA may deign to change that feature for 262. ECMAScript 334 [C#] <em>does have</em> abstract classes, and I have no idea why it does and we don&#8217;t, unless it has something to do with JavaScript.</p>
<p>Thanks again,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dale Beermann</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1228</link>
		<dc:creator>Dale Beermann</dc:creator>
		<pubDate>Thu, 15 Jan 2009 21:45:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1228</guid>
		<description>Our issue stems partially from porting from Java to Flash but I think could come up when starting in ActionScript as well. Here&#039;s an example of a design pattern where the interface is implemented in the abstract class:

interface IDrawable
 - defines draw()

class AbstractDrawable implements IDrawable
 - defines properties of the drawable such as color
 - must implement draw() in ActionScript

class CircleDrawable
 - must override draw() in ActionScript

class RectangleDrawable
 - must override draw() in ActionScript

In Java this is great because it ensures that my derived classes implement all of the methods of IDrawable (there is no draw() method defined in AbstractDrawable in the Java implementation). 

This can technically be achieved by making your derived classes implement the interface and removing it from the abstract class.  However, it leads to an assumption of what the abstract defines, breaking encapsulation.

As a complete aside, I also find it interesting that the &quot;virtual&quot; keyword is a valid modifier for a method but doesn&#039;t seem to change the behavior.  I&#039;m curious if there&#039;s any relation between its presence, lack of its implementation, and the lack of abstract classes.</description>
		<content:encoded><![CDATA[<p>Our issue stems partially from porting from Java to Flash but I think could come up when starting in ActionScript as well. Here&#8217;s an example of a design pattern where the interface is implemented in the abstract class:</p>
<p>interface IDrawable<br />
 &#8211; defines draw()</p>
<p>class AbstractDrawable implements IDrawable<br />
 &#8211; defines properties of the drawable such as color<br />
 &#8211; must implement draw() in ActionScript</p>
<p>class CircleDrawable<br />
 &#8211; must override draw() in ActionScript</p>
<p>class RectangleDrawable<br />
 &#8211; must override draw() in ActionScript</p>
<p>In Java this is great because it ensures that my derived classes implement all of the methods of IDrawable (there is no draw() method defined in AbstractDrawable in the Java implementation). </p>
<p>This can technically be achieved by making your derived classes implement the interface and removing it from the abstract class.  However, it leads to an assumption of what the abstract defines, breaking encapsulation.</p>
<p>As a complete aside, I also find it interesting that the &#8220;virtual&#8221; keyword is a valid modifier for a method but doesn&#8217;t seem to change the behavior.  I&#8217;m curious if there&#8217;s any relation between its presence, lack of its implementation, and the lack of abstract classes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1225</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Thu, 15 Jan 2009 21:05:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1225</guid>
		<description>Hi Dale,

What I&#039;ve come around to with ActionScript abstract classes is to treat them as interfaces. I&#039;m not sure which design patterns derive abstract classes from interfaces, but when I see interface, I assume that it can be either an abstract class or an interface (using the keyword &lt;em&gt;interface&lt;/em&gt;). In Part IV of the series on Take a Design Pattern to Work, the two interfaces I use (Creator and Product) are in fact abstract classes both in the sense that they are not instantiated and that they include methods that must be overridden.

I don&#039;t know if that&#039;s a helpful way to deal with the ActionScript version of an abstract class or not, but it&#039;s been useful for me.

Thanks again for your comment,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Dale,</p>
<p>What I&#8217;ve come around to with ActionScript abstract classes is to treat them as interfaces. I&#8217;m not sure which design patterns derive abstract classes from interfaces, but when I see interface, I assume that it can be either an abstract class or an interface (using the keyword <em>interface</em>). In Part IV of the series on Take a Design Pattern to Work, the two interfaces I use (Creator and Product) are in fact abstract classes both in the sense that they are not instantiated and that they include methods that must be overridden.</p>
<p>I don&#8217;t know if that&#8217;s a helpful way to deal with the ActionScript version of an abstract class or not, but it&#8217;s been useful for me.</p>
<p>Thanks again for your comment,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dale Beermann</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1221</link>
		<dc:creator>Dale Beermann</dc:creator>
		<pubDate>Thu, 15 Jan 2009 18:18:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1221</guid>
		<description>I&#039;ve been frustrated by the lack of abstract classes for a lot of reasons.  More often than not though, I have an abstract class that implements a particular interface.  Yet, I don&#039;t want to define the functionality for that entire interface in the abstract class.

ActionScript, however, forces you to implement every method in the interface because of the lack of abstract classes.  Now every derived class must override every method in the interface, regardless of whether or not they&#039;ve truly been implemented.  Just about every method in my derived class is marked as override, and the keyword has lost any value to me as a programmer. 

Furthermore, you have to keep moving back and forth between the interface, the abstract class, and the derived class to see what you need to implement. Ideally, I just get a compile error telling me which methods in the interface have not been implemented by either the abstract class or the derived class.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been frustrated by the lack of abstract classes for a lot of reasons.  More often than not though, I have an abstract class that implements a particular interface.  Yet, I don&#8217;t want to define the functionality for that entire interface in the abstract class.</p>
<p>ActionScript, however, forces you to implement every method in the interface because of the lack of abstract classes.  Now every derived class must override every method in the interface, regardless of whether or not they&#8217;ve truly been implemented.  Just about every method in my derived class is marked as override, and the keyword has lost any value to me as a programmer. </p>
<p>Furthermore, you have to keep moving back and forth between the interface, the abstract class, and the derived class to see what you need to implement. Ideally, I just get a compile error telling me which methods in the interface have not been implemented by either the abstract class or the derived class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1185</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Tue, 13 Jan 2009 09:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1185</guid>
		<description>Hi Archont,

Your point gets back to a seamless design pattern mindset. I believe we are able to do things quickly when doing them wrong because those who followed the ActionScript path from 1 to 3 were first given a &quot;wrong&quot; way to develop a program that didn&#039;t have either large sets of code embedded in classes or flexible long range development for re-use and re-factoring.

As for occasionally using override, I&#039;m assuming you&#039;re referring to abstract classes. But are you always using override when you have an abstract class (one that begins with an &#039;a&#039; in your case) or do you only sometimes use override with classes that are extended but not instantiated? In other words, are some of your abstract classes of the Forrest Gump variety?

Thanks,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Archont,</p>
<p>Your point gets back to a seamless design pattern mindset. I believe we are able to do things quickly when doing them wrong because those who followed the ActionScript path from 1 to 3 were first given a &#8220;wrong&#8221; way to develop a program that didn&#8217;t have either large sets of code embedded in classes or flexible long range development for re-use and re-factoring.</p>
<p>As for occasionally using override, I&#8217;m assuming you&#8217;re referring to abstract classes. But are you always using override when you have an abstract class (one that begins with an &#8216;a&#8217; in your case) or do you only sometimes use override with classes that are extended but not instantiated? In other words, are some of your abstract classes of the Forrest Gump variety?</p>
<p>Thanks,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1182</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Tue, 13 Jan 2009 01:54:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1182</guid>
		<description>Hi TK,

I really like the idea of sticking with the ECMAScript 262 E4 standards, and as far as I know, ECMA would be the place to petition. The main advantage of staying with the standard is to reduce the possibility of a lot of &quot;improved&quot; AS3 versions popping up leading us back to the bad old days when every program seemed to need a special patch or plugin for someone&#039;s idea of improvement.

Anyway, you may have answered the real query--the &quot;half-abstract&quot; nature of an abstract class. The Template Method is a good example of how an abstract class should function because only part of it is concrete. So rather than the Forrest Gump definition, we need at least part of it to be overridden by the child classes. That might be a useful characterization of an AS3 abstract class.

Thanks for your thoughts on this,
Bill</description>
		<content:encoded><![CDATA[<p>Hi TK,</p>
<p>I really like the idea of sticking with the ECMAScript 262 E4 standards, and as far as I know, ECMA would be the place to petition. The main advantage of staying with the standard is to reduce the possibility of a lot of &#8220;improved&#8221; AS3 versions popping up leading us back to the bad old days when every program seemed to need a special patch or plugin for someone&#8217;s idea of improvement.</p>
<p>Anyway, you may have answered the real query&#8211;the &#8220;half-abstract&#8221; nature of an abstract class. The Template Method is a good example of how an abstract class should function because only part of it is concrete. So rather than the Forrest Gump definition, we need at least part of it to be overridden by the child classes. That might be a useful characterization of an AS3 abstract class.</p>
<p>Thanks for your thoughts on this,<br />
Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TK</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1181</link>
		<dc:creator>TK</dc:creator>
		<pubDate>Tue, 13 Jan 2009 00:34:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1181</guid>
		<description>Among other things, the abstract keyword is what we&#039;re really lacking. I&#039;m working on something of a solution to this, but I can&#039;t be any more specific than that :)

All I can say is that it would cost Adobe next to nothing to implement the tiny &quot;abstract&quot; keyword. For a subclass, extending an abstract class would be just like extending a regular class and implementing an interface, because an abstract class is just that: half concrete and half abstract. Where should we petition for this? It&#039;s so simple, and yet we still don&#039;t have it :-/</description>
		<content:encoded><![CDATA[<p>Among other things, the abstract keyword is what we&#8217;re really lacking. I&#8217;m working on something of a solution to this, but I can&#8217;t be any more specific than that :)</p>
<p>All I can say is that it would cost Adobe next to nothing to implement the tiny &#8220;abstract&#8221; keyword. For a subclass, extending an abstract class would be just like extending a regular class and implementing an interface, because an abstract class is just that: half concrete and half abstract. Where should we petition for this? It&#8217;s so simple, and yet we still don&#8217;t have it :-/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: archont</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1180</link>
		<dc:creator>archont</dc:creator>
		<pubDate>Mon, 12 Jan 2009 23:36:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1180</guid>
		<description>I have a habit of prefixing concrete classes with c and abstract classes with a. 

However yes, I do occasionally use override for different purposes. Quite often it is the result of sloppy coding, but in the real world I regrettably don&#039;t have the time to write beautiful things. &quot;I want it done by yesterday&quot; isn&#039;t half as bad as &quot;Say, you know what? I like the project, just please save it as AS2 instead of AS3 and put it on the server&quot; - especially when it&#039;s 50 or co AS3 classes. Gotta love management.</description>
		<content:encoded><![CDATA[<p>I have a habit of prefixing concrete classes with c and abstract classes with a. </p>
<p>However yes, I do occasionally use override for different purposes. Quite often it is the result of sloppy coding, but in the real world I regrettably don&#8217;t have the time to write beautiful things. &#8220;I want it done by yesterday&#8221; isn&#8217;t half as bad as &#8220;Say, you know what? I like the project, just please save it as AS2 instead of AS3 and put it on the server&#8221; &#8211; especially when it&#8217;s 50 or co AS3 classes. Gotta love management.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Sanders</title>
		<link>http://www.as3dp.com/2009/01/11/abstract-is-as-abstract-does-a-forrest-gump-approach-to-abstract-classes-in-actionscript-30/comment-page-1/#comment-1178</link>
		<dc:creator>Bill Sanders</dc:creator>
		<pubDate>Mon, 12 Jan 2009 21:48:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.as3dp.com/?p=540#comment-1178</guid>
		<description>Hi Matt,

Thanks for you comment. I guess I didn&#039;t phrase it very well, but the issue is not over the lack of an abstract modifier statement so much as it is if a parent class is treated as an abstract class whether it really works as one. For example, suppose your AbstractButton class has everything all set for creating buttons, and the child classes simply extend it but do not instantiate it. What if none of the functions are overridden because they do not need to be?

In the example you have, the parent class has a constructor function, which is fine. However, in cases where a constructor function is unnecessary, and the child classes extend the AbstractButton will they then be part of an interface pivoted on the abstract class?

By the way, if you didn&#039;t see &lt;a href=&quot;http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/&quot; rel=&quot;nofollow&quot;&gt;Chandima&#039;s post on abstract classes&lt;/a&gt;, you might find it helpful.

Thanks,
Bill</description>
		<content:encoded><![CDATA[<p>Hi Matt,</p>
<p>Thanks for you comment. I guess I didn&#8217;t phrase it very well, but the issue is not over the lack of an abstract modifier statement so much as it is if a parent class is treated as an abstract class whether it really works as one. For example, suppose your AbstractButton class has everything all set for creating buttons, and the child classes simply extend it but do not instantiate it. What if none of the functions are overridden because they do not need to be?</p>
<p>In the example you have, the parent class has a constructor function, which is fine. However, in cases where a constructor function is unnecessary, and the child classes extend the AbstractButton will they then be part of an interface pivoted on the abstract class?</p>
<p>By the way, if you didn&#8217;t see <a href="http://www.as3dp.com/2007/05/05/runtime-checks-for-abstract-classes-and-methods-in-actionscript-30/" rel="nofollow">Chandima&#8217;s post on abstract classes</a>, you might find it helpful.</p>
<p>Thanks,<br />
Bill</p>
]]></content:encoded>
	</item>
</channel>
</rss>
