I'm officially a Baker with CakePHP

June 23, 2006

I've always dreaded frameworks. Ususually it takes longer to learn a framework than to actually code the project in the first place. Over the years I've checked out various frameworks and all fell short when I tried to do something that needs to be done in the real world. There's always some tradeoff that needs to be made.

So fast forward to now and I've been wanting to develop some new sites but I hated the thought of having to set them up. I downloaded the Zend Framework and as soon as you have your basic view, controller set up you quickly realize... wow that's about all I can do. Heck it doesn't even have pagination yet. Now Zend Framework will no doubt be successfull and most likely in a year from now should have a pretty good feature set but for today it looks like there is a king of the hill for PHP frameworks(for me anyway). CakePHP. This was my first real dive into a rails like MVC framework. I played with php on trax but it was also in it's infancy and to be honest I tried cakePHP a while ago and hated it because nothing worked. Well, they seem to have really busted their asses to get this thing up and running because I love it so far. I even got the MyBic Ajax framework working in about 2 minutes.

The real winner for this framework is the amount of documentation on the site and the google group that has an active user base. I was able to read through the docs and get up and running in 5 minutes! I did however have to digg (see I can't even spell dig right anymore) through a bunch of crap to find out how to use pagination.I had to sift through alot of old posts about proposals for pagination which had me trying to find the final solution to the issue :) When I did find it, in 5 more minutes I had paged results. The active record modeling is awesome. I can associate tables anyway I want as well as define runtime associations of tables.

The only real downside I see so far is performance. Since it's based on active record there are alot of queries made for each model or table. For example if I had a users table and and images table and the user could have many images you'd see the following queries made:

DESC users
SELECT * FROM users
SELECT * FROM images where user_id = 1;
SELECT * FROM images where user_id = 2;
etc.etc...

Now you can override the default active record pattern and just do a big join yourself to save some mysql cycles but active record is the true beauty of the framework so I'm going to try and live with it and see how it performs under more load. It's most likely not a problem but if your site happens to get "DUGG" one day or quickly becomes popular you could have some major nights of refactorting queries ahead of you.

All that taken with a grain of salt CakePHP has pretty much everything you need to at least get your site up and running in no time flat. Great documentation, good mailing list and a general sense that this framework is going places and should be a major if not the major competition to the Zend Framework. I'll probably say the more advanced developer will probably lean towards CakePHP as the Zend Framework is purely static calls at this point.

Kudos Cake


Comments

RSS feed for comments on this post.

  1. bcyde says:
    June 26, 2006 @ 07:11 — Reply

    I've had the same attitude towards frameworks that you've had and have also been looking at buckling down and learning a 3rd party framework (cakePHP or symfony). One of my main issues is with performance. I'm wondering what type of site(s) you're intending to use cake with (and when you'd recommend against it). Do you foresee some cutoff point where you need to squeeze out more performance of your app that the framework just starts to get in the way and causes more trouble than it helps? Thanks, -b

  2. abraxas says:
    June 26, 2006 @ 08:01 — Reply

    I'm gonna look into CakePHP really soon, but I must say in advance, that I find it a shame that it's PHP4-based. I don't have an opinion on how great the framework is, but if it were only based on PHP5, I'll bet it could be even that much cooler.

  3. Felix Geisendörfer says:
    June 26, 2006 @ 09:32 — Reply

    Hey abraxas: I disagree with you. php5 has not hit a critical mass quite yet, which means doing the framework in php5 would keep lots of users from using it. Besides that CakePHP is completly php5 compatible, and you can use all cool php5 features for your own projects with it. CakePHP even emulates a lot of php5 features like __constructor() so migration will be a lot easier later on.

  4. abraxas says:
    June 26, 2006 @ 11:28 — Reply

    Of course I can't blame them for staying PHP4 compatible, but perhaps they could start moving to PHP5 in a side project? A main reason for sticking with PHP4 has always been "website hosters are still using PHP4", but CakePHP doesn't seem to be the framework for small webhosting websites. It seems quite suitable for large web applications, and as a software developer, you often really can make certain demands about the platform it runs on.

  5. Poncho says:
    June 28, 2006 @ 06:08 — Reply

    It's great to see more serious developers 'get' cakePHP. I've used it to build three fairly big websites not and (aside from a few setbacks), it's been a breeze to get some real work done quickly. I also had some reservations about the current batch of frameworks (including Zend) but found cake to be the most intuitive and obvious candidate. On the php4 v php5 debate, all of the sites I've built with cake run in a shared php4 environment with no problems. Although I am future-proofing my apps as far as I can, as a freelance web developer, getting affordable php5 hosting in the UK is pretty much impossible at the moment. Cheers; Poncho

  6. bcyde says:
    June 28, 2006 @ 08:57 — Reply

    Hey Poncho, can you give more info on what you mean by fairly big websites? When you say fairly big do you mean the scope of the app, or the traffic load, or both? Would you be able to post links to those sites? Thanks, -b

  7. Larry E. Masters says:
    June 28, 2006 @ 10:49 — Reply

    @Jim, This will be a short reply from me right now, I am on a trip and using treo phone to type this... When you are in debug mode, DEBUG > 0 the meta data queries are cached for a very short time, try hitting refresh right after you first request and you will see less queries. When DEBUG = 0 these are cached for a much longer time. Another model method to look at is bingModel... when I have access to a full keyboard and a screen large then 2" x 2" I can reply more

  8. Jim says:
    June 28, 2006 @ 18:05 — Reply

    hey Larry, yep I didn't realize that until after I made this post :) so it looks like you guys have thought of it all. Day 6 and still loving it, I just want to keep adding features so I can use back.php to create scaffolding :)

  9. Louis Vuitton Ha says:
    January 29, 2010 @ 22:32 — Reply

    Comment pending moderation

  10. blu ray ripper says:
    April 18, 2010 @ 04:31 — Reply

    Comment pending moderation

  11. china laptop battery says:
    May 29, 2010 @ 00:50 — Reply

    Comment pending moderation

  12. virbram five fingers says:
    June 4, 2010 @ 20:31 — Reply

    Comment pending moderation

  13. LOUIS VUIttON OnlinE says:
    June 9, 2010 @ 22:46 — Reply

    Comment pending moderation

  14. replica watches says:
    June 21, 2010 @ 08:04 — Reply

    Comment pending moderation

  15. air max says:
    June 24, 2010 @ 02:26 — Reply

    Comment pending moderation

  16. watches replica says:
    June 24, 2010 @ 19:34 — Reply

    Comment pending moderation

Leave a Comment

Line and paragraph breaks automatic, HTML allowed: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <code> <em> <i> <strike> <strong>

Comments disabled due to spammers being losers that lead sad lives.