<?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: Why the Zend Framework Actionstack is Evil</title>
	<atom:link href="http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/</link>
	<description>Randomness will get you everywhere.</description>
	<lastBuildDate>Wed, 03 Mar 2010 11:34:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: admin</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-535</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 18 Feb 2010 19:10:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-535</guid>
		<description>Dan: Sorry, the action view helper does much more than this, it grabs the request, and dispatcher from the front controller, and clones them, then dispatches a whole new request to run the actual action your asking for. its a terrible waste! (and will include a layout if your not careful)</description>
		<content:encoded><![CDATA[<p>Dan: Sorry, the action view helper does much more than this, it grabs the request, and dispatcher from the front controller, and clones them, then dispatches a whole new request to run the actual action your asking for. its a terrible waste! (and will include a layout if your not careful)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Moore</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-490</link>
		<dc:creator>Dan Moore</dc:creator>
		<pubDate>Tue, 02 Feb 2010 02:22:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-490</guid>
		<description>I&#039;m a noob to Zend, is the Action View Helper the thing that takes controller/action and finds the corresponding view script in the views directory and echoes it? (or includes it in the site wide layout as -&gt;content)</description>
		<content:encoded><![CDATA[<p>I&#8217;m a noob to Zend, is the Action View Helper the thing that takes controller/action and finds the corresponding view script in the views directory and echoes it? (or includes it in the site wide layout as -&gt;content)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Mauger</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-419</link>
		<dc:creator>Ryan Mauger</dc:creator>
		<pubDate>Wed, 16 Dec 2009 09:22:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-419</guid>
		<description>Actually Christian, There are far more solutions that the three you outlined, and the three you have, are pretty terrible imo.
An action should actually *do* something useful. The thought of using an action just to fill one small chunk of a page makes me shudder at best.
To make widgetised content the best solution is by far to create a view helper for each widget, which can then render a partial after passing it content from the db. this gives the nice seperation of concerns, while avoiding having the dispatch loop bounce around creating masses of extra opportunities for bugs, making it hard to see the execution flow directly, and loads of extra overhead.
Also note, if you need a different template for each page, you are working very inefficiently. You should be able to manage your articles to be displayed on a particular page without the need of a template for each permutation, and it should also be possible to do this without hardcoding this into the template. Infact I would go so far as to say that if you require this many templates for your pages, then you have simply hardcodeded this elsewhere, shifting it, rather than eliminating it.</description>
		<content:encoded><![CDATA[<p>Actually Christian, There are far more solutions that the three you outlined, and the three you have, are pretty terrible imo.<br />
An action should actually *do* something useful. The thought of using an action just to fill one small chunk of a page makes me shudder at best.<br />
To make widgetised content the best solution is by far to create a view helper for each widget, which can then render a partial after passing it content from the db. this gives the nice seperation of concerns, while avoiding having the dispatch loop bounce around creating masses of extra opportunities for bugs, making it hard to see the execution flow directly, and loads of extra overhead.<br />
Also note, if you need a different template for each page, you are working very inefficiently. You should be able to manage your articles to be displayed on a particular page without the need of a template for each permutation, and it should also be possible to do this without hardcoding this into the template. Infact I would go so far as to say that if you require this many templates for your pages, then you have simply hardcodeded this elsewhere, shifting it, rather than eliminating it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tehla</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-415</link>
		<dc:creator>Tehla</dc:creator>
		<pubDate>Wed, 09 Dec 2009 21:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-415</guid>
		<description>Hi, 

Thanks for your comments Christian, but what do you mean by &quot;the layout is controlled via configuration&quot; ? An .ini file ? Where do these settings (?) come from ?

I&#039; m a beginer in ZF, and I &#039;m looking for the best way to use ZF with on multi-widget site. And especially by ActionStack ^^</description>
		<content:encoded><![CDATA[<p>Hi, </p>
<p>Thanks for your comments Christian, but what do you mean by &#8220;the layout is controlled via configuration&#8221; ? An .ini file ? Where do these settings (?) come from ?</p>
<p>I&#8217; m a beginer in ZF, and I &#8216;m looking for the best way to use ZF with on multi-widget site. And especially by ActionStack ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-413</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Fri, 04 Dec 2009 09:58:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-413</guid>
		<description>I know this post is quite old, but I stumbled on this discussion when solving an ActionStack issue.

I agree with the ActionHelper but I totally disagree regarding the ActionStack. If you are developing reusable components like mentioned in some earlier posts the ActionStack is an essential part of it. Why?

Let&#039;s think of a simple action &quot;listArticles&quot; and of a webpage consisting of 50+ pages where on each page a specific set of articles is to be displayed. The action itself may parameterized by: the number of articles to display, the category where the articles originate from and so on...

Now, you end up with the situation, that you need to define *somewhere* which articles to display on a requested page and *where* on the page.

There are several solutions:

(1) Have one pageAction which is always called for rendering a page. The pageAction reads the configuration of the page from e.g. an xml file or from database

(2) Have a PageController Plugin which hooks into routeShutdown() and builds up an *ActionStack* from an xml file or database

(3) Have an action for each concrete page (pretty bad idea)

In case (1) the &quot;pageAction&quot; would compile a concrete view template for the requested page - one for each page - as each page looks different in our case. Each view template would consist of one or several partials that query directly on the model. Now, you have the logical part of &quot;what model data to display&quot; in a view template?? Even if you parameterize the partial via view variables you still &quot;hard code&quot; that you want do display articles at exactly this position in the view script. Of course, if you work with Zend_Layout, you may alter the position, but still the logic of &quot;what to display&quot; is hard coded in the page template (and it&#039;s one out of 50 templates if you remember)

(2) If you work with a plugin that makes use of the Action Stack you work completely view independent. At routeShutdown() you can compile (via xml or db) a set of actions to render for this concrete page (e.g. 3 x list articles, 1 x navigation, 1 x newsletter subscription, ...) - each with different parameters of course. In this case, an action is seen as an reusable component - reusable within a page and reusable on several pages. You can even load the position (layout target) and the to-be-used template via configuration. For the listArticlesAction you may have several templates to choose from: simple / extended / blogstyle - but all this is controlled via configuration, not in a controller or a view partial. Further more, you can specify the layout target when using Zend_Layout. This way it&#039;s possible to render an action and it&#039;s view into a specific position defined only via configuration.

(3) I won&#039;t argue on that one :)

Feel free to comment on these thoughts - maybe I couldn&#039;t state my point clearly. An example which is build upon (2) is our financial portal: http://www.godmode-trader.de/

Obviously, the &quot;PageController&quot; concept collides with a simple MVC setup in this case. I would be happy about any other suggestions how to solve such requirements efficiently with Zend_MVC.</description>
		<content:encoded><![CDATA[<p>I know this post is quite old, but I stumbled on this discussion when solving an ActionStack issue.</p>
<p>I agree with the ActionHelper but I totally disagree regarding the ActionStack. If you are developing reusable components like mentioned in some earlier posts the ActionStack is an essential part of it. Why?</p>
<p>Let&#8217;s think of a simple action &#8220;listArticles&#8221; and of a webpage consisting of 50+ pages where on each page a specific set of articles is to be displayed. The action itself may parameterized by: the number of articles to display, the category where the articles originate from and so on&#8230;</p>
<p>Now, you end up with the situation, that you need to define *somewhere* which articles to display on a requested page and *where* on the page.</p>
<p>There are several solutions:</p>
<p>(1) Have one pageAction which is always called for rendering a page. The pageAction reads the configuration of the page from e.g. an xml file or from database</p>
<p>(2) Have a PageController Plugin which hooks into routeShutdown() and builds up an *ActionStack* from an xml file or database</p>
<p>(3) Have an action for each concrete page (pretty bad idea)</p>
<p>In case (1) the &#8220;pageAction&#8221; would compile a concrete view template for the requested page &#8211; one for each page &#8211; as each page looks different in our case. Each view template would consist of one or several partials that query directly on the model. Now, you have the logical part of &#8220;what model data to display&#8221; in a view template?? Even if you parameterize the partial via view variables you still &#8220;hard code&#8221; that you want do display articles at exactly this position in the view script. Of course, if you work with Zend_Layout, you may alter the position, but still the logic of &#8220;what to display&#8221; is hard coded in the page template (and it&#8217;s one out of 50 templates if you remember)</p>
<p>(2) If you work with a plugin that makes use of the Action Stack you work completely view independent. At routeShutdown() you can compile (via xml or db) a set of actions to render for this concrete page (e.g. 3 x list articles, 1 x navigation, 1 x newsletter subscription, &#8230;) &#8211; each with different parameters of course. In this case, an action is seen as an reusable component &#8211; reusable within a page and reusable on several pages. You can even load the position (layout target) and the to-be-used template via configuration. For the listArticlesAction you may have several templates to choose from: simple / extended / blogstyle &#8211; but all this is controlled via configuration, not in a controller or a view partial. Further more, you can specify the layout target when using Zend_Layout. This way it&#8217;s possible to render an action and it&#8217;s view into a specific position defined only via configuration.</p>
<p>(3) I won&#8217;t argue on that one <img src='http://www.rmauger.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Feel free to comment on these thoughts &#8211; maybe I couldn&#8217;t state my point clearly. An example which is build upon (2) is our financial portal: <a href="http://www.godmode-trader.de/" rel="nofollow">http://www.godmode-trader.de/</a></p>
<p>Obviously, the &#8220;PageController&#8221; concept collides with a simple MVC setup in this case. I would be happy about any other suggestions how to solve such requirements efficiently with Zend_MVC.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RiotRick</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-390</link>
		<dc:creator>RiotRick</dc:creator>
		<pubDate>Fri, 09 Oct 2009 15:19:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-390</guid>
		<description>Indeed actionstack is not evil. It is extremely useful in certain applications. 

Basically we have done something similar as in reply #14.

Divided a page into seperate blocks (using Zend_Layout). Each block can display content which is provided by a content provider module. This content provider module is created as a module in ZF with it&#039;s own MVC structure. 

So basically this way we can create independent modules with their own mvc structure, which can be shared among different websites. 

We can add different modules to different layout blocks on the page. 

In order to run and render all these blocks we loop through all defined blocks on a page and run the linked module/controller/action with the action stack. 

Sure this will give a bit overhead, but it makes life a lot easier in developing seperate re-usable content modules.</description>
		<content:encoded><![CDATA[<p>Indeed actionstack is not evil. It is extremely useful in certain applications. </p>
<p>Basically we have done something similar as in reply #14.</p>
<p>Divided a page into seperate blocks (using Zend_Layout). Each block can display content which is provided by a content provider module. This content provider module is created as a module in ZF with it&#8217;s own MVC structure. </p>
<p>So basically this way we can create independent modules with their own mvc structure, which can be shared among different websites. </p>
<p>We can add different modules to different layout blocks on the page. </p>
<p>In order to run and render all these blocks we loop through all defined blocks on a page and run the linked module/controller/action with the action stack. </p>
<p>Sure this will give a bit overhead, but it makes life a lot easier in developing seperate re-usable content modules.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Federico Cargnelutti (fedecarg) 's status on Friday, 09-Oct-09 11:12:47 UTC - Identi.ca</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-389</link>
		<dc:creator>Federico Cargnelutti (fedecarg) 's status on Friday, 09-Oct-09 11:12:47 UTC - Identi.ca</dc:creator>
		<pubDate>Fri, 09 Oct 2009 11:13:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-389</guid>
		<description>[...]  http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/        a few seconds ago  from web [...]</description>
		<content:encoded><![CDATA[<p>[...]  <a href="http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/" rel="nofollow">http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/</a>        a few seconds ago  from web [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hello World from Zend MVC &#171; web(cslai)</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-329</link>
		<dc:creator>Hello World from Zend MVC &#171; web(cslai)</dc:creator>
		<pubDate>Tue, 08 Sep 2009 14:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-329</guid>
		<description>[...] am not sure whether action stack is HMVC, however, I like the way it works (although it is evil). I will probably stick to action stack for the time being while finding out how partial view can [...]</description>
		<content:encoded><![CDATA[<p>[...] am not sure whether action stack is HMVC, however, I like the way it works (although it is evil). I will probably stick to action stack for the time being while finding out how partial view can [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-238</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Tue, 04 Aug 2009 07:08:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-238</guid>
		<description>Hi all! Nice article. But I have similar problems as &quot;Actionstack is not evil &quot; described.
Let&#039;s say, I have some calendar widget (fro simplicity assume that it is without AJAX). This widget allows some simple actions (hey, I called them ACTIONS, so they ask for some actionController!) like viewing next month or smth. like that. But this widget also has a link which allows calendar to open in full view so you can edit it - maybe mark your work schedule or smth like that. So to avoid having my calendar widget parts scattered around I guess I just HAVE TO keep everything calendar related in one place. And as I need some editing and full view abilities, so I just NEED calendar controller with different actions for editing in full view or using it as a small widget.

 It would be strange to implement full view as a controller but small view as a view helper, wouldn&#039;t it? Especially because this calendar in my case is dynamic - not every logged-in user needs it so I HAVE TO GO through some other mechanism to find out if current user has permission and need to load some particular widget. And all these widgets are registered in some database table to know who can load them and in which part of layout they should be displayed.

Anyway, also each widget needs some shared code to find out if someone is logged in and alos to find out what rights current user has for this widget - view only, edit own, view other persons calendars and so on.

I agree, that it is bad to have action stack dispatching happening many times. So, how should I organize all this in my case with a calendar when I need a separate controller for calendar anyway?

Thanks for any ideas.</description>
		<content:encoded><![CDATA[<p>Hi all! Nice article. But I have similar problems as &#8220;Actionstack is not evil &#8221; described.<br />
Let&#8217;s say, I have some calendar widget (fro simplicity assume that it is without AJAX). This widget allows some simple actions (hey, I called them ACTIONS, so they ask for some actionController!) like viewing next month or smth. like that. But this widget also has a link which allows calendar to open in full view so you can edit it &#8211; maybe mark your work schedule or smth like that. So to avoid having my calendar widget parts scattered around I guess I just HAVE TO keep everything calendar related in one place. And as I need some editing and full view abilities, so I just NEED calendar controller with different actions for editing in full view or using it as a small widget.</p>
<p> It would be strange to implement full view as a controller but small view as a view helper, wouldn&#8217;t it? Especially because this calendar in my case is dynamic &#8211; not every logged-in user needs it so I HAVE TO GO through some other mechanism to find out if current user has permission and need to load some particular widget. And all these widgets are registered in some database table to know who can load them and in which part of layout they should be displayed.</p>
<p>Anyway, also each widget needs some shared code to find out if someone is logged in and alos to find out what rights current user has for this widget &#8211; view only, edit own, view other persons calendars and so on.</p>
<p>I agree, that it is bad to have action stack dispatching happening many times. So, how should I organize all this in my case with a calendar when I need a separate controller for calendar anyway?</p>
<p>Thanks for any ideas.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruno</title>
		<link>http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/comment-page-1/#comment-212</link>
		<dc:creator>Bruno</dc:creator>
		<pubDate>Mon, 29 Jun 2009 12:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.rmauger.co.uk/?p=45#comment-212</guid>
		<description>Good one!

This kind of article is very useful for initiationby the fact of Zend&#039;s hard first steps and newcomers without such experience are tempted to use this features.

Hail!</description>
		<content:encoded><![CDATA[<p>Good one!</p>
<p>This kind of article is very useful for initiationby the fact of Zend&#8217;s hard first steps and newcomers without such experience are tempted to use this features.</p>
<p>Hail!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
