<?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: Front Controllers Should NOT Extend Application.cfc</title>
	<atom:link href="http://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/</link>
	<description>Thoughts, rants, and even some code from the mind of Barney Boisvert.</description>
	<lastBuildDate>Thu, 11 Sep 2014 09:58:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sean Smith</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-206115</link>
		<dc:creator>Sean Smith</dc:creator>
		<pubDate>Tue, 23 Feb 2010 18:25:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-206115</guid>
		<description>So, I have a question: 

If you have a front controller which in order: 
1) Fires application.cfc (by way of being a CF page) which defineds app data/settings)
2) Defines a request.context object (session, security login, other global per request stuff) 
3) Cfincludes the application page (cfm controller file) 
and 
4) Each controller gets it&#039;s page specific stuff (form data. etc.) by instantiating an object specific to that page, an object which extends a base class (object).

Then, either the page object or the base class (object) can redefine any application settings it needs to, on a per request basis. The application only defines default mappings, data sources, etc., but the page object never reads the application scope directly. Rather, a page object (or controller cfm if controllers aren&#039;t object based) would always read app settings from the context object, which gets created at every request by the front controller. The context object overrides settings created in application.cfc as the situation (the context) requires.

Or this kind of arrangement not the way to go?</description>
		<content:encoded><![CDATA[<p>So, I have a question: </p>
<p>If you have a front controller which in order:<br />
1) Fires application.cfc (by way of being a CF page) which defineds app data/settings)<br />
2) Defines a request.context object (session, security login, other global per request stuff)<br />
3) Cfincludes the application page (cfm controller file)<br />
and<br />
4) Each controller gets it's page specific stuff (form data. etc.) by instantiating an object specific to that page, an object which extends a base class (object).</p>
<p>Then, either the page object or the base class (object) can redefine any application settings it needs to, on a per request basis. The application only defines default mappings, data sources, etc., but the page object never reads the application scope directly. Rather, a page object (or controller cfm if controllers aren't object based) would always read app settings from the context object, which gets created at every request by the front controller. The context object overrides settings created in application.cfc as the situation (the context) requires.</p>
<p>Or this kind of arrangement not the way to go?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Micky Dionisio</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-206114</link>
		<dc:creator>Micky Dionisio</dc:creator>
		<pubDate>Tue, 23 Feb 2010 17:53:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-206114</guid>
		<description>@Barney,

You took the words right out of my mouth man. I agree with every single point you&#039;ve made as its totally in line with the golden rule to always favor composition over inheritance. Excellent post man!

When you have a chance, we&#039;re working on a project called &lt;a href=&quot;http://cfcommons.org/&quot; rel=&quot;nofollow&quot;&gt;cfcommons&lt;/a&gt;, created by Brian Carr. There will be a Part 2 follow up from &lt;a href=&quot;http://mickydionisio.blogspot.com/2010/02/building-cfcommons-application.html&quot; rel=&quot;nofollow&quot;&gt;Part 1&lt;/a&gt; in which we will implement SimpleMVC to build it into a proper web application where we use composition in Application.cfc instead of inheritance.

We&#039;d love your thoughts, thanks man!</description>
		<content:encoded><![CDATA[<p>@Barney,</p>
<p>You took the words right out of my mouth man. I agree with every single point you've made as its totally in line with the golden rule to always favor composition over inheritance. Excellent post man!</p>
<p>When you have a chance, we're working on a project called <a href="http://cfcommons.org/" rel="nofollow">cfcommons</a>, created by Brian Carr. There will be a Part 2 follow up from <a href="http://mickydionisio.blogspot.com/2010/02/building-cfcommons-application.html" rel="nofollow">Part 1</a> in which we will implement SimpleMVC to build it into a proper web application where we use composition in Application.cfc instead of inheritance.</p>
<p>We'd love your thoughts, thanks man!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: barneyb</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-206111</link>
		<dc:creator>barneyb</dc:creator>
		<pubDate>Tue, 23 Feb 2010 17:33:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-206111</guid>
		<description>Regarding &quot;Application.cfc IS a front controller&quot;, I&#039;ll agree, but it is also a persistence manager and an event listener.  Adobe&#039;s choice to force you to use a single construct for all of these things puts the developer in a rather tight spot.  I much prefer Application.cfm to Application.cfc for exactly this reason, but unfortunately you cannot use CF mappings, default datasource, or ORM configuration unless you use Application.cfc.

And Ray, yes, it is possible that &quot;evil&quot; is too strong a word.  However, I literally don&#039;t have a single multi-template application (personal or at work) where FW/1&#039;s requirement of having my Application.cfc extend the framework isn&#039;t a dealbreaker.  This is undoubtedly due in part to personal style, but the fact remains: the front controller is NOT the application.  If we could define the application-y stuff outside Application.cfc, then Application.cfc being hijacked by a front controller is no big deal (and would be desirable).  But as it stands today, you don&#039;t have that choice.</description>
		<content:encoded><![CDATA[<p>Regarding "Application.cfc IS a front controller", I'll agree, but it is also a persistence manager and an event listener.  Adobe's choice to force you to use a single construct for all of these things puts the developer in a rather tight spot.  I much prefer Application.cfm to Application.cfc for exactly this reason, but unfortunately you cannot use CF mappings, default datasource, or ORM configuration unless you use Application.cfc.</p>
<p>And Ray, yes, it is possible that "evil" is too strong a word.  However, I literally don't have a single multi-template application (personal or at work) where FW/1's requirement of having my Application.cfc extend the framework isn't a dealbreaker.  This is undoubtedly due in part to personal style, but the fact remains: the front controller is NOT the application.  If we could define the application-y stuff outside Application.cfc, then Application.cfc being hijacked by a front controller is no big deal (and would be desirable).  But as it stands today, you don't have that choice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mitch Rose</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-206037</link>
		<dc:creator>Mitch Rose</dc:creator>
		<pubDate>Tue, 23 Feb 2010 04:07:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-206037</guid>
		<description>Purists begone! Sean, really, it&#039;s not a straw man argument. Sometimes you have barely enough time to get the job done, nevermind rewrite all that accumulated spaghetti or consolidate existing framework based code. The lesson: don&#039;t inherit from multiple frameworks and drive.</description>
		<content:encoded><![CDATA[<p>Purists begone! Sean, really, it's not a straw man argument. Sometimes you have barely enough time to get the job done, nevermind rewrite all that accumulated spaghetti or consolidate existing framework based code. The lesson: don't inherit from multiple frameworks and drive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martijn van der Woud</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-205777</link>
		<dc:creator>Martijn van der Woud</dc:creator>
		<pubDate>Sat, 20 Feb 2010 08:46:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-205777</guid>
		<description>@Sean, it is good to know that we can still use the cfapplication tag in App.cfc-powered apps. I did not know that. But I guess there are still many things you cannot do with this tag, like mappings and ORM settings. With the cfadmin tag on Railo (I mentioned that one earlier) you can indeed do anything you can do in the App.cfc pseudo-constructor. Actually I believe that Railo&#039;s admin GUI is using this tag internally for managing datasources, mappings, archives, cache settings and all the other Railo awesomeness.

Railo is a good example of providing the flexibility and choice that I personally like so much. For instance I have four ways to define a datasource:
- this.datasource in App.cfc (http://www.railo.ch/blog/index.cfm/2010/2/19/Random-Friday-Railo-tip-thisdatasource) - datasource is Application-specific
- the web administrator GUI - datasource is web-context specific
- the server administrator GUI - datasource is server-wide
- the cfadmin tag - datasource is either web-context specific or server-wide, depending on tag attributes

That said, I think I see your point of frameworks being successful because they do NOT provide flexibility and are built from the perspective of running an app instead of being run by it. I do not particularly like it from a design standpoint. But I guess it makes working together more easy if everyone is forced to do things the same way. And honestly that might be more important than losing some flexibility. And maybe most people find it comfortable to be forced to do things in some standard way. It&#039;s just one more thing you don&#039;t have to think about, which is a legitimate line of thought of course. I guess I am not like most people ;-)

As for your comment that &quot;cfWheels, ColdBox, Fusebox, FW/1, Mach-II, Model-Glue all dictate how your application runs.&quot; True. But some frameworks are more restrictive than others. For example, ColdBox forces my App.cfc to extend their coldbox.system.coldbox cfc. And the framework is loaded in the onApplicationStart event handler. ModelGlue does not force my App.cfc to extend anything, and is loaded by a cfinclude in index.cfm Personally I think the latter is more elegant and allows for greater flexibility, like having .cfm templates in the same app that do NOT use the framework.</description>
		<content:encoded><![CDATA[<p>@Sean, it is good to know that we can still use the cfapplication tag in App.cfc-powered apps. I did not know that. But I guess there are still many things you cannot do with this tag, like mappings and ORM settings. With the cfadmin tag on Railo (I mentioned that one earlier) you can indeed do anything you can do in the App.cfc pseudo-constructor. Actually I believe that Railo's admin GUI is using this tag internally for managing datasources, mappings, archives, cache settings and all the other Railo awesomeness.</p>
<p>Railo is a good example of providing the flexibility and choice that I personally like so much. For instance I have four ways to define a datasource:<br />
- this.datasource in App.cfc (<a href="http://www.railo.ch/blog/index.cfm/2010/2/19/Random-Friday-Railo-tip-thisdatasource" rel="nofollow">http://www.railo.ch/blog/index.cfm/2010/2/19/Random-Friday-Railo-tip-thisdatasource</a>) &#8211; datasource is Application-specific<br />
- the web administrator GUI &#8211; datasource is web-context specific<br />
- the server administrator GUI &#8211; datasource is server-wide<br />
- the cfadmin tag &#8211; datasource is either web-context specific or server-wide, depending on tag attributes</p>
<p>That said, I think I see your point of frameworks being successful because they do NOT provide flexibility and are built from the perspective of running an app instead of being run by it. I do not particularly like it from a design standpoint. But I guess it makes working together more easy if everyone is forced to do things the same way. And honestly that might be more important than losing some flexibility. And maybe most people find it comfortable to be forced to do things in some standard way. It's just one more thing you don't have to think about, which is a legitimate line of thought of course. I guess I am not like most people ;-)</p>
<p>As for your comment that "cfWheels, ColdBox, Fusebox, FW/1, Mach-II, Model-Glue all dictate how your application runs." True. But some frameworks are more restrictive than others. For example, ColdBox forces my App.cfc to extend their coldbox.system.coldbox cfc. And the framework is loaded in the onApplicationStart event handler. ModelGlue does not force my App.cfc to extend anything, and is loaded by a cfinclude in index.cfm Personally I think the latter is more elegant and allows for greater flexibility, like having .cfm templates in the same app that do NOT use the framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean Corfield</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-205733</link>
		<dc:creator>Sean Corfield</dc:creator>
		<pubDate>Fri, 19 Feb 2010 21:47:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-205733</guid>
		<description>@Martijn, you know you can still use the cfapplication tag with Application.cfc-powered apps? And on Railo, you can use cfapplication to modify existing settings (as well as simply overwrite them) and I think you can do everything via the tag that you can set via Application.cfc (mappings, custom tag paths, default datasource etc).

Like Ray, I can&#039;t imagine trying to use multiple MVC frameworks in a single app so that&#039;s a straw man argument.

As for &quot;Framework authors should provide their users with as much flexibility as possible, regarding the way their framework is invoked.&quot; - absolutely not true. The framework runs the application by definition. Ruby on Rails is successful because it is opinionated software. cfWheels, ColdBox, Fusebox, FW/1, Mach-II, Model-Glue all dictate how your application runs. They  all &quot;force&quot; you to do certain things in particular ways.

You mentioned the &quot;Hollywood Principle&quot; earlier but you got it the wrong way round: the frameworks all follow that principle in that you do not &quot;call&quot; the framework, it calls you. You write CFCs and .cfm pages and the *framework* calls methods on those CFCs and includes those pages.

Now, it&#039;s perfectly fair comment if you don&#039;t like that approach but I don&#039;t think there are any (application) frameworks in the CFML world where your code acts as the controller and invokes the framework...</description>
		<content:encoded><![CDATA[<p>@Martijn, you know you can still use the cfapplication tag with Application.cfc-powered apps? And on Railo, you can use cfapplication to modify existing settings (as well as simply overwrite them) and I think you can do everything via the tag that you can set via Application.cfc (mappings, custom tag paths, default datasource etc).</p>
<p>Like Ray, I can't imagine trying to use multiple MVC frameworks in a single app so that's a straw man argument.</p>
<p>As for "Framework authors should provide their users with as much flexibility as possible, regarding the way their framework is invoked." &#8211; absolutely not true. The framework runs the application by definition. Ruby on Rails is successful because it is opinionated software. cfWheels, ColdBox, Fusebox, FW/1, Mach-II, Model-Glue all dictate how your application runs. They  all "force" you to do certain things in particular ways.</p>
<p>You mentioned the "Hollywood Principle" earlier but you got it the wrong way round: the frameworks all follow that principle in that you do not "call" the framework, it calls you. You write CFCs and .cfm pages and the *framework* calls methods on those CFCs and includes those pages.</p>
<p>Now, it's perfectly fair comment if you don't like that approach but I don't think there are any (application) frameworks in the CFML world where your code acts as the controller and invokes the framework&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martijn van der Woud</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-205730</link>
		<dc:creator>Martijn van der Woud</dc:creator>
		<pubDate>Fri, 19 Feb 2010 20:55:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-205730</guid>
		<description>@Raymond you are right about &quot;evil&quot; - and &quot;mindless choice&quot;. Compared to that, Sean was being polite. Point taken.</description>
		<content:encoded><![CDATA[<p>@Raymond you are right about "evil" &#8211; and "mindless choice". Compared to that, Sean was being polite. Point taken.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raymond Camden</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-205728</link>
		<dc:creator>Raymond Camden</dc:creator>
		<pubDate>Fri, 19 Feb 2010 20:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-205728</guid>
		<description>Ok, not broken, but &quot;evil&quot;. Come on - you have to admit thats a strong term. ;)

1) I concur.

2) I guess I just don&#039;t see the concern in this - I&#039;d never use FW/1 and Model-Glue in the same app.

As for being positive and not complaining, again, I&#039;ll point out Barney&#039;s words here - &quot;evil&quot;, and &quot;The first problem is due to Adobe&#039;s seemingly mindless choice&quot;. Those are strong statements and not very constructive I think.</description>
		<content:encoded><![CDATA[<p>Ok, not broken, but "evil". Come on &#8211; you have to admit thats a strong term. ;)</p>
<p>1) I concur.</p>
<p>2) I guess I just don't see the concern in this &#8211; I'd never use FW/1 and Model-Glue in the same app.</p>
<p>As for being positive and not complaining, again, I'll point out Barney's words here &#8211; "evil", and "The first problem is due to Adobe's seemingly mindless choice". Those are strong statements and not very constructive I think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martijn van der Woud</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-205725</link>
		<dc:creator>Martijn van der Woud</dc:creator>
		<pubDate>Fri, 19 Feb 2010 20:39:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-205725</guid>
		<description>I never stated that App.cfc was &#039;broken&#039;. And I do not think that Barney was trying to assert that either.

Two points that are important as I see it: 
1) It would (sometimes) be practical if per-request settings could be defined anywhere, instead of being restricted to the App.cfc pseudoconstructor

2) Framework authors should provide their users with as much flexibility as possible, regarding the way their framework is invoked. If two frameworks force me to extend their base App.cfc, then it is impossible for me to use both frameworks together. It is all a matter of perspective I guess: is the framework running my application? Or is my application using the framework? I personally personally prefer the latter. 

@Sean
&quot;Personally, I like the way Application.cfc works. I don&#039;t have any problems with its per-request nature. Application.cfm was per-request too, so I don&#039;t really get what you&#039;re complaining about anywayâ€¦ &quot;

It is not the per-request nature of Application.cfc I have a problem with, but the restriction that per-request settings be defined there and nowhere else. 

Also, we are trying to exchange technical opinions here, so that we all may learn from each other. If we don&#039;t agree with each other, that&#039;s for the best. If we all agreed nobody could learn from this discussion. I must say that I find your labeling this as &quot;complaining&quot; a bit demeaning. Please keep it positive!</description>
		<content:encoded><![CDATA[<p>I never stated that App.cfc was 'broken'. And I do not think that Barney was trying to assert that either.</p>
<p>Two points that are important as I see it:<br />
1) It would (sometimes) be practical if per-request settings could be defined anywhere, instead of being restricted to the App.cfc pseudoconstructor</p>
<p>2) Framework authors should provide their users with as much flexibility as possible, regarding the way their framework is invoked. If two frameworks force me to extend their base App.cfc, then it is impossible for me to use both frameworks together. It is all a matter of perspective I guess: is the framework running my application? Or is my application using the framework? I personally personally prefer the latter. </p>
<p>@Sean<br />
"Personally, I like the way Application.cfc works. I don't have any problems with its per-request nature. Application.cfm was per-request too, so I don't really get what you're complaining about anywayâ€¦ "</p>
<p>It is not the per-request nature of Application.cfc I have a problem with, but the restriction that per-request settings be defined there and nowhere else. </p>
<p>Also, we are trying to exchange technical opinions here, so that we all may learn from each other. If we don't agree with each other, that's for the best. If we all agreed nobody could learn from this discussion. I must say that I find your labeling this as "complaining" a bit demeaning. Please keep it positive!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raymond Camden</title>
		<link>https://www.barneyb.com/barneyblog/2010/02/12/applicationcfc-extends-front-controller-is-evil/comment-page-1/#comment-205719</link>
		<dc:creator>Raymond Camden</dc:creator>
		<pubDate>Fri, 19 Feb 2010 19:23:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.barneyb.com/barneyblog/?p=1221#comment-205719</guid>
		<description>I have to echo Sean here. While I saw an interesting ideas here (re: setting up mappings differently), but I&#039;ve yet to see any proof/reason why App.cfc is &quot;broken&quot;.</description>
		<content:encoded><![CDATA[<p>I have to echo Sean here. While I saw an interesting ideas here (re: setting up mappings differently), but I've yet to see any proof/reason why App.cfc is "broken".</p>
]]></content:encoded>
	</item>
</channel>
</rss>
