100s or 1000s depends on the variety of functionality. Follow what larry has suggested of limiting the concern scope of a CFC. As for cfinclude, it will become a nightmare but more importantly, CFCs themselve help reuse so why would you even think on those lines? Each cfinclude section should become a cfc encapsulated function. Inside a utility CFC if you will.
Another point, organise the CFC into functional folders (another layer of encapsulation that allows a broader scope of concern to place code together). This helps a) code management b) tiny improvement in code search by the runtime. 2012/7/6 larryclyons <[email protected]> > People may have covered this already, but unless you are including entire > functions that have been properly scoped and the cfinclude is outside of a > function, then no don't do it. For one thing if you use a cfinclude inside > of a function, any variables declared within that include are now public. > And its also a beast to maintain. > > As for the number of cfc's, look at what you are trying to do. Group > functions together as long as they make logical or functional sense. In > other words it depends. But one rule of thumb keep the cfc's very tight. > Each CFC should only deal with one concern. > > hth, > larry > > On Thursday, July 5, 2012 11:30:44 AM UTC-4, Jason Allen wrote: >> >> I'm looking to migrate a bunch of spaghetti code to an organized cfc. >> Before I start, I'm curious of any 'best practices' anybody could enlighten >> me about. >> >> Is it best to have few cfc's and compile as many functions into a single >> cfc? Or is it ok to have dozens, if not hundreds of cfc's that are very >> specific? >> >> Is it ok to use CFINCLUDE in a cfc? I have a few functions that have a >> bunch of code and I'd rather "include" the code in just to make the CFC >> itself thinner. >> >> Can you use a 'function declared in a cfc' within another function >> declared within that same cfc? Meaning, if I declare a function in a cfc, >> can I use that function within another function declared after the first >> one? >> >> Where do I put CFC files in OpenBD? How do I make my app initiate them? >> >> >> -- > online documentation: http://openbd.org/manual/ > http://groups.google.com/group/openbd?hl=en > -- -Nitish "Faith is a free Option" http://www.forcesofindia.com/profiles/np -- online documentation: http://openbd.org/manual/ http://groups.google.com/group/openbd?hl=en
