Back-end refresh

Friday, 11th April 2008

Lately I’ve been curious to play around with some PHP frameworks, especially CakePHP. After some messing around, I instantly fell in love with it.

I’ve never worked with a framework before so it was a bit hard to get into at first but it all worked out great after a little tinkering.

Features

What I liked most about working with a framework was the MVC design pattern, a great way to separate business logic and the presentation. I believe this is a widely used design pattern, no wonder - it’s great.

CakePHP reduces development costs and helps developers write less code.

Implementing such thing as form validation is a breeze, no more having to rewrite the same old dull code over and over - it’s all there and ready to be used!

Templating is one of the most useful things ever and are available in most frameworks and Cake is no exception. It makes it a lot easier to seperate business logic and presentation which makes your code much cleaner and easier to browse through - which helps when you want to update your code. Rather than looking at a blur of code, you can drill down to exactly what you want to edit.

I was also pleasantly surprised when discovering the built-in paging system, which requires a tiny amount of code to be set up:

<?php
var $paginate = array(
    'limit' => 5,
    'order' => array(
        'Note.created' => 'desc'
    ));

That’s everything needed to set it up for basic use, no more having to rewrite the same old code.

So, what are the biggest advantages of using Cake?

  • Caching
  • Template system
  • Reusing common code with Elements
  • Built-in data sanitation and validation.
  • Pagination with tiny amount of code

My time so far with Cake

For the past week or so I’ve ported all the old functionality into a new CakePHP app with a lot of new goodies and I figured rewriting my latest project would be the best way to really be able to try all of the different parts of Cake.

Also rather than using my own homebrewed BBCode for the site I’ve started to use Markdown by John Gruber, an excellent text-to-HTML conversion tool which I can wholeheartedly recommend to anyone in need of a BBCode alternative.

Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

I’m still getting into it, but I’ve covered almost everything but there are still some things I’ve yet to try out. I’m definitely staying with CakePHP for larger PHP projects and I recommend every PHP developer out there that haven’t yet tried a framework.

3 comments

  1. 's gravatar 12th April 2008

    markus

    Not wanting to nitpick but:

    var $paginate = array(
    

    Isnt it bad to have configuration tied to a specific language format?

  2. 's gravatar 12th April 2008

    ferdhie

    will try cake

    @markus: better than xml config .. ;))

  3. 's gravatar 12th April 2008

    Devinant

    Since you’re into frameworks, try playing around with Zend Framework. I think you’ll love it.

Write comment

Optional

No HTML is allowed, please use Markdown for text formatting.

Emails are never published, but are used to spice up your comment through Gravatar.