I've been storing all the required CFCs for a site in the application scope. During onApplicationStart I do something like this application.objSomeCfc =CreateObject('component', 'com.someCfc').init().
Here is my reasoning.
So is my thinking flawed? Are there any additional pros or cons for dealing with CFCs? Is there any docs, articles, blogs, videos, frameworks, ...... that I should check that may change my perspective on how I'm doing this?
Your approach is fine, depending on how many and what type of CFCs you are talking about. If they are "singletons" - that is, only one instance of each CFC is needed to be in memory and can be reused/shared from multiple parts of your application - caching them in the application scope is common. Just make sure they are thread safe ("var" or local.* all your method variables).
You might consider taking advantage of a dependency injection framework, such as DI/1 (part of the FW/1 MVC framework), ColdSpring, or WireBox (a module of the ColdBox platform that can be used independently). They have mechanisms for handling and caching singletons. Then you wouldn't have to go to the application scope to get your CFC instances.
They are all singletons and for the most part thread safe. I still find some old code here and there that isn't but I fix it as soon as I find it. I was curious because I was told it was "bad". I've been doing it for years with out issue and never heard heard anyone say it was bad until recently.
Thanks for the info on the frameworks. I've been trying to think of a way to do what DI/1 already does. Good to know there is somethign already out there.