When you shouldn’t use a framework.
Andy Jarrett hit upon something extremely interesting in a recent blog post: When not to use a framework. All the hype surrounding frameworks in the CF community lately has recently started to turn into a war. Which one is better, faster, more stable and practical. Depending on which one you use, your opinion will be different from the next guy.
Frameworks do make our lives easier by giving us a universal way of structuring our applications. It’s great when you later have to come back to a project written in say MG and need to do some tweaking or adding, that you know where to put things and can follow the logic. It’s also great if you get handed someone else’s project and can follow their logic. This is all done because the framework is the system that sets the logical flow of the application and not the individual.
But even though frameworks tend to make programming applications easier, they also bloat application just as well. I remember when Fusebox came out long ago and it was all the buzz. I remember one of the example application processing templates at 400ms. I took that example app and rewrote using straight procedural code and got the thing to process the templates in 10ms. The same can be said for the frameworks today. With all the overhead of the framework handling the event calls of you application, you application will be slower than if you just wrote it using straight CFC calls.
So when would be an appropriate time to tell someone to just dump frameworks altogether? To me it comes down when a portion of an application needs to run as fast as possible and can separated from other portions of the application. I’ll use BannerBoxes as an example.
The main portion of the site, where advertiser and publisher manage their account and sign up, uses a particular framework to make development quicker and easier for me. This portion of the site doesn’t get millions of hit a day, so I can trade off manageability for speed. I’d rather be able to quickly add another section to this portion of the site or have someone else be able to add it for me and the framework does makes this possible.
Now the Feed and Click processing portions of the site do get millions of hits a day. These portions of the site need as much speed as they can get. These portions do not use any frameworks as I can’t afford to have any overhead whatsoever. When you’re processing millions of feed pulls and clicks a day, 10ms in template processing DOES make a difference and it IS noticeable. These portions use straight CFCs with A LOT of caching to perform this feat.
So in closing, I’m NOT trying to bash all the frameworks out there or telling people not to use them in their development life cycle. What I am saying is that sometimes people need to stop and think if using a framework is the right move in a particular portion of an application that requires that portion perform at top speed.