Good books on Web Application Architecture (was RE: CFMODULE vs. CFINCLUDE)
Which brings up a follow on thread: What would you recommend as good reading on Architecture? Jerry Jerry Johnson Web Developer Dolan Media Company >>> [EMAIL PROTECTED] 12/02/04 02:53AM >>> To write a good application, knowing ColdFusion is only 1% and most people don't seem to understand that until they are confronted with architectures providing speed, reliability, robustness and developer support. Most people then start buying books about architecture.. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185926 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
And with a box hitting +250 req/sec on a custom tag based application on a single CPU, I haven't. The whole performance situation depends on the application, as well as the code in the custom tags. If you experience serious performance problems due to IO traffic, or heavy custom tag execution, people should seriously consider caching techniques. I personally stepped into a combination of cfmodule and cfc's. A lot of business logic can be persistent, and can be used in a application scope, preventing unneeded interpreting of reusable code. A combination of these can give you a killer app, but it strongly depends on your architecture. To write a good application, knowing ColdFusion is only 1% and most people don't seem to understand that until they are confronted with architectures providing speed, reliability, robustness and developer support. Most people then start buying books about architecture.. Micha Schopman Software Engineer Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185904 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> Wow, we're in the midst of another list jihad and its not about > FuseBox. Go figure. I know, and somehow I stumbled right into it. Fortunately, it's an issue which makes no difference to me. :) > Anyway, he's probably using includes that don't contain a significant > degree of CF logic, which is arguably exactly what a simple display > header/footer is, or should be. Understood. It's a common practice. I've done it -- recently. Most people have done it. Before custom tags, it was the only method of code reuse in ColdFusion. It's easy. It provides the most rudimentary form of code reuse. In fact, I usually use cfincludes in my custom tags to shorten them up if they are over 50 lines. However, I try not to use cfinclude for the purpose of code reuse these days. It's not a particularly safe practice. Recent versions of ColdFusion provide much more appropriate methods for code reuse. There are other benefits to using custom tags, many of which I've noted. I started out trying to convey that. :) Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185863 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> CF 5 did release memory, while CF 4.0.1 didn't. I don't remember whether > CF 4.5.1 did or not. Thanks for the correction. I meant 4.0.1. We developed for and hosted on ColdFusion 4.0.1 until some time after 5 was released. Then we moved most of our stuff to 5. We are now migrating most of our stuff to ColdFusion MX 6.1, which seems to perform much better and seems to be much more stable than ColdFusion MX itself (I guess the version number was 6.0?). > We have had clients with CF 4 and CF 5 who had poor response times when > they heavily used custom tags, even for relatively simple tasks. After > restructuring their application to use fewer custom tags where possible, > they saw significantly improved response times with load testing and on > their live site. Fortunately, this doesn't seem to be nearly as serious an > issue with CFMX. That's good to know. We were load testing to ensure sites could handle a certain load (preventative). We do not get much in the way of customers looking for us to host applications that we did not write, much less performance tuning such sites. As noted in a previous message in this thread, we're not building large scale sites. Our sites tend to host under 1 million user sessions a month. Most of our sites see much less than this. No single site requires more than one Web server. When we load test, we're looking for bottlenecks, stability, and performance under a moderate load. Thanks for the clarification. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185858 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
>>I had some problems in ColdFusion 4.0, though I think >>(besides not giving up memory) most were squared away by 4.1. >>I don't think I deployed anything to (nor load tested on) >>4.5. ColdFusion 5 seemed to be better about giving up >>resources that weren't in use. >> >> > >CF 5 did release memory, while CF 4.0.1 didn't. I don't remember whether CF >4.5.1 did or not. > > If remember correctly 4.5.1/2 were better, but still not the best. Stephen ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185856 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
>And, frankly, I find if very difficult to believe that you've "never had a >problem". I can see where the use of naming conventions and such would help >prevent such problems. But to say you've never had a problem -- well, I >assume you're making use of hyperbole. Wow, we're in the midst of another list jihad and its not about FuseBox. Go figure. Anyway, he's probably using includes that don't contain a significant degree of CF logic, which is arguably exactly what a simple display header/footer is, or should be. Includes are not brain surgery, and perhaps thats the point. Use them for simpler, quickee, in-and-out needs. Don't build a 5000-line include loaded with complex logic, fresh variable assignments and 500 output values. By all means feel free to build one of any size that *reads* values (from whatever source) and decides what to do based on the reads. And of course you can blur the lines as you see fit in between since you are an intelligent developer who knows how to pick the right tool for the job. -- --Matt Robertson-- President, Janitor MSB Designs, Inc. mysecretbase.com ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185850 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> > Prior to CFMX, I've run into all sorts of performance problems > > with custom tags under load, not just ones that did recursion. > > Such as the aforementioned memory consumption or something > else? Poor response times. > I had some problems in ColdFusion 4.0, though I think > (besides not giving up memory) most were squared away by 4.1. > I don't think I deployed anything to (nor load tested on) > 4.5. ColdFusion 5 seemed to be better about giving up > resources that weren't in use. CF 5 did release memory, while CF 4.0.1 didn't. I don't remember whether CF 4.5.1 did or not. > Over the past few versions of ColdFusion, I load tested > various applications on various configurations. Most used > custom tags to some extent. In fact, the homegrown framework > I wrote made extensive use of custom tags, both to modularize > the code and handle permissions. I used (and load tested) > apps written in the framework at various points. > > Obviously, custom tags are more overhead than cfinclude. > However, I didn't see any overwhelming performance issues. > That's not to say they don't exist, just that I seemed have > gotten lucky...or my load testing was not very accurate. :) We have had clients with CF 4 and CF 5 who had poor response times when they heavily used custom tags, even for relatively simple tasks. After restructuring their application to use fewer custom tags where possible, they saw significantly improved response times with load testing and on their live site. Fortunately, this doesn't seem to be nearly as serious an issue with CFMX. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ phone: 202-797-5496 fax: 202-797-5444 ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185844 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> Prior to CFMX, I've run into all sorts of performance problems with custom > tags under load, not just ones that did recursion. Such as the aforementioned memory consumption or something else? I had some problems in ColdFusion 4.0, though I think (besides not giving up memory) most were squared away by 4.1. I don't think I deployed anything to (nor load tested on) 4.5. ColdFusion 5 seemed to be better about giving up resources that weren't in use. Over the past few versions of ColdFusion, I load tested various applications on various configurations. Most used custom tags to some extent. In fact, the homegrown framework I wrote made extensive use of custom tags, both to modularize the code and handle permissions. I used (and load tested) apps written in the framework at various points. Obviously, custom tags are more overhead than cfinclude. However, I didn't see any overwhelming performance issues. That's not to say they don't exist, just that I seemed have gotten lucky...or my load testing was not very accurate. :) Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185841 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> You'd have to use a hell of a lot custom tags for this to > ever become an issue. As noted in previous messages, I make > extensive use of custom tags and have yet to run into a > performance problem caused by the use of custom tags in the > manners described. > > I think this type of thinking goes back to a period of > ColdFusion development where custom tags were over used to > compensate for the lack of user-defined functions. This lead > to writing recursive custom tags that performed relatively > simple mathematical operations. The overhead of the tag > invocation was incommensurate with the work being performed. Prior to CFMX, I've run into all sorts of performance problems with custom tags under load, not just ones that did recursion. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ phone: 202-797-5496 fax: 202-797-5444 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185837 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
Depends on the efficiency of your construct. If you do it right, there are many. That CFC would just be apart of a larger OO schema. Phil -Original Message- From: Aaron Rouse [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 12:30 PM To: CF-Talk Subject: Re: CFMODULE vs. CFINCLUDE Would there be any advantage to doing this though? -- Aaron Rouse http://www.happyhacker.com/ On Wed, 1 Dec 2004 11:30:30 -0600, Phillip Holmes <[EMAIL PROTECTED]> wrote: > If running CFMX, you could always do this as well (with CFMODULE or > CFINCLUDE): > > >variables.iString = "#application.mapping#/testfiles/includeme.cfm"; >inc_obj = CreateObject('component','include'); >inc_obj.INCLUDE( iString: variables.iString); > > INCLUDE CFC contents: > > > > > > > > Regards, > > Phillip B. Holmes > > > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185834 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
Would there be any advantage to doing this though? -- Aaron Rouse http://www.happyhacker.com/ On Wed, 1 Dec 2004 11:30:30 -0600, Phillip Holmes <[EMAIL PROTECTED]> wrote: > If running CFMX, you could always do this as well (with CFMODULE or > CFINCLUDE): > > >variables.iString = "#application.mapping#/testfiles/includeme.cfm"; >inc_obj = CreateObject('component','include'); >inc_obj.INCLUDE( iString: variables.iString); > > > INCLUDE CFC contents: > > > > > > > > > Regards, > > Phillip B. Holmes > > > ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185832 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
We use this style too (for skinning) and the only difficulty we run into is the constraint that the opening and closing tags have to remain in the same logical scope on the page, so you can't conditionally open the tag at the top of the page and then conditionally close it at the bottom. This doesn't really turn out to be a problem but occasionally it requires some awkward maneuvering. Mark -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 11:56 AM To: CF-Talk Subject: Re: CFMODULE vs. CFINCLUDE I am going to regret this, but... We use a similar approach, and for the same reasons. But instead of the tag, we use . (No parameters are passed to the close tags.) Blah Jerry Jerry Johnson Web Developer Dolan Media Company >>> [EMAIL PROTECTED] 12/01/04 11:49AM >>> Our framework here uses the custom tag approach, not to imply it is the best way to go, just what has been in use here for years. So a typical page could be something like: Blah ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185831 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> You are quite correct. However, using cfmodule and custom tags is > potentially is server killer because it is EVERY call to the > cfmodule/tag and not just the first call that grabs additional memory. > So for every page call for every site visitor more memory is allocated > for each cfmodule. You'd have to use a hell of a lot custom tags for this to ever become an issue. As noted in previous messages, I make extensive use of custom tags and have yet to run into a performance problem caused by the use of custom tags in the manners described. I think this type of thinking goes back to a period of ColdFusion development where custom tags were over used to compensate for the lack of user-defined functions. This lead to writing recursive custom tags that performed relatively simple mathematical operations. The overhead of the tag invocation was incommensurate with the work being performed. > Showing my age a bit now.. cfmodule and cf in > general used to have a few problems with letting go of and reusing of > allocated memory, so I've become acustom to using cfincludes rather than > cfmodule, because of low resources in the memory department years back > and a need to make stable applications that didn't require me to restart > the server every couple of hours. (A slight exageration, but that did > used to happen with one of the sites I built back in 1997. It used to > get extremely high peeks of traffic at certain times of the day and it > used to take the server down by taking all the available memory. We > eventually worked out what the problem was, reworked a load of stuff in > the site and then site was rock solid - so solid that our poor old 128kb > line used to get topped out) I'm aware of other similar workarounds. Some developers would put all data in a structure, copy that structure to another structure before calling cfinclude, and then copying it back after the call. This turned out to be faster/require less memory than using cfmodule. That said, I have yet to see a situation since ColdFusion 5 (which introduced UDFs) which necessitates such drastic measures. > With regards "step all over your variables". Never had a problem. All > it takes is a little care, attention to detail and meaningful variable > names. What size projects do you tend to work on? I myself do not work on large projects. Most of the apps I've written fall in the 10,000 to 50,000 lines of code range and have anywhere from 1 to 5 developers working on them. I just finished a project which I spent 20 months on (35,000 lines of code). I find that even under these relatively modest circumstances, it's difficult to prevent stepping on data that doesn't belong to you unless you make good use of the encapsulation features inherent in the language. And, frankly, I find if very difficult to believe that you've "never had a problem". I can see where the use of naming conventions and such would help prevent such problems. But to say you've never had a problem -- well, I assume you're making use of hyperbole. > What's CFIMPORT? ~joke~ Most of my clients are still on CF5 About half our sites are on ColdFusion MX. I'm porting one of the larger ones right now, actually. It was written for ColdFusion 4. Consequently, even though it is currently running on ColdFusion 5, it doesn't even make extensive use of UDFs. I say this because I'm very cognizant of how far ColdFusion has come in the last 2 major versions -- first with UDFs, then with components. To this extent, I thought the point of the thread was to discuss the best practice now and how they may have changed from previous versions of ColdFusion. > (don't > fix what aint broke). Unfortunately, "the don't fix what ain't broke" mantra (a favorite or mine) doesn't work so well with publicly facing Web sites. The Web sites we design are more of a process, constantly revised and evolving. We have to support newer browsers, upgrade server software for better security, handle ever increasing loads, etc. > Personal feelings. Don't rag on mine just because I don't agree with you. No, this discussion is not just about personal feelings. Legibility may be largely personal preference. However, color coding (and even tag insight) provides very tangible benefits. And there's no way you can call encapsulation and parameter passing via attributes "personal feelings". > In a sense yes that is correct. By "tinker dynamically" I mean I can > replace the headers much more easily dynamically with cfinclude than I > can with cfmodule. I can have a directory full of different headers for > different occasions (images of Wurzel Gummage come to mind). I can > easily switch between headers by changing a single variable. Using a > CFMODULE, I have to pass some information into the tag that tells the > logic in the tag which bit of html to use. That html is either hard > coded into the module (yak!) or you cfinclude it (pointless call to > cfmodule). There are many other ways
RE: CFMODULE vs. CFINCLUDE
If running CFMX, you could always do this as well (with CFMODULE or CFINCLUDE): variables.iString = "#application.mapping#/testfiles/includeme.cfm"; inc_obj = CreateObject('component','include'); inc_obj.INCLUDE( iString: variables.iString); INCLUDE CFC contents: Regards, Phillip B. Holmes -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 10:56 AM To: CF-Talk Subject: Re: CFMODULE vs. CFINCLUDE I am going to regret this, but... We use a similar approach, and for the same reasons. But instead of the tag, we use . (No parameters are passed to the close tags.) Blah Jerry Jerry Johnson Web Developer Dolan Media Company >>> [EMAIL PROTECTED] 12/01/04 11:49AM >>> Our framework here uses the custom tag approach, not to imply it is the best way to go, just what has been in use here for years. So a typical page could be something like: Blah ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185825 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
We are still on CF5 here, very few MX boxes on our network and never had the luck to get a project onto one of them. We will be going to MX though once Blackstone is out, sadly such is the way of life around here. He did not go to Oracle 9i until 10g was out as well. Unfortunately I doubt they will pay the developers of our framework to make a new version once to MX so we will still be using our age old ways once on MX. Just yesterday I was contemplating how our form builder custom tag could maybe be revamped once in MX, I get such thoughts anytime one of these custom tags annoys me ;) -- Aaron Rouse http://www.happyhacker.com/ On Wed, 01 Dec 2004 17:02:02 +, Stephen Moretti (cfmaster) <[EMAIL PROTECTED]> wrote: > What's CFIMPORT? ~joke~ Most of my clients are still on CF5 (don't > fix what aint broke). > ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185824 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
Our footer normally is called with no parameters, it just has the ability for a few to be sent to it. Offhand the only one I can think of is the turning off of the navigation links that are normally displayed in it. -- Aaron Rouse http://www.happyhacker.com/ On Wed, 01 Dec 2004 11:56:23 -0500, Jerry Johnson <[EMAIL PROTECTED]> wrote: > I am going to regret this, but... > > We use a similar approach, and for the same reasons. > But instead of the tag, we use . (No parameters are > passed to the close tags.) > > > >Blah > > > > Jerry > > Jerry Johnson > Web Developer > Dolan Media Company > ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185823 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> ASP = Application Server Provider not Active Server Pages in this instance Heh, I think we're all aware of that. But thanks for lookin' out -- or did you just figure it out yourself? Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185820 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
I can imagine such a situation. In fact, I wrote an e-commerce app that functions somewhat similarly. However, I still maintain that the inability to specify a dynamic taglib path at runtime does not preclude the use of the cfimport tag in all ASP apps. As a side note, the aforementioned e-commerce app does, in fact use the cfimport tag. Each system provided tag is responsible for checking to see if there is a customer supplied template and including it if so. This allowed the system app to put certain restrictions on what templates could be called and providing certain environment variables. Obviously, the customers can not define new tags. Well, they can, but they have to use the cfmodule tag to use them, thus skirting the framework. But that's an option they have. Anyway, the point is that each application has different requirements, regardless of whether or not it will be hosted in an ASP environment. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 > -Original Message- > From: Micha Schopman [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 01, 2004 10:40 AM > To: CF-Talk > Subject: RE: CFMODULE vs. CFINCLUDE > > Ben, > > Imagine this situation. You have a CMS, and it has a shared directory > with templates for all customers. Each customer has also its own > directory with templates. These template function as overriding > templates instead of those shared templates (see them as virtual and > those of the customer as sealed), and such the taglib attribute needs to > be set dynamically depending on the overriding situation. > > Micha Schopman > Software Engineer > > Modern Media, Databankweg 12 M, 3821 AL Amersfoort > Tel 033-4535377, Fax 033-4535388 > KvK Amersfoort 39081679, Rabo 39.48.05.380 > > > > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185819 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
Ben Rogers wrote: >>If I remember correctly, doesn't cfmodule create a whole new memory >>block for every call, where as the cfinclude will only use the existing >>memory space and be part of the normal page cache? >> >> > >Yes. In fact, that's at least part of the point. cfmodule -- and custom tags >in general -- provide encapsulation. I would only use cfinclude only if you >really want the included tag to be able to step all over your variables and >vise-versa. > > You are quite correct. However, using cfmodule and custom tags is potentially is server killer because it is EVERY call to the cfmodule/tag and not just the first call that grabs additional memory. So for every page call for every site visitor more memory is allocated for each cfmodule. Showing my age a bit now.. cfmodule and cf in general used to have a few problems with letting go of and reusing of allocated memory, so I've become acustom to using cfincludes rather than cfmodule, because of low resources in the memory department years back and a need to make stable applications that didn't require me to restart the server every couple of hours. (A slight exageration, but that did used to happen with one of the sites I built back in 1997. It used to get extremely high peeks of traffic at certain times of the day and it used to take the server down by taking all the available memory. We eventually worked out what the problem was, reworked a load of stuff in the site and then site was rock solid - so solid that our poor old 128kb line used to get topped out) With regards "step all over your variables". Never had a problem. All it takes is a little care, attention to detail and meaningful variable names. >>Even if this isn't true for CFMX any more, personally, I'd probably lean >>towards the cfinclude method, because >>a) thats what I'm used to, >>b) I find it visually easier to read >> >> > >My preference is to use custom tags. I keep all the tags having to do with the >look and feel of a site in a directory called /tagLibs/layout. I then use the >cfimport tag to import them with the prefix "layout". It ends up >looking something like this: > What's CFIMPORT? ~joke~ Most of my clients are still on CF5 (don't fix what aint broke). >Personally, I find that much easier to read. More importantly (almost as >important as encapsulation), it also affords me the ability to pass in >parameters via the tag attributes. The tags have corresponding cfparam tags >which check to ensure that parameters have been passed and supply defaults if >necessary. > > Personal feelings. Don't rag on mine just because I don't agree with you. > > >>c) I feel like can tinker with the header and footer dynamically with a >>cfinclude than a cfmodule. >> >> > >I assume by using the phrase "I feel like" you mean that there isn't a >practical difference? I would agree that the use of includes establishes less >of a contract between the caller and the tag/template. However, I think that's >a very bad thing. You, on the other hand, seem to prefer a less >formal interface between your cfm templates. > > In a sense yes that is correct. By "tinker dynamically" I mean I can replace the headers much more easily dynamically with cfinclude than I can with cfmodule. I can have a directory full of different headers for different occasions (images of Wurzel Gummage come to mind). I can easily switch between headers by changing a single variable. Using a CFMODULE, I have to pass some information into the tag that tells the logic in the tag which bit of html to use. That html is either hard coded into the module (yak!) or you cfinclude it (pointless call to cfmodule). >>andd) Easier to get to the header and footers if I need to change them or >>simply replace them. >> >> >I'm not sure I understand this. Why would you have to put your cfm template >anywhere different if you're using the cfmodule tag as opposed to cfinclude? >As far as I know, the path attribute of both tags obey all the same rules. > So you've never had a client ask you to re-skin a site? "Here's a new design now go implement it." I'm not talking about simple CSS changes here. We're talking structural changes. If you have display code embedded inside logic, which happens the second you use a cfmodule or a call to custom tag, you would have to fiddle on changing the HTML buried in the logic or take the html out of the logic and replace it with the new html. Both of these methods are prone to simple time consuming mistakes - one slip and away goes a bit of logic you didn't want to remove. Seperate your html into individual files that can be included, set up a few standard variables for things like page titles etc and you can hand it off to a designer and let them get on with it with no fear that they are going to break anything more disasterous than the page title. >>What goes on inside the the cfmodule? Is
Re: CFMODULE vs. CFINCLUDE
I am going to regret this, but... We use a similar approach, and for the same reasons. But instead of the tag, we use . (No parameters are passed to the close tags.) Blah Jerry Jerry Johnson Web Developer Dolan Media Company >>> [EMAIL PROTECTED] 12/01/04 11:49AM >>> Our framework here uses the custom tag approach, not to imply it is the best way to go, just what has been in use here for years. So a typical page could be something like: Blah ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185815 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
Our framework here uses the custom tag approach, not to imply it is the best way to go, just what has been in use here for years. So a typical page could be something like: Blah Now each tag may call other tags, for instance the header one calls a tag that checks to see if logged in, checks to see if you have a user level that is at the level attribute or above and so on. Just glancing at one simple page, looks like 18 total CFM files are called for this page to be displayed, that includes the Application.cfm and OnRequestEnd.cfm files. This same framework uses cfmodule a lot for the database table management section. It essentially is setup so you make one file per table that you need to manage and that file is a huge switch/case and other pages that build your output via cfmodule calls to the switch/case. That section allows for updating/inserting/deleting/viewing/exporting data into whatever database table. I'd almost hate to know how resource wasteful all this comes out to be, but does make it easy for the non-CF people to whip out some applications which is why it is still in use to this day. -- Aaron Rouse http://www.happyhacker.com/ ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185813 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
Ben Rogers wrote: >>In ASP based services, cfimport is useless because it demands a static >>taglib attribute. That takes away all the glamour and glitter the tag >>could have. At.. least.. for me ;) >> >> > >I agree that it's an unfortunate limitation, but I'm not sure how "ASP based >services" has any direct relevance? We have developed and/or currently host >several ASP style applications, some of which use the cfimport tag. The >static nature of the cfimport tag definitely affects the overall site >structure a bit, but I don't see how it precludes an entire class of >applications. > > ASP = Application Server Provider not Active Server Pages in this instance ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185811 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
Ben, Imagine this situation. You have a CMS, and it has a shared directory with templates for all customers. Each customer has also its own directory with templates. These template function as overriding templates instead of those shared templates (see them as virtual and those of the customer as sealed), and such the taglib attribute needs to be set dynamically depending on the overriding situation. Micha Schopman Software Engineer Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185803 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> In ASP based services, cfimport is useless because it demands a static > taglib attribute. That takes away all the glamour and glitter the tag > could have. At.. least.. for me ;) I agree that it's an unfortunate limitation, but I'm not sure how "ASP based services" has any direct relevance? We have developed and/or currently host several ASP style applications, some of which use the cfimport tag. The static nature of the cfimport tag definitely affects the overall site structure a bit, but I don't see how it precludes an entire class of applications. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185802 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
In ASP based services, cfimport is useless because it demands a static taglib attribute. That takes away all the glamour and glitter the tag could have. At.. least.. for me ;) Micha Schopman Software Engineer Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185799 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> If I remember correctly, doesn't cfmodule create a whole new memory > block for every call, where as the cfinclude will only use the existing > memory space and be part of the normal page cache? Yes. In fact, that's at least part of the point. cfmodule -- and custom tags in general -- provide encapsulation. I would only use cfinclude only if you really want the included tag to be able to step all over your variables and vise-versa. > Even if this isn't true for CFMX any more, personally, I'd probably lean > towards the cfinclude method, because > a) thats what I'm used to, > b) I find it visually easier to read My preference is to use custom tags. I keep all the tags having to do with the look and feel of a site in a directory called /tagLibs/layout. I then use the cfimport tag to import them with the prefix "layout". It ends up looking something like this: Personally, I find that much easier to read. More importantly (almost as important as encapsulation), it also affords me the ability to pass in parameters via the tag attributes. The tags have corresponding cfparam tags which check to ensure that parameters have been passed and supply defaults if necessary. > c) I feel like can tinker with the header and footer dynamically > with a cfinclude than a cfmodule. I assume by using the phrase "I feel like" you mean that there isn't a practical difference? I would agree that the use of includes establishes less of a contract between the caller and the tag/template. However, I think that's a very bad thing. You, on the other hand, seem to prefer a less formal interface between your cfm templates. > andd) Easier to get to the header and footers if I need to change > them or simply replace them. I'm not sure I understand this. Why would you have to put your cfm template anywhere different if you're using the cfmodule tag as opposed to cfinclude? As far as I know, the path attribute of both tags obey all the same rules. cfimport, on the other hand, does not accept dynamic values in the taglib attribute. As I said, I store all my tags in directories beneath a /tagLibs/ directory and import them as necessary. However, you could put your files all in the root directory of your site and use the cfmodule tag or even the cf_tagName sytax. > What goes on inside the the cfmodule? Is the header and footer actually > inside the cfmodule template or does it include the header and footer > templates? If it includes them, then it'd be a bit of a pointless call > to the cfmodule, if its in the cfmodule template, then refer to my point > (d) above. ;) You're ignoring several key points, all mentioned above. In brief, though, tags afford you 1) a degree of encapsulation; 2) specify parameters in a more formal way; 3) the ability to enforce whether or not the end tag has been specified (thisTag.hasEndTag); and 4) the ability to control the naming of your tags (cfimport prefix attribute) and, by extension, their color coding and such in your editor of choice. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185796 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
>The loadtemplate.cfm is a "engine" which provides us with overriding >schemes. > So basically you're using a cfmodule to cfinclude some files depending on what is in the attributes of the tag. >I personally would only use cfsavecontent for caching logic. >Then you would have encapsulated those tags with a cfsavecontent tag. > > ??confused cfsavecontent takes output and puts it into a variable. It doesn't cache anything. Micha, a favour. Could you put at least a little of the email that you are replying to into your response please? For some reason your emails don't thread properly, they always appear under the initial email and not under the email you are replying to. In a long thread without a reference to what you're replying to, your responses can be very confusing. Stephen ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185780 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
Why would you want to do that :) Currently this is how the source looks from our CMS pages based for the CF5 version .. The loadtemplate.cfm is a "engine" which provides us with overriding schemes. I personally would only use cfsavecontent for caching logic. Then you would have encapsulated those tags with a cfsavecontent tag. Micha Schopman Software Engineer Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185778 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
I've was thinking about this post last night - don't ask. To give you a little background im mainly a solid Fuseboxer so issues of layout have always been in the back of my head as it is something FB accomodates for. But the one thing i love about the move from FB2 to FB3 was having the layout file in one file. Well after reading this post it got me thinking about the Layout process again (mainly because i am also looking at doing a small app without FB for a change). And i was wondering why the tag isn't used here? Basically your page would be: Content Goes Here This would allow several options at the bottom of the page 1) This would take the variable content and display its contents 2) 3) #content# 4) Plus you could even put the layout template reference in the onRequestEnd.cfm and put some logic for each page? Just my 2 cents Andy www.andyjarrett.co.uk On Wed, 1 Dec 2004 09:12:08 +0100, Micha Schopman <[EMAIL PROTECTED]> wrote: > Personally, the advantages of cfmodule outweigh those of cfinclude. The > performance hit of cfmodule is really low, and cfmodule provides you > with encapsulation. Variables defined within a template called by > cfmodule have no effect on the executed code outside that template > (unless you are using variables in request, session, application, > client, server, or use the caller). > > What you need to keep in mind, when you call a cfmodule template within > a CFC, and use caller in that template, the variable is returned to the > CFC. So if you want to use returned data from the template, you need to > put business logic in your CFC which handles that. > > Micha Schopman > Software Engineer > > Modern Media, Databankweg 12 M, 3821 AL Amersfoort > Tel 033-4535377, Fax 033-4535388 > KvK Amersfoort 39081679, Rabo 39.48.05.380 > > > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185777 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
Personally, the advantages of cfmodule outweigh those of cfinclude. The performance hit of cfmodule is really low, and cfmodule provides you with encapsulation. Variables defined within a template called by cfmodule have no effect on the executed code outside that template (unless you are using variables in request, session, application, client, server, or use the caller). What you need to keep in mind, when you call a cfmodule template within a CFC, and use caller in that template, the variable is returned to the CFC. So if you want to use returned data from the template, you need to put business logic in your CFC which handles that. Micha Schopman Software Engineer Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185771 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
I think maybe you misread me. I wasn't proposing that people use exactly as written. What I meant was, stuff Using normally would be meaningless. You can, as you say, write code to ignore the closing call. You don't have to actually check executionMode, if you simply add to the end of your custom tag, you will ensure it is only run in "start" mode. On Tue, 30 Nov 2004 15:03:05 -0500, Gaulin, Mark <[EMAIL PROTECTED]> wrote: > I totally agree with Raymond but have one comment to make: > > "I'll go out on a limb here and say if your site will not work > when using versus an include, then you have other > problems." > > There are special issues when you use the closing tag because CF > will call your tag twice, once for the opening tag and once for the closing > tag. Tags can be written to handle this properly but I almost never do > (unless the tag is designed to work with a closing tag). So, yeah, this > calling style can hurt a site, so use just to replace template="foo"> > > Mark > > > > > -Original Message- > From: Raymond Camden [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 30, 2004 1:59 PM > To: CF-Talk > Subject: Re: CFMODULE vs. CFINCLUDE > > I'd agree with Simon, specifically the "not that it's a huge big > deal". I'll go out on a limb here and say if your site will not work > when using versus an include, then you have other > problems. > > Yes, cf_foo (or cfmodule) is slower than cfinclue. > But don't worry about it. > > Unless you are running Spectra and have 500 or so custom tags running > at once, it will never be a real issue. > > I'd always go for the custom tag solution since it protects your > calling documents from having their variables screwed up by the > customtag/cfinclude code. > > "e) Allows you to cycle in special headers/footers at any time rather than > editing a central display template." > > You can also just simply not use the custom tag on a page that needs > something special. > > "Also, all content between the tags is loaded into a variable called > generatedcontent. " > > I don't think it's copied, I'm pretty sure it is a reference. Did you > notice that you can modify this value and it changes what is between > the tags? You don't have to return anything, just reset it. > > If I can summarize, I do not believe the performance reasons are a > valid concern. I'd go with the syntax you are most comfortable with. > Just remember that, all things being considered, the custom tag method > is safer to your calling document. > > On Tue, 30 Nov 2004 18:22:37 +, Simon Horwith <[EMAIL PROTECTED]> wrote: > > Not that it's a huge deal, but don't forget that cfmodule also requires > > a single file compilatation as opossed to two file compilations, as well ;) > > > > ~Simon > > > > Simon Horwith > > Chief Information Officer, AboutWeb > > http://www.aboutweb.com > > Member of Team Macromedia > > Macromedia Certified Master Instructor > > Editor-in-Chief, ColdFusion Developers Journal > > Blog - http://www.horwith.com > > > > > > > > > > Katz, Dov B (IT) wrote: > > > > >CFModule encapsulates the layout nicer than 2 isolated CFINCLUDES... > > > > > >You have a single layout.cfm which detects if #thistag.executionmode# is > > >"start" and shows the header or footer. It makes for an easier read if > > >the module is CF_TAGNAME'd.. > > > > > >Example... You have layout.cfm, so you can do this: > > > > > > > > > my page > > > > > > > > >That's more elegant than cfinclude header, cfinclude footer, and allows > > >you to pass in custom arguments since it's using cfmodule under the > > >covers. > > > > > >That's my take on things > > > > > >-dov > > > > > >-Original Message- > > >From: Michael Dinowitz [mailto:[EMAIL PROTECTED] > > >Sent: Tuesday, November 30, 2004 12:46 PM > > >To: CF-Talk > > >Subject: CFMODULE vs. CFINCLUDE > > > > > >I'm rewriting Raymond's Lighthouse Bugtracker (not my idea) and one > > >piece bought up an old question I had. Is there any performance > > >difference between a CFMODULE acting as a layout wrapper or 2 CFINCLUDE > > >templates with layout? > > >In the first case, your code is: > > > > > >Display stuff > > > > > > &
RE: CFMODULE vs. CFINCLUDE
I totally agree with Raymond but have one comment to make: "I'll go out on a limb here and say if your site will not work when using versus an include, then you have other problems." There are special issues when you use the closing tag because CF will call your tag twice, once for the opening tag and once for the closing tag. Tags can be written to handle this properly but I almost never do (unless the tag is designed to work with a closing tag). So, yeah, this calling style can hurt a site, so use just to replace Mark -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 1:59 PM To: CF-Talk Subject: Re: CFMODULE vs. CFINCLUDE I'd agree with Simon, specifically the "not that it's a huge big deal". I'll go out on a limb here and say if your site will not work when using versus an include, then you have other problems. Yes, cf_foo (or cfmodule) is slower than cfinclue. But don't worry about it. Unless you are running Spectra and have 500 or so custom tags running at once, it will never be a real issue. I'd always go for the custom tag solution since it protects your calling documents from having their variables screwed up by the customtag/cfinclude code. "e) Allows you to cycle in special headers/footers at any time rather than editing a central display template." You can also just simply not use the custom tag on a page that needs something special. "Also, all content between the tags is loaded into a variable called generatedcontent. " I don't think it's copied, I'm pretty sure it is a reference. Did you notice that you can modify this value and it changes what is between the tags? You don't have to return anything, just reset it. If I can summarize, I do not believe the performance reasons are a valid concern. I'd go with the syntax you are most comfortable with. Just remember that, all things being considered, the custom tag method is safer to your calling document. On Tue, 30 Nov 2004 18:22:37 +, Simon Horwith <[EMAIL PROTECTED]> wrote: > Not that it's a huge deal, but don't forget that cfmodule also requires > a single file compilatation as opossed to two file compilations, as well ;) > > ~Simon > > Simon Horwith > Chief Information Officer, AboutWeb > http://www.aboutweb.com > Member of Team Macromedia > Macromedia Certified Master Instructor > Editor-in-Chief, ColdFusion Developers Journal > Blog - http://www.horwith.com > > > > > Katz, Dov B (IT) wrote: > > >CFModule encapsulates the layout nicer than 2 isolated CFINCLUDES... > > > >You have a single layout.cfm which detects if #thistag.executionmode# is > >"start" and shows the header or footer. It makes for an easier read if > >the module is CF_TAGNAME'd.. > > > >Example... You have layout.cfm, so you can do this: > > > > > > my page > > > > > >That's more elegant than cfinclude header, cfinclude footer, and allows > >you to pass in custom arguments since it's using cfmodule under the > >covers. > > > >That's my take on things > > > >-dov > > > >-Original Message- > >From: Michael Dinowitz [mailto:[EMAIL PROTECTED] > >Sent: Tuesday, November 30, 2004 12:46 PM > >To: CF-Talk > >Subject: CFMODULE vs. CFINCLUDE > > > >I'm rewriting Raymond's Lighthouse Bugtracker (not my idea) and one > >piece bought up an old question I had. Is there any performance > >difference between a CFMODULE acting as a layout wrapper or 2 CFINCLUDE > >templates with layout? > >In the first case, your code is: > > > >Display stuff > > > > > >In the second case you have: > > > >Display Stuff > > > > > >Because of the nature of the CFMODULE, it's called twice and various > >variables are created in its process. The CFINCLUDE method uses 2 > >CFINCLUDES, but there's nothing special about them. No extra variables, > >etc. > > > >Logic says that the CFINCLUDE method of template layout is more > >efficient, but I'd like to know what others think? > > > >I'll ask the question about what people think of the pagecontext include > >vs. > >cfinclude another time. :) > > > > > > > > > > > > > > ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185736 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
I'd agree with Simon, specifically the "not that it's a huge big deal". I'll go out on a limb here and say if your site will not work when using versus an include, then you have other problems. Yes, cf_foo (or cfmodule) is slower than cfinclue. But don't worry about it. Unless you are running Spectra and have 500 or so custom tags running at once, it will never be a real issue. I'd always go for the custom tag solution since it protects your calling documents from having their variables screwed up by the customtag/cfinclude code. "e) Allows you to cycle in special headers/footers at any time rather than editing a central display template." You can also just simply not use the custom tag on a page that needs something special. "Also, all content between the tags is loaded into a variable called generatedcontent. " I don't think it's copied, I'm pretty sure it is a reference. Did you notice that you can modify this value and it changes what is between the tags? You don't have to return anything, just reset it. If I can summarize, I do not believe the performance reasons are a valid concern. I'd go with the syntax you are most comfortable with. Just remember that, all things being considered, the custom tag method is safer to your calling document. On Tue, 30 Nov 2004 18:22:37 +, Simon Horwith <[EMAIL PROTECTED]> wrote: > Not that it's a huge deal, but don't forget that cfmodule also requires > a single file compilatation as opossed to two file compilations, as well ;) > > ~Simon > > Simon Horwith > Chief Information Officer, AboutWeb > http://www.aboutweb.com > Member of Team Macromedia > Macromedia Certified Master Instructor > Editor-in-Chief, ColdFusion Developers Journal > Blog - http://www.horwith.com > > > > > Katz, Dov B (IT) wrote: > > >CFModule encapsulates the layout nicer than 2 isolated CFINCLUDES... > > > >You have a single layout.cfm which detects if #thistag.executionmode# is > >"start" and shows the header or footer. It makes for an easier read if > >the module is CF_TAGNAME'd.. > > > >Example... You have layout.cfm, so you can do this: > > > > > > my page > > > > > >That's more elegant than cfinclude header, cfinclude footer, and allows > >you to pass in custom arguments since it's using cfmodule under the > >covers. > > > >That's my take on things > > > >-dov > > > >-Original Message- > >From: Michael Dinowitz [mailto:[EMAIL PROTECTED] > >Sent: Tuesday, November 30, 2004 12:46 PM > >To: CF-Talk > >Subject: CFMODULE vs. CFINCLUDE > > > >I'm rewriting Raymond's Lighthouse Bugtracker (not my idea) and one > >piece bought up an old question I had. Is there any performance > >difference between a CFMODULE acting as a layout wrapper or 2 CFINCLUDE > >templates with layout? > >In the first case, your code is: > > > >Display stuff > > > > > >In the second case you have: > > > >Display Stuff > > > > > >Because of the nature of the CFMODULE, it's called twice and various > >variables are created in its process. The CFINCLUDE method uses 2 > >CFINCLUDES, but there's nothing special about them. No extra variables, > >etc. > > > >Logic says that the CFINCLUDE method of template layout is more > >efficient, but I'd like to know what others think? > > > >I'll ask the question about what people think of the pagecontext include > >vs. > >cfinclude another time. :) > > > > > > > > > > > > > > ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185715 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
Not that it's a huge deal, but don't forget that cfmodule also requires a single file compilatation as opossed to two file compilations, as well ;) ~Simon Simon Horwith Chief Information Officer, AboutWeb http://www.aboutweb.com Member of Team Macromedia Macromedia Certified Master Instructor Editor-in-Chief, ColdFusion Developers Journal Blog - http://www.horwith.com Katz, Dov B (IT) wrote: >CFModule encapsulates the layout nicer than 2 isolated CFINCLUDES... > >You have a single layout.cfm which detects if #thistag.executionmode# is >"start" and shows the header or footer. It makes for an easier read if >the module is CF_TAGNAME'd.. > >Example... You have layout.cfm, so you can do this: > > > my page > > >That's more elegant than cfinclude header, cfinclude footer, and allows >you to pass in custom arguments since it's using cfmodule under the >covers. > >That's my take on things > >-dov > >-Original Message- >From: Michael Dinowitz [mailto:[EMAIL PROTECTED] >Sent: Tuesday, November 30, 2004 12:46 PM >To: CF-Talk >Subject: CFMODULE vs. CFINCLUDE > >I'm rewriting Raymond's Lighthouse Bugtracker (not my idea) and one >piece bought up an old question I had. Is there any performance >difference between a CFMODULE acting as a layout wrapper or 2 CFINCLUDE >templates with layout? >In the first case, your code is: > >Display stuff > > >In the second case you have: > >Display Stuff > > >Because of the nature of the CFMODULE, it's called twice and various >variables are created in its process. The CFINCLUDE method uses 2 >CFINCLUDES, but there's nothing special about them. No extra variables, >etc. > >Logic says that the CFINCLUDE method of template layout is more >efficient, but I'd like to know what others think? > >I'll ask the question about what people think of the pagecontext include >vs. >cfinclude another time. :) > > > > > > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185710 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
> If I remember correctly, doesn't cfmodule create a whole new memory > block for every call, where as the cfinclude will only use the existing > memory space and be part of the normal page cache? You are correct, even in CFMX. > Even if this isn't true for CFMX any more, personally, I'd probably lean > towards the cfinclude method, because > a) thats what I'm used to, Same here. > b) I find it visually easier to read Same here. e) Allows you to cycle in special headers/footers at any time rather than editing a central display template. > What goes on inside the the cfmodule? Is the header and footer actually > inside the cfmodule template or does it include the header and footer > templates? If it includes them, then it'd be a bit of a pointless call > to the cfmodule, if its in the cfmodule template, then refer to my point > (d) above. ;) The header and footer is actually inside the cfmodule with a piece of logic to see if it's the start or end of the execution. The content between the cfmodule call tags is evaluated after the tag start and before the tag end. Also, all content between the tags is loaded into a variable called generatedcontent. It's overhead I don't like, but there may be something I'm missing which is why I asked. Well, that and I like to make people think. :) ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185709 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFMODULE vs. CFINCLUDE
Michael Dinowitz wrote: >I'm rewriting Raymond's Lighthouse Bugtracker (not my idea) and one piece >bought up an old question I had. Is there any performance difference between >a CFMODULE acting as a layout wrapper or 2 CFINCLUDE templates with layout? >In the first case, your code is: > >Display stuff > > >In the second case you have: > >Display Stuff > > >Because of the nature of the CFMODULE, it's called twice and various >variables are created in its process. The CFINCLUDE method uses 2 >CFINCLUDES, but there's nothing special about them. No extra variables, etc. > >Logic says that the CFINCLUDE method of template layout is more efficient, >but I'd like to know what others think? > >I'll ask the question about what people think of the pagecontext include vs. >cfinclude another time. :) > > If I remember correctly, doesn't cfmodule create a whole new memory block for every call, where as the cfinclude will only use the existing memory space and be part of the normal page cache? Even if this isn't true for CFMX any more, personally, I'd probably lean towards the cfinclude method, because a) thats what I'm used to, b) I find it visually easier to read c) I feel like can tinker with the header and footer dynamically with a cfinclude than a cfmodule. andd) Easier to get to the header and footers if I need to change them or simply replace them. What goes on inside the the cfmodule? Is the header and footer actually inside the cfmodule template or does it include the header and footer templates? If it includes them, then it'd be a bit of a pointless call to the cfmodule, if its in the cfmodule template, then refer to my point (d) above. ;) Stephen ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185701 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs. CFINCLUDE
CFModule encapsulates the layout nicer than 2 isolated CFINCLUDES... You have a single layout.cfm which detects if #thistag.executionmode# is "start" and shows the header or footer. It makes for an easier read if the module is CF_TAGNAME'd.. Example... You have layout.cfm, so you can do this: my page That's more elegant than cfinclude header, cfinclude footer, and allows you to pass in custom arguments since it's using cfmodule under the covers. That's my take on things -dov -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 12:46 PM To: CF-Talk Subject: CFMODULE vs. CFINCLUDE I'm rewriting Raymond's Lighthouse Bugtracker (not my idea) and one piece bought up an old question I had. Is there any performance difference between a CFMODULE acting as a layout wrapper or 2 CFINCLUDE templates with layout? In the first case, your code is: Display stuff In the second case you have: Display Stuff Because of the nature of the CFMODULE, it's called twice and various variables are created in its process. The CFINCLUDE method uses 2 CFINCLUDES, but there's nothing special about them. No extra variables, etc. Logic says that the CFINCLUDE method of template layout is more efficient, but I'd like to know what others think? I'll ask the question about what people think of the pagecontext include vs. cfinclude another time. :) ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185700 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFMODULE vs CFINCLUDE
You can use includes recursively as long as you are willing to manage your own stack. BTW, even managing your own stack with includes is faster than using custom tags (at least pre-cfmx). Matt Liotta President & CEO Montara Software, Inc. http://www.montarasoftware.com/ 888-408-0900 x901 > -Original Message- > From: Bryan Love [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 06, 2002 10:59 AM > To: CF-Talk > Subject: RE: CFMODULE vs CFINCLUDE > > cfinclude is WAY WAY WAY faster > > ALWAYS use includes if you can... Of course there will always be > circumstances where you won't be able to (like recursive calls), but > always > try. > > +---+ > Bryan Love > Macromedia Certified Professional > Internet Application Developer > Database Analyst > TeleCommunication Systems > [EMAIL PROTECTED] > +---+ > > "...'If there must be trouble, let it be in my day, that my child may have > peace'..." > - Thomas Paine, The American Crisis > > > > -Original Message- > From: Frank Mamone [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 06, 2002 10:55 AM > To: CF-Talk > Subject: CFMODULE vs CFINCLUDE > > > I have a page where I want to conditionally include specific code blocks > which exist in other pages. > > What is more efficient, CFMODULE or CFINCLUDE? > > Thanks > > > __ Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: CFMODULE vs CFINCLUDE
>I have a page where I want to conditionally include specific code blocks >which exist in other pages. > >What is more efficient, CFMODULE or CFINCLUDE? One thing that wasn't mentioned in some of the other replies I saw to this thread was that CFMODULE and cfinclude are actually slightly different beasts. CFMODULE is the same thing as invoking a custom tag. The benefit of using this method over a custom tag stored in the CustomTags folder in the CF root is that it resolves name conflicts among custom tags by letting you specify where you want to store your tags (pre-CF 5 when you couldn't specify tag dirs in the CF admin, this was very useful). With CFMODULE , you supply the path to the custom tag template, whereas with the CustomTags directory in the CF root, you simply call the template and CF invokes the first instance of that template it finds (or the last, I always get that confused!). CFMODULE also creates it variables in its own scope, a la custom tags. CFINCLUDE runs in the same scope as the page request -- variables in the cfinclude can be clobbered or can clobber other variables with the same scope/name. So yes, the other responses were correct in that CFINCLUDE is the more efficient method. But it also depends on what you're trying to accomplish. Hope this helps, Dave. __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: CFMODULE vs CFINCLUDE
Thanks Matt and Bryan. - Original Message - From: "Frank Mamone" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Friday, September 06, 2002 1:54 PM Subject: CFMODULE vs CFINCLUDE > I have a page where I want to conditionally include specific code blocks which exist in other pages. > > What is more efficient, CFMODULE or CFINCLUDE? > > Thanks > > __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: CFMODULE vs CFINCLUDE
cfinclude Matt Liotta President & CEO Montara Software, Inc. http://www.montarasoftware.com/ 888-408-0900 x901 > -Original Message- > From: Frank Mamone [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 06, 2002 10:55 AM > To: CF-Talk > Subject: CFMODULE vs CFINCLUDE > > I have a page where I want to conditionally include specific code blocks > which exist in other pages. > > What is more efficient, CFMODULE or CFINCLUDE? > > Thanks > > __ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: CFMODULE vs CFINCLUDE
cfinclude is WAY WAY WAY faster ALWAYS use includes if you can... Of course there will always be circumstances where you won't be able to (like recursive calls), but always try. +---+ Bryan Love Macromedia Certified Professional Internet Application Developer Database Analyst TeleCommunication Systems [EMAIL PROTECTED] +---+ "...'If there must be trouble, let it be in my day, that my child may have peace'..." - Thomas Paine, The American Crisis -Original Message- From: Frank Mamone [mailto:[EMAIL PROTECTED]] Sent: Friday, September 06, 2002 10:55 AM To: CF-Talk Subject: CFMODULE vs CFINCLUDE I have a page where I want to conditionally include specific code blocks which exist in other pages. What is more efficient, CFMODULE or CFINCLUDE? Thanks __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists