<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel>
	<title>Comments for Flex and Flash Developer - Jesse Warden dot Kizz-ohm</title>
	
	<link>http://jessewarden.com</link>
	<description>A blog on software development, technology, games &amp; movies.</description>
	<lastBuildDate>Fri, 06 Nov 2009 07:22:55 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/comments-jessewarden" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Comment on Flash Player 10 Surprise: Error #2176 by Sam Wilson</title>
		<link>http://feedproxy.google.com/~r/comments-jessewarden/~3/hwlAOwZYgq0/comment-page-1</link>
		<dc:creator>Sam Wilson</dc:creator>
		<pubDate>Fri, 06 Nov 2009 07:22:55 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1294#comment-206132</guid>
		<description>These red marks on my forehead are from me banging my head against this very problem for a few hours. Got it working though. Wasn't sure how to properly embed pngencoder in the IDE so I used aspngencoder (by aswing). Works! Thanks for pointing this out.</description>
		<content:encoded><![CDATA[<p>These red marks on my forehead are from me banging my head against this very problem for a few hours. Got it working though. Wasn&#8217;t sure how to properly embed pngencoder in the IDE so I used aspngencoder (by aswing). Works! Thanks for pointing this out.</p>
<img src="http://feeds.feedburner.com/~r/comments-jessewarden/~4/hwlAOwZYgq0" height="1" width="1"/>]]></content:encoded>
	<feedburner:origLink>http://jessewarden.com/2008/10/flash-player-10-surprise-error-2176.html/comment-page-1#comment-206132</feedburner:origLink></item>
	<item>
		<title>Comment on Good Memory Management When Using PureMVC by JesterXL</title>
		<link>http://feedproxy.google.com/~r/comments-jessewarden/~3/Lsn967xyE7Q/comment-page-1</link>
		<dc:creator>JesterXL</dc:creator>
		<pubDate>Wed, 04 Nov 2009 16:04:11 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1845#comment-205829</guid>
		<description>@KillerSpaz Sorry chief, brevity is a skill I currently do not possess.  Twitter is helping.

That said, it's a complex topic, and I'd rather defer on the side of assuming the user needs all the possible details for this complex subject.

First off, mad props you actually successfully implemented multi-core.  Most complicated shiz I've ever seen in my life.

Second, Mediator's already have a reference to facade built in, so not sure I get what you mean about reference back to the Facade.

Third, that's my point; avoiding writing clean up code, and instead just using a weak reference is easier to get away with now than it was back in Flash Player 9.  That said, there is still many other things to clean up often, not just listeners, hence if you're going to clean up other stuff, you might as well clean  up listeners.  However, using weak listeners that you later plan to clean up is fine; I don't see the harm there; it's just the intent makes no sense.  If you're going to use a weak listener as well as listening for the PopUp's CloseEvent.CLOSE in order to write clean-up code... don't use a weak listener.  People reading the code will get confused.</description>
		<content:encoded><![CDATA[<p>@KillerSpaz Sorry chief, brevity is a skill I currently do not possess.  Twitter is helping.</p>
<p>That said, it&#8217;s a complex topic, and I&#8217;d rather defer on the side of assuming the user needs all the possible details for this complex subject.</p>
<p>First off, mad props you actually successfully implemented multi-core.  Most complicated shiz I&#8217;ve ever seen in my life.</p>
<p>Second, Mediator&#8217;s already have a reference to facade built in, so not sure I get what you mean about reference back to the Facade.</p>
<p>Third, that&#8217;s my point; avoiding writing clean up code, and instead just using a weak reference is easier to get away with now than it was back in Flash Player 9.  That said, there is still many other things to clean up often, not just listeners, hence if you&#8217;re going to clean up other stuff, you might as well clean  up listeners.  However, using weak listeners that you later plan to clean up is fine; I don&#8217;t see the harm there; it&#8217;s just the intent makes no sense.  If you&#8217;re going to use a weak listener as well as listening for the PopUp&#8217;s CloseEvent.CLOSE in order to write clean-up code&#8230; don&#8217;t use a weak listener.  People reading the code will get confused.</p>
<img src="http://feeds.feedburner.com/~r/comments-jessewarden/~4/Lsn967xyE7Q" height="1" width="1"/>]]></content:encoded>
	<feedburner:origLink>http://jessewarden.com/2009/11/good-memory-management-when-using-puremvc.html/comment-page-1#comment-205829</feedburner:origLink></item>
	<item>
		<title>Comment on Good Memory Management When Using PureMVC by KillerSpaz</title>
		<link>http://feedproxy.google.com/~r/comments-jessewarden/~3/5hpIIdJk9y8/comment-page-1</link>
		<dc:creator>KillerSpaz</dc:creator>
		<pubDate>Wed, 04 Nov 2009 15:53:33 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1845#comment-205828</guid>
		<description>Jesse,

Good article, albeit very long-winded!

I've found that while trying to keep code D.R.Y., and particularly when utilizing a multi-core application, doing something like ApplicationFacade.getInstance() can cause issues. Primarily because of the direct dependence of a singular(not in just pattern, but in purpose) ApplicationFacade (which in a multi-core app is never the case), and a RTE regarding casting. Because of this, my mediators typically have a reference back to the Facade that is critical to remove the references to.

I typically use weak listeners anyway, often removing when I'm no longer needing them. The best example I can think of is a popup that plays a playlist of audio (such as composite instructional audio), but the user has the opportunity to close the window at any time. To avoid having to write the destroying of the event listener, I rely on the weak listener... Is this bad practice? I've yet to see a leak in this regard, but have come across others that I haven't been able to identify yet (specifically speaking, loading a semi-to-complex SWF created in Flash).</description>
		<content:encoded><![CDATA[<p>Jesse,</p>
<p>Good article, albeit very long-winded!</p>
<p>I&#8217;ve found that while trying to keep code D.R.Y., and particularly when utilizing a multi-core application, doing something like ApplicationFacade.getInstance() can cause issues. Primarily because of the direct dependence of a singular(not in just pattern, but in purpose) ApplicationFacade (which in a multi-core app is never the case), and a RTE regarding casting. Because of this, my mediators typically have a reference back to the Facade that is critical to remove the references to.</p>
<p>I typically use weak listeners anyway, often removing when I&#8217;m no longer needing them. The best example I can think of is a popup that plays a playlist of audio (such as composite instructional audio), but the user has the opportunity to close the window at any time. To avoid having to write the destroying of the event listener, I rely on the weak listener&#8230; Is this bad practice? I&#8217;ve yet to see a leak in this regard, but have come across others that I haven&#8217;t been able to identify yet (specifically speaking, loading a semi-to-complex SWF created in Flash).</p>
<img src="http://feeds.feedburner.com/~r/comments-jessewarden/~4/5hpIIdJk9y8" height="1" width="1"/>]]></content:encoded>
	<feedburner:origLink>http://jessewarden.com/2009/11/good-memory-management-when-using-puremvc.html/comment-page-1#comment-205828</feedburner:origLink></item>
	<item>
		<title>Comment on Good Memory Management When Using PureMVC by JesterXL</title>
		<link>http://feedproxy.google.com/~r/comments-jessewarden/~3/teP1uu1W26g/comment-page-1</link>
		<dc:creator>JesterXL</dc:creator>
		<pubDate>Wed, 04 Nov 2009 13:31:05 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1845#comment-205792</guid>
		<description>@Will 2 things.  First, I don't use PureMVC anymore, I'm a fan of &lt;a href="http://www.robotlegs.org/" rel="nofollow"&gt;RobotLegs&lt;/a&gt;.

Secondly, yes, I do do it that way.  I've only had to register multiple same type Mediators in one AIR project.  That was the exception to the rule.  PureMVC out of the box doesn't support this anyway because all the Mediator's have to have different names so clearly Cliff didn't think this would be a common practice.  That said, people like &lt;a href="http://joelhooks.com/" rel="nofollow"&gt;Joel Hooks&lt;/a&gt; have stated to DO do this often... :: shrugs ::

Either way, yeah, my ApplicationMediators do get kind of big, but the easy way to fix is just refactor into multiple Facade's that reside in their respective domain.  You have to do this anyway if you're creating modules, or just generally large projects.  Loading everything up front, while easier to read, makes it hard to scale and unload parts from memory.  If you load all Mediators once, for example in your Facade, then you have to write code elsewhere to re-register it.

Additionally, those 2 lines of code allow a clean separation in a View.  If you need to test a View in isolation because someting funky is going on, you can just comment out those 2 lines of code, and the View no longer has dependencies on the framework.  In large applications, this is a must.  Otherwise, solving GUI related bugs takes a loooooong time.

...for smaller projects, no, I register everything up front.</description>
		<content:encoded><![CDATA[<p>@Will 2 things.  First, I don&#8217;t use PureMVC anymore, I&#8217;m a fan of <a href="http://www.robotlegs.org/" rel="nofollow">RobotLegs</a>.</p>
<p>Secondly, yes, I do do it that way.  I&#8217;ve only had to register multiple same type Mediators in one AIR project.  That was the exception to the rule.  PureMVC out of the box doesn&#8217;t support this anyway because all the Mediator&#8217;s have to have different names so clearly Cliff didn&#8217;t think this would be a common practice.  That said, people like <a href="http://joelhooks.com/" rel="nofollow">Joel Hooks</a> have stated to DO do this often&#8230; :: shrugs ::</p>
<p>Either way, yeah, my ApplicationMediators do get kind of big, but the easy way to fix is just refactor into multiple Facade&#8217;s that reside in their respective domain.  You have to do this anyway if you&#8217;re creating modules, or just generally large projects.  Loading everything up front, while easier to read, makes it hard to scale and unload parts from memory.  If you load all Mediators once, for example in your Facade, then you have to write code elsewhere to re-register it.</p>
<p>Additionally, those 2 lines of code allow a clean separation in a View.  If you need to test a View in isolation because someting funky is going on, you can just comment out those 2 lines of code, and the View no longer has dependencies on the framework.  In large applications, this is a must.  Otherwise, solving GUI related bugs takes a loooooong time.</p>
<p>&#8230;for smaller projects, no, I register everything up front.</p>
<img src="http://feeds.feedburner.com/~r/comments-jessewarden/~4/teP1uu1W26g" height="1" width="1"/>]]></content:encoded>
	<feedburner:origLink>http://jessewarden.com/2009/11/good-memory-management-when-using-puremvc.html/comment-page-1#comment-205792</feedburner:origLink></item>
	<item>
		<title>Comment on Good Memory Management When Using PureMVC by Will</title>
		<link>http://feedproxy.google.com/~r/comments-jessewarden/~3/w9aEO-mTaws/comment-page-1</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Wed, 04 Nov 2009 12:13:20 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1845#comment-205782</guid>
		<description>Just wondering what the benefit is of writing: 

ApplicationFacade.getInstance().registerMyView(this);

to:

facade.registerMediator(new MyViewMediator(new MyView()));

This would only work for registering Mediators of the same type. Surely you don't create a custom register method for every Mediator type in your application? Just curious ;)</description>
		<content:encoded><![CDATA[<p>Just wondering what the benefit is of writing: </p>
<p>ApplicationFacade.getInstance().registerMyView(this);</p>
<p>to:</p>
<p>facade.registerMediator(new MyViewMediator(new MyView()));</p>
<p>This would only work for registering Mediators of the same type. Surely you don&#8217;t create a custom register method for every Mediator type in your application? Just curious <img src='http://jessewarden.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/comments-jessewarden/~4/w9aEO-mTaws" height="1" width="1"/>]]></content:encoded>
	<feedburner:origLink>http://jessewarden.com/2009/11/good-memory-management-when-using-puremvc.html/comment-page-1#comment-205782</feedburner:origLink></item>
</channel>
</rss>
