A Piece of Cake

No Comments
23 Aug

logo-mini.gifI’ve blogged about using web frameworks in the past, and for the most part, I think they are generally useful. Most recently, I had an opportunity to do a bit of experimenting with the PHP based CakePHP framework. The nice thing about being PHP based is that it’s basically one less thing to worry about, since PHP is installed on just about every web host, whereas that’s not necessarily true with Ruby.

In my most recent project, a client came to us us for a new web site, and they had some data that needed to be displayed on this new site. Displaying this data was easy enough, since “displaying” pretty much meant just constructing the proper SELECT statements to retrieve the correct data for all the various views required.

The administration of this data however, was a tiny bit more complicated, since there were foreign key constraints to worry about, and other minor book keeping requirements. The existing backend that did all this was basically just a simple web based application that managed the data. There’s really nothing complicated about it, it’s your everyday run of the mill Create/Read/Update/Delete app (aka tedious and boring). But it wasn’t very good at it (usability issues), was hard to improve and add new features (not MVC based), and was written in ASP (blah). And in particular, because it’s written in ASP, it would not be compatible with the new site’s PHP based environment. This meant it would need to get rewritten/refactored into PHP (double blah).

Which is where CakePHP steps in. The great thing about CakePHP (or any framework really), is that it takes care of all the boring crud operations. Since this project is basically one big crud, all I had to do was run a couple scripts in CakePHP to tell it what the data model was, and which admin screens I wanted to use. Then, it was a simple matter of linking these admin screens together and making them look somewhat presentable. There was a bit of a learning curve to actually get up and running, but once I understood how the basics worked, CakePHP’s built-in scaffolding literally did 95% of all the heavy lifting.

I think if I were to do this project from scratch and without the help of a framework, it would probably take me twice as long, and not be very easy to maintain. CakePHP definitely saved me time (and sanity), and I will probably look to it for future custom projects. Another PHP based framework that’s worth looking at is the Zend PHP Framework, though I believe CakePHP has been around a bit longer.

Posted on Thursday, Aug 23rd 2007 at 8:36 pm

No comments

Leave a comment