http://coldfusion.com logo
#cfml-general
Title
# cfml-general
g

glook

02/24/2022, 2:56 PM
I have a data-driven site with about 6 pages. I was using the Application.cfc onRequestStart with a cfswitch against cgi.script_name to run queries to fill the pages. I want to move those out of the Application.cfc to their own CFC because it's getting crowded in there. Would a "pages.cfc" with a function for each page that would run the queries make sense? Would there be value in instantiating the object as a session variable so I could make the page calls that way? Is this a best practice? Any place to look to verify? Thanks all!
s

sknowlton

02/24/2022, 3:04 PM
Don't put CFCs in session. 'best practice' is an MVC pattern. You're basically rolling your own framework here. for a six page site, eh, might be fine, but 6 page sites have a way of being 60 page sites. if I came into work tomorrow and had to take care of that site, I'd put it in an actual framework, and we spent 5+ years with one we built ourselves that worked decently. there's just not an up side to having infrastructure that runs your site that re-invents every wheel
g

glook

02/24/2022, 3:06 PM
That does make sense. This is part of a larger site that uses an old version of fusebox for simple MVC.
Thanks for the answer on not creating a cfc as a session object. I'll avoid that. If I were to pull in a framework at this point, I would want it to be super light.
s

sknowlton

02/24/2022, 3:16 PM
they're all super light.
g

glook

02/24/2022, 3:19 PM
I'll take a look at the current version of fusebox.
Well, that's discouraging. 10 years later I guess.
s

sknowlton

02/24/2022, 3:24 PM
what's discouarging?
Oh, that Fusebox hasn't been updated in 10 years? yeah it's Coldbox or FW/1 these days
g

glook

02/24/2022, 3:25 PM
fusebox.org is dead, it doesn't look like the github page has been lookeed at for a while, and yeah what you said...
s

sknowlton

02/24/2022, 3:25 PM
FW/1 is still used a lot but it's pretty much in maintenance mode
d

Dave Merrill

02/24/2022, 9:16 PM
ColdBox is the only one that's being updated on a regular basis.
It's not as heavy as it once was, and has a lot of stuff in it. There's a bit of a learning curve, but it positions you well should things expand or complexify later. Which happens 🙂
s

sknowlton

02/25/2022, 3:07 AM
I don't really know what 'heavy' means in this context - you only have to learn the parts you want to use and if that's 10% of Coldbox or 50% of another framework, it's still the same learning curve, you just know less about the stuff you didn't need in Coldbox's case
2 Views