CakePHP: My Thoughts Part 2

email-addthis printer-addthis favorites-addthis facebook-addthis digg-addthis | Share

19 May 2007 06:59:14
Category: CakePHP

CakePHP is a rapid development framework. It's purpose is to speed up development by providing a base system to build on. So how does it do? Quite well.

Many PHP applications (both proprietary and open source) are a disaster: SQL and HTML wrapped around controls and interspersed with global variables. These applications are impossible to maintain and even worse for some one to modify. Cake does a good job at solving these issues. It's MVC -- Model View Controller -- architecture splits things into well organized layers. And it also provides a front controller that all pages are served through.

Personally I enjoy coding with Cake. There's only a couple of things that I would like to see change.

The first is documentation. The maintainers of Cake have applied the "less is better" rule to documentation. There are no charts available showing object life cycles or execution order. The current documentation is enough to get started but not much more than that. Even the inline comments are sparse and insufficent. The only way to get to know the framework is to read it. Fortunately if you read /cake/dispatcher.php -- you'll understand most of it.

Second, the framework encourages 'God' classes. How's this? Reusable sections of code are stored in "components". There's currently no API to extend these components. If you don't believe me check out the Bakery. It won't take you long to find code that smells.

Third, because Cake is OO and PHP 4 there is no code security. It's easy to wander outside of the purpose/intent of MVC layers. For example, from view you can easily access the controller, all the components and models. Big deal? Well the problem arises when you go to upgrade your framework and you discover that you have unintentionally wandered outside the bounds and find yourself refactoring your code to meet the framework's changes.

Overall I like Cake. But if any of the above bothers you I'd recommend some other PHP 5 framework like Symphony or Prado.

Cheers!