More CFC Best Practice questions
I'm getting ready to start a new app and there are some things I've learned from other apps that I'm going to implement into this app as far as CFCs go. I saw the thread concerning the THIS scope which helped to get some different people's takes on its use. I was wondering if anyone else would like to post personal or recognized best practices. I am especially interested in scoping instances of components. I always have a hard time deciding which scopy to put instances of CFCs into for different purposes and which kinds of methods I should have in each. Sometimes, I've overloaded the application scope and end up locking my application to death for almost everything, but then other times, I think I put stuff in session that belongs in application. Any advice would be appreciated, as well as any other best practices that you'd care to share. I'm always willing to learn. Thanks. John Burns Certified Advanced ColdFusion MX Developer Wyle Laboratories, Inc. | Web Developer ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216668 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: More CFC Best Practice questions
On 8/29/05, Burns, John D [EMAIL PROTECTED] wrote: I'm getting ready to start a new app and there are some things I've learned from other apps that I'm going to implement into this app as far as CFCs go. I saw the thread concerning the THIS scope which helped to get some different people's takes on its use. I was wondering if anyone else would like to post personal or recognized best practices. I am especially interested in scoping instances of components. I always have a hard time deciding which scopy to put instances of CFCs into for different purposes and which kinds of methods I should have in each. Sometimes, I've overloaded the application scope and end up locking my application to death for almost everything, but then other times, I think I put stuff in session that belongs in application. Any advice would be appreciated, as well as any other best practices that you'd care to share. I'm always willing to learn. Thanks. Your best bet is to search the archives of this list. This topic gets beaten to death every month or two and you'll find a wealth of information in past threads that you can choose to apply or not apply to your development cycle. What you'll find is that best practices is a very subjective theme, with only a few truly necessary must-dos (i.e., var scoping local variables, including query names). As for what scope you store component instances in, how they're called, etc., that's all up to you and nobody is going to chime in with a you must do it this way or it's incorrect answer for you. Sorry it's a bit gray, but that's just the reality. Regards, Dave. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216674 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: More CFC Best Practice questions
First, if your shared-scope components are carefully designed, chances are good that you won't have any CFLOCKs anywhere outside your CFCs except to protect their initialization. Seriously. The only place you need to lock is where you have race conditions, and those race conditions can only occur with the STATE (instance variables) of your shared instances. Some will argue that the CFC should be environment neutral, and therefore the locking is the responsibility of the environment, but I think that's unnecessary, as it's rare to have CFCs that are both used in isolation as as shared-scope instances. It's far easier to lock inside the CFC, and more performant too. I usually try to aim for entity components that are NEVER accessed concurrently (so they don't need locking), and for non-entity (service) components that are stateless. The main exception to the latter are caching components, because obviously the cache itself has to be stateful, and therefore needs to have access to it locked. And with entity components, you can certainly share instances across requests, just never at the same time. And finally, keep in mind that session components need locking, unless you can guarentee youself that multiple concurrent requests from a single session will NEVER occur (which is pretty much unguarenteeable). cheers, barneyb On 8/29/05, Burns, John D [EMAIL PROTECTED] wrote: I'm getting ready to start a new app and there are some things I've learned from other apps that I'm going to implement into this app as far as CFCs go. I saw the thread concerning the THIS scope which helped to get some different people's takes on its use. I was wondering if anyone else would like to post personal or recognized best practices. I am especially interested in scoping instances of components. I always have a hard time deciding which scopy to put instances of CFCs into for different purposes and which kinds of methods I should have in each. Sometimes, I've overloaded the application scope and end up locking my application to death for almost everything, but then other times, I think I put stuff in session that belongs in application. Any advice would be appreciated, as well as any other best practices that you'd care to share. I'm always willing to learn. Thanks. John Burns Certified Advanced ColdFusion MX Developer Wyle Laboratories, Inc. | Web Developer -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216672 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: More CFC Best Practice questions
I wrote an article on CFC best practices that might be helpful: http://www.briankotek.com/blog/index.cfm?mode=entryentry=104F4985-3048-23C1-DDF6C15FB4864387 On 8/29/05, Dave Carabetta [EMAIL PROTECTED] wrote: On 8/29/05, Burns, John D [EMAIL PROTECTED] wrote: I'm getting ready to start a new app and there are some things I've learned from other apps that I'm going to implement into this app as far as CFCs go. I saw the thread concerning the THIS scope which helped to get some different people's takes on its use. I was wondering if anyone else would like to post personal or recognized best practices. I am especially interested in scoping instances of components. I always have a hard time deciding which scopy to put instances of CFCs into for different purposes and which kinds of methods I should have in each. Sometimes, I've overloaded the application scope and end up locking my application to death for almost everything, but then other times, I think I put stuff in session that belongs in application. Any advice would be appreciated, as well as any other best practices that you'd care to share. I'm always willing to learn. Thanks. Your best bet is to search the archives of this list. This topic gets beaten to death every month or two and you'll find a wealth of information in past threads that you can choose to apply or not apply to your development cycle. What you'll find is that best practices is a very subjective theme, with only a few truly necessary must-dos (i.e., var scoping local variables, including query names). As for what scope you store component instances in, how they're called, etc., that's all up to you and nobody is going to chime in with a you must do it this way or it's incorrect answer for you. Sorry it's a bit gray, but that's just the reality. Regards, Dave. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216677 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: More CFC Best Practice questions
Right, I understand, I was more hoping for people to post their one or two hot button things that they try to do within CFCs. I've seen most of the traffic concerning them, I was just curious what people couldn't live without when it comes to CFCs and then also suggestions/rules about shared scoping. John Burns Certified Advanced ColdFusion MX Developer Wyle Laboratories, Inc. | Web Developer -Original Message- From: Dave Carabetta [mailto:[EMAIL PROTECTED] Sent: Monday, August 29, 2005 1:53 PM To: CF-Talk Subject: Re: More CFC Best Practice questions On 8/29/05, Burns, John D [EMAIL PROTECTED] wrote: I'm getting ready to start a new app and there are some things I've learned from other apps that I'm going to implement into this app as far as CFCs go. I saw the thread concerning the THIS scope which helped to get some different people's takes on its use. I was wondering if anyone else would like to post personal or recognized best practices. I am especially interested in scoping instances of components. I always have a hard time deciding which scopy to put instances of CFCs into for different purposes and which kinds of methods I should have in each. Sometimes, I've overloaded the application scope and end up locking my application to death for almost everything, but then other times, I think I put stuff in session that belongs in application. Any advice would be appreciated, as well as any other best practices that you'd care to share. I'm always willing to learn. Thanks. Your best bet is to search the archives of this list. This topic gets beaten to death every month or two and you'll find a wealth of information in past threads that you can choose to apply or not apply to your development cycle. What you'll find is that best practices is a very subjective theme, with only a few truly necessary must-dos (i.e., var scoping local variables, including query names). As for what scope you store component instances in, how they're called, etc., that's all up to you and nobody is going to chime in with a you must do it this way or it's incorrect answer for you. Sorry it's a bit gray, but that's just the reality. Regards, Dave. ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216678 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