I’ve often had a dim view of web frameworks. At b5media we had more than one case where we’d send out some pretty basic development to be done, and we’d get it back, done in a framework that took more time to get running than it was worth. And, from a performance perspective, all that overhead has got to slow things down.
Now that I have a tiny bit more time on my hands I’ve started to try and write some code that I’ve been meaning to. As I sat down to it I started thinking of all the overhead I’d have to write – some authentication, some mapping of URLs to functions, database stuff, and then it hit me – this is what a framework does.
Given I had no deadline to meet, I decided to try out a framework. I’m not a Python guy, so Django was out. Rails sounded sexy, but the last thing I needed was to learn a new language, especially one that looks like it was written by someone on crack and that looked more like line noise than Perl.
I’d rather have picked on in Perl, but knowing that I’d probably be putting this on a shared host at some point, PHP was probably the best bet.
Symphony caused me no end of grief at b5, so it was out. I ready a bit about Zend but decided it wasn’t for me. Code Igniter seemed like too much of a moving target, which left CakePHP. Looking further into Cake it seemed like it was well laid out, had a large community with active development, and does a lot of things Rails does. What sold it for me was that it was one of the few frameworks that supported PHP4 which is on many shared hosts still.
Over the course of an evening I went through the first 3 CakePHP tutorials at IBM. Then I picked one of my projects and started slugging through it.
After a couple of weeks I learned the following:
MVC is really good for web apps. It took me a while to put the SQL generation in the hands of the framework, but most of my queries are simple anyway. Besides, I can always do $this->Model->Query(“SELECT blah..”).
Using a framework gets you up and running fast. Most of my programming is trying something, seeing how it looks, then trying something else. The framework lets me get to that point quickly, especially with scaffolding if I still haven’t finished a particular model/table.
It’s not slow at all. I haven’t got around to profiling it, but the response time is quick, and it’s not taking up much space in my opcode cache, no more than Smarty would have
Programming’s a lot more fun when you let the framework do all the crap work