Kay lives here

working with the web

Another angle on the frameworks debate

This post started life as a comment on Akash Mehta’s post on the SitePoint PHP blog Last we checked, PHP IS a framework, but it started to get long and ranty so I moved it over here.

I’m allowed to rant on my own blog, right?

Akash wanted to point out that an argument often invoked in PHP vs Ruby on Rails debate – namely that Rails is a framework whereas PHP is a language and thus they can’t be compared directly – is not quite right because PHP was designed for the web and as such, it’s a framework as well as a language.

I think the same argument can also be applied, to some extent, to ColdFusion. It probably fits even better because ColdFusion, which predates both PHP and ASP, was designed with speed and ease of development in mind, so the things that developers need to do all the time – querying databases, looping over result sets, sending email, doing remote requests – are built into the core language in such a way that they can be accomplished in as few lines of code as possible.

This brings another dimension into the frameworks debate (disclaimer: I’m a big fan of formal frameworks). Is there a point where a web application is so small or so simple that adding a framework simply adds unnecessary overhead? Should the fact that ColdFusion is so web-application-centric be enough for the developer to get the job done? I’m interested in your thoughts.

Of course, ColdFusion has a very healthy frameworks scene whereas I get the feeling frameworks are not as widespread or popular in the PHP universe. Does this reflect ColdFusion’s greater focus on the enterprise market – where applications tend to be larger, more complex and integrate with other technologies more? Is the fact that PHP has always been free and open source attracting a different kind of developer? Will the recent Open BlueDragon and open source Railo announcements change the CF developer profile? Or is it too late for that?

Where was I even going with this?

So thanks Akash, for your deep thought-inducing post. I do have to disagree with your opening statement, however – “When it comes to web programming languages, PHP probably holds the record for copping criticism from the community at large” – I think the world title for Web Application Language Whipping Boy is ColdFusion’s by a long shot!

10 Comments

  1. Dom, you’re such a hopeless fanboy :D

  2. Pingback: PHP is not a framework at node.mu

  3. http://codeigniter.com – A PHP Framework.

    I have no other point but to shamelessly promote it :)

  4. Sorry, I disagree. PHP is a language. It just so happens to have bindings for web stuff, which makes it a web language. It’s like saying Matlab is a maths framework – it’s not, it’s a language that has maths stuff built in.

    Besides, you can write command line programs and even windows (GTK on Linux at least) programs in it, which kind of kills this debate.

    Hmmm. I should really post this on the original blog post :P

  5. As Myles said, PHP is no more a framework than Lua, or Ruby, or C++, or Common Lisp, or any other programming language. Even further, the term framework tends to imply some overarching design principle or philosophy — some idea of ‘this is how we do it’ — that is entirely lacking in PHP. They can’t even figure out how to work around the lack of namespaces by append or prepending to the name of every symbol…

  6. Myles and Thomas – I wasn’t really commenting on whether the statement “PHP is it’s own framework” was true or not – in actual fact, I don’t really care either way. The OP’s side has an answer they believe is true, based in practise… your side was an answer that you believe is true, based in computer science.

    What I did find interesting was that the arguments being used in favour of PHP work even better when applied to ColdFusion. But I can get a bit one-track-minded like that :)

  7. There’s another one for PHP called Horde…

    But I was thinking … I dunno… languages that prompt criticism… How about Lasso + FileMaker? :) You know with all the talk about LAMP stacks and LAMBDA stacks, they could set up a Lasso Apache Ubuntu FileMaker (LAUF) stack, that’d be a hoot. :)

    Though seriously, I think from within any given software community it tends to seem that the community is always under attack from the outside, whether it’s Microsoft technologies or Adobe techs or PHP or Ruby. If you study cognitive science at all, you come to realize that those sorts of skewed perceptions are fairly universal.

  8. In response to the question, “Is there a point where a web application is so small or so simple that adding a framework simply adds unnecessary overhead?”

    From my perspective, a resounding yes. If you are writing a small app all on your own and odds are that nobody else will ever touch it, just crank the fast spaghetti code. Heck, put the whole thing in a single file even. ;-)

    Now, I do support frameworks, but they have their place and the quick and dirty CRUD apps that are more of a utility than anything else just don’t need it. I liken it to the people who feel compelled to normalize a database down to using a table named GENDER with three columns, ID, GENDER_CODE and DESCRIPTION and ensure all the constraints are there so the parent table stores the ID. Come on, just put M or F in your parent table and save the frameworks for the apps that really need/demand them. ;-)

  9. @Brad … I actually agree with your assessment… However I personally find that even for a really small app that only I’ll ever use, I’m able to crank it out a lot faster using DataFaucet and the onTap framework.

    That’s in part because the onTap framework doesn’t require mental acrobatics around the notion of an “event” and its “results”. It certainly allows you the ability to code that way if you find a need, but it’s just as easy to just write a simple page that creates a DataFaucet activerecord and uses that to populate a form.

    The other half of that story is that all the data normalization is already done and handled by the activerecord. Before I created DataFaucet actually, I wrote an article about porting Ray Camden’s Galleon forums to 4 different frameworks (onTap, Mach-II, Model-Glue and Fusebox 5) and although I didn’t port to any other ORMs, I did port the queries to the onTap framework ORM (now DataFaucet). That sub-article is also included in the DataFaucet documentation, showing how I removed about 500-600 lines of code from Ray’s original components.

    On a very small app for just myself, I wouldn’t expect to see that many lines of code removed. If I measure the amount of time I spend coding however, I spend less time and get more done when I use DataFaucet and the onTap framework. So it’s not always true that using a framework is extra overhead in terms of man-hours. In some cases it means fewer man-hours.

    Do I need to use DF/onTap for those apps? No. But I use them there like I do for other projects, so that I can get them done faster.