<?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 for activepoison.com</title>
	<atom:link href="http://blog.activepoison.com/?feed=comments-rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.activepoison.com</link>
	<description></description>
	<lastBuildDate>Mon, 23 Aug 2010 10:09:36 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>Comment on Flex Builder Plugin &#8230;Navigation Filters by Uwe</title>
		<link>http://blog.activepoison.com/?p=218&#038;cpage=1#comment-2057</link>
		<dc:creator>Uwe</dc:creator>
		<pubDate>Mon, 23 Aug 2010 10:09:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=218#comment-2057</guid>
		<description>I failed to apply this on Flash Builder 4 (plug-in installation). Do you know how to do?</description>
		<content:encoded><![CDATA[<p>I failed to apply this on Flash Builder 4 (plug-in installation). Do you know how to do?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using ASDoc in Flex Builder by Hari</title>
		<link>http://blog.activepoison.com/?p=31&#038;cpage=1#comment-886</link>
		<dc:creator>Hari</dc:creator>
		<pubDate>Mon, 21 Dec 2009 06:48:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=31#comment-886</guid>
		<description>Good one... 

thanks,
Hari</description>
		<content:encoded><![CDATA[<p>Good one&#8230; </p>
<p>thanks,<br />
Hari</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using ASDoc in Flex Builder by chesapeake web design</title>
		<link>http://blog.activepoison.com/?p=31&#038;cpage=1#comment-820</link>
		<dc:creator>chesapeake web design</dc:creator>
		<pubDate>Wed, 18 Nov 2009 15:14:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=31#comment-820</guid>
		<description>i needed this...very helpful thanks!</description>
		<content:encoded><![CDATA[<p>i needed this&#8230;very helpful thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on asfunction to TextEvent.LINK by Jasper</title>
		<link>http://blog.activepoison.com/?p=25&#038;cpage=1#comment-801</link>
		<dc:creator>Jasper</dc:creator>
		<pubDate>Thu, 05 Nov 2009 10:52:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=25#comment-801</guid>
		<description>Nice. Just what I was looking for!</description>
		<content:encoded><![CDATA[<p>Nice. Just what I was looking for!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cairngorm with Dependency Injection (Part 1) by John</title>
		<link>http://blog.activepoison.com/?p=235&#038;cpage=1#comment-299</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 24 Jun 2009 21:06:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=235#comment-299</guid>
		<description>Hi Poison,

I see what you mean, your use of ILoginModel is simply an illustration that the use of interfaces is a good thing. I can&#039;t disagree.

My main point was that your approach is not what most people would call &quot;dependency injection&quot;. When I came here, I was hoping to see a simple dependency injection framework - where I don&#039;t have to implement a factory or abstract factory (or a &quot;factory factory&quot;) to manage dependencies.</description>
		<content:encoded><![CDATA[<p>Hi Poison,</p>
<p>I see what you mean, your use of ILoginModel is simply an illustration that the use of interfaces is a good thing. I can&#8217;t disagree.</p>
<p>My main point was that your approach is not what most people would call &#8220;dependency injection&#8221;. When I came here, I was hoping to see a simple dependency injection framework &#8211; where I don&#8217;t have to implement a factory or abstract factory (or a &#8220;factory factory&#8221;) to manage dependencies.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cairngorm with Dependency Injection (Part 1) by Poison</title>
		<link>http://blog.activepoison.com/?p=235&#038;cpage=1#comment-297</link>
		<dc:creator>Poison</dc:creator>
		<pubDate>Sun, 21 Jun 2009 00:51:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=235#comment-297</guid>
		<description>@John

Yes Cairngorm does seem to &quot;encourage&quot; strong coupling between components.  And I agree Swiz is a great framework and I enjoy it but I wanted to point out that with Cairngorm it is pretty simple to alleviate the pains of strongly typed coupling. 

I guess I was moreso talking about using the dependency pattern and not necessarily setting up a whole dependency injection framework so &quot;when a class satisfies its own dependencies it becomes inflexible with regards to these dependencies.&quot;  Meaning that by having a view look for its model by:

private var loginModel:LoginModel = AppModelLocator.getInstance().loginModel;

The view is now tightly coupled to the the &quot;AppModelLocator&quot; and is inflexible so if you have to change the dependencies you will have to change the code.  But with some simple refactoring:

public var loginModel:ILoginModel;

Now the view no longer satisfies these dependencies itself and becomes completely independent and reuseable just by implementing an interface.( I didn&#039;t mention it in my post but this is also extremely helpful when it comes to unit testing.)    

As regards to using the Factory pattern and the &quot;init()&quot; function, in this particular post I just wanted to make it simple but it would be easy enough to set up an abstract factory pattern implementation.

And yes I agree the model can typically be concrete but I wanted to show that with interfaces you can use different parts of your model according to where it is implemented.  Unfortunately Actionscript does not inherently support Abstract classes and we can only extend 1 class at a time, but we can implement multiple interfaces and interfaces can extend multiple interfaces.</description>
		<content:encoded><![CDATA[<p>@John</p>
<p>Yes Cairngorm does seem to &#8220;encourage&#8221; strong coupling between components.  And I agree Swiz is a great framework and I enjoy it but I wanted to point out that with Cairngorm it is pretty simple to alleviate the pains of strongly typed coupling. </p>
<p>I guess I was moreso talking about using the dependency pattern and not necessarily setting up a whole dependency injection framework so &#8220;when a class satisfies its own dependencies it becomes inflexible with regards to these dependencies.&#8221;  Meaning that by having a view look for its model by:</p>
<p>private var loginModel:LoginModel = AppModelLocator.getInstance().loginModel;</p>
<p>The view is now tightly coupled to the the &#8220;AppModelLocator&#8221; and is inflexible so if you have to change the dependencies you will have to change the code.  But with some simple refactoring:</p>
<p>public var loginModel:ILoginModel;</p>
<p>Now the view no longer satisfies these dependencies itself and becomes completely independent and reuseable just by implementing an interface.( I didn&#8217;t mention it in my post but this is also extremely helpful when it comes to unit testing.)    </p>
<p>As regards to using the Factory pattern and the &#8220;init()&#8221; function, in this particular post I just wanted to make it simple but it would be easy enough to set up an abstract factory pattern implementation.</p>
<p>And yes I agree the model can typically be concrete but I wanted to show that with interfaces you can use different parts of your model according to where it is implemented.  Unfortunately Actionscript does not inherently support Abstract classes and we can only extend 1 class at a time, but we can implement multiple interfaces and interfaces can extend multiple interfaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cairngorm with Dependency Injection (Part 1) by John</title>
		<link>http://blog.activepoison.com/?p=235&#038;cpage=1#comment-296</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 19 Jun 2009 17:27:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=235#comment-296</guid>
		<description>Hi Poison,

I recently reviewed all four frameworks you mentioned. I&#039;ve found Cairngorm lacking because its design seems to encourage developers to strongly couple application components. I have decided to use the Swiz framework for the first Flex project for my team. I see that you have used out Swiz before. Swiz does a good job at allowing code to be loosely coupled via autowiring and dependency injection. Is it possible that the use of Swiz framework, plus a MVC pattern similar to Cairngorm, will do a better job at simplifying your code?

Looking at your code, I&#039;m wondering what you mean by dependency injection. The dependencies are still embedded in the code (in this case, the view). The dependency injection pattern means that the glue code (or code that specifies dependencies of each object) are moved to a central location and that the dependencies of the object graph is automatically maintained for you. 

To be brief, the technique used by you is more like the Factory pattern, where a method defines the relationship of the objects in your framework. 

Specifically, following code more or less defines your factory object/method :

private var appModel:AppModelLocator = AppModelLocator.getInstance()
...
appModel.loginViewModel = new LoginViewModel();

Note that these few lines strongly couples your view (or Factory object) to the AppModel and the ILoginViewModel implementation. 

I noticed your code has a very simple model, and your use of the init() method easily sets up everything you need.

ModelLocator -&gt; ILoginViewModel

Contrast to your example, a dependency injection framework typically deals with more complex object graphs, for example:

ModelLocator
  + --- ILoginViewModel
           + ---- IUserModel
           + ---- IUserPasswordModel
  + --- IUserPreferenceModel
           + ---- IUserAddressModel
                    + ---- CountryImpl
                    + ---- StateOrProvinceImpl
                    + ---- StreetAddressImpl
           + ---- IUserBlogPerefencesModel
                    + ---- ...
           + ---- IUserOpenLoginPerefencesModel
                    + ---- ...

Imagine what your init() method will have to do to set up something like that! 

I know, this is an extremely contrive example; the intend is to show you how complex the glue code can get. A dependency injection framework aims to simplify that kind of glue code, and allows you to define the dependencies in a central location. Swiz, Guice, and the Spring framework can give you an idea how dependencies are managed by the framework, instead of managed by code.

Not that there is anything wrong with the Factory pattern. However, just be aware the typical cons of the Factory pattern can apply to your technique. For example, if the Model has a complex object graph, your init() can get very complicated, and the developers working on this application may be tempted to have similar init() in other views (modules or other .mxml files), which puts the glue code in multiple places, making the code harder to organize.

A second opinion from me is that, based on my experience, the Model can typically be concrete; Models do not need dependency injection. This is because the _implementation_ of the Model typically doesn&#039;t need to change. Where dependency injection comes in handy is at the business logic layer, where you may have multiple implementation of the same interface, or an interface where the implementation can change frequently. In a Flex application, what is more likely to change is how events are dispatched. As example, a complicated command with dependencies to multiple services (HttpService, RemoteObject, maybe a BlazeDS consumer/producer) is something where the dependencies should be managed by a framework, since the services associated with the command may change frequently due to changes in business rules.</description>
		<content:encoded><![CDATA[<p>Hi Poison,</p>
<p>I recently reviewed all four frameworks you mentioned. I&#8217;ve found Cairngorm lacking because its design seems to encourage developers to strongly couple application components. I have decided to use the Swiz framework for the first Flex project for my team. I see that you have used out Swiz before. Swiz does a good job at allowing code to be loosely coupled via autowiring and dependency injection. Is it possible that the use of Swiz framework, plus a MVC pattern similar to Cairngorm, will do a better job at simplifying your code?</p>
<p>Looking at your code, I&#8217;m wondering what you mean by dependency injection. The dependencies are still embedded in the code (in this case, the view). The dependency injection pattern means that the glue code (or code that specifies dependencies of each object) are moved to a central location and that the dependencies of the object graph is automatically maintained for you. </p>
<p>To be brief, the technique used by you is more like the Factory pattern, where a method defines the relationship of the objects in your framework. </p>
<p>Specifically, following code more or less defines your factory object/method :</p>
<p>private var appModel:AppModelLocator = AppModelLocator.getInstance()<br />
&#8230;<br />
appModel.loginViewModel = new LoginViewModel();</p>
<p>Note that these few lines strongly couples your view (or Factory object) to the AppModel and the ILoginViewModel implementation. </p>
<p>I noticed your code has a very simple model, and your use of the init() method easily sets up everything you need.</p>
<p>ModelLocator -&gt; ILoginViewModel</p>
<p>Contrast to your example, a dependency injection framework typically deals with more complex object graphs, for example:</p>
<p>ModelLocator<br />
  + &#8212; ILoginViewModel<br />
           + &#8212;- IUserModel<br />
           + &#8212;- IUserPasswordModel<br />
  + &#8212; IUserPreferenceModel<br />
           + &#8212;- IUserAddressModel<br />
                    + &#8212;- CountryImpl<br />
                    + &#8212;- StateOrProvinceImpl<br />
                    + &#8212;- StreetAddressImpl<br />
           + &#8212;- IUserBlogPerefencesModel<br />
                    + &#8212;- &#8230;<br />
           + &#8212;- IUserOpenLoginPerefencesModel<br />
                    + &#8212;- &#8230;</p>
<p>Imagine what your init() method will have to do to set up something like that! </p>
<p>I know, this is an extremely contrive example; the intend is to show you how complex the glue code can get. A dependency injection framework aims to simplify that kind of glue code, and allows you to define the dependencies in a central location. Swiz, Guice, and the Spring framework can give you an idea how dependencies are managed by the framework, instead of managed by code.</p>
<p>Not that there is anything wrong with the Factory pattern. However, just be aware the typical cons of the Factory pattern can apply to your technique. For example, if the Model has a complex object graph, your init() can get very complicated, and the developers working on this application may be tempted to have similar init() in other views (modules or other .mxml files), which puts the glue code in multiple places, making the code harder to organize.</p>
<p>A second opinion from me is that, based on my experience, the Model can typically be concrete; Models do not need dependency injection. This is because the _implementation_ of the Model typically doesn&#8217;t need to change. Where dependency injection comes in handy is at the business logic layer, where you may have multiple implementation of the same interface, or an interface where the implementation can change frequently. In a Flex application, what is more likely to change is how events are dispatched. As example, a complicated command with dependencies to multiple services (HttpService, RemoteObject, maybe a BlazeDS consumer/producer) is something where the dependencies should be managed by a framework, since the services associated with the command may change frequently due to changes in business rules.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Cairngorm with Dependency Injection (Part 1) by Cairngorm with Dependency Injection (Part 2) &#187; activepoison.com</title>
		<link>http://blog.activepoison.com/?p=235&#038;cpage=1#comment-294</link>
		<dc:creator>Cairngorm with Dependency Injection (Part 2) &#187; activepoison.com</dc:creator>
		<pubDate>Mon, 15 Jun 2009 19:05:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=235#comment-294</guid>
		<description>[...] Cairngorm with Dependency Injection (Part 1)  [...]</description>
		<content:encoded><![CDATA[<p>[...] Cairngorm with Dependency Injection (Part 1)  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using ASDoc in Flex Builder by graphic designer</title>
		<link>http://blog.activepoison.com/?p=31&#038;cpage=1#comment-287</link>
		<dc:creator>graphic designer</dc:creator>
		<pubDate>Sun, 17 May 2009 22:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=31#comment-287</guid>
		<description>I must say, I could not agree with you in 100%, but it?s just my opinion, which indeed could be wrong.
p.s. You have a very good template . Where did you find it?</description>
		<content:encoded><![CDATA[<p>I must say, I could not agree with you in 100%, but it?s just my opinion, which indeed could be wrong.<br />
p.s. You have a very good template . Where did you find it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Using ASDoc in Flex Builder by Poison</title>
		<link>http://blog.activepoison.com/?p=31&#038;cpage=1#comment-10</link>
		<dc:creator>Poison</dc:creator>
		<pubDate>Sat, 09 Aug 2008 05:05:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.activepoison.com/?p=31#comment-10</guid>
		<description>One thing before I forget make sure to delete all of the old docs that you may have in your source files before you try and create your own.</description>
		<content:encoded><![CDATA[<p>One thing before I forget make sure to delete all of the old docs that you may have in your source files before you try and create your own.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

