Rip's Domain

When you shouldn’t use a framework.

Posted in ColdFusion, Frameworks by rip747 on October 27, 2006

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.


6 Responses

Subscribe to comments with RSS.

  1. Peter Bell said, on October 28, 2006 at 4:57 pm

    Not just speed but also use case. A general framework simply can’t be the optimal solution to every use case. Then the questions become:
    (i) Can you write a better specific solution than the “community” generalized solution? The vast majority of developers just don’t have the skills to do this successfully.
    (ii) Do you understand exactly how the frameworks work, why they work and which patterns you can safely remove (along with which patterns you might want to add)?
    (iii) Is it worth the time? It takes a lot of time to write a solid framework (probably much more than you expect). And then you need to create documentation that is at least as comprehensive as that for the community projects. Wouldn’t you be better using that development time to leverage existing community assets?
    (iv) Is it worth the learning curve? Not only you, but everyone else who has to work with the framework is going to have to learn your framework whereas many of them may already be familiar with MG or M2.

    There are LOTS of reasons to use a community framework, but there is absolutely nothing wrong with writing your own (every application uses a framework – the only questions are whether they wrote it or leveraged an existing one and whether it is a good one or a hacky one). As always – it depends.

    ColdFuion gets a lot of grief compared to other languages because there is a LOT of bad CF code out there. Custom frameworks get a lot of grief because most custom frameworks are not very good. That does not mean there is never a reason to write your own framework. if that was true, Model Glue and Mach-II wouldn’t exist – we’d all still be using Fusebox.

    But remember, writing Model Glue is kind of like creating Amazon – it is way harder than you’d expect. The vast majority of e-commerce start-ups will not become Amazon, and the vast majority of custom frameworks will not become M2, MG or Fusebox level popular.

  2. Peter Bell said, on October 28, 2006 at 5:17 pm

    OK, I’ve cleaned up and extended my comments and it has become a posting.

    Any intelligent comments (flamers need not apply) appreciated!

  3. Jeff Knooren said, on November 1, 2006 at 10:25 am

    I say, bad code and unoptimized graphics will do more to slow down an application moreso than any framework.

  4. […] Open Source Business Issues Why Use a Framework When You Shouldnt Use a Framework […]

  5. […] CakePHP – A “tasty” solution for PHP programming Top 13 reasons to use a web framework and never look back When you shouldn’t use a framework. […]

  6. engevaWaH said, on November 2, 2008 at 4:02 am

    I am sure that there are plenty of positives out there, but what have you seen for yourself? Do you understand my stubborn toe Do you want a joke? 🙂 What insect does well in school? A spelling bee.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: