LXer Book Review: Practical CakePHP Projects

Posted by Sander_Marechal on Jun 25, 2009 10:19 AM
LXer Linux News; By Sander Marechal, The Netherlands


LXer Feature: 25-Jun-2009

CakePHP has rapidly been gaining mindshare as a powerful and easy to use MVC framework for PHP. Mimicking Ruby on Rails, it allows developers to quickly prototype and build database driven websites and web applications. With increased popularity books usually follow. “Practical CakePHP Projects” by Kai Chan and John Omokore is one such book. It is aimed at advanced PHP developers who have some experience with CakePHP and builds on books like “Beginning CakePHP” (Apress, 2008). The book promised to show how to build practical, real-world web applications using the CakePHP frameworks.



Unfortunately “Practical CakePHP Projects” only partially succeeds in that. It is refreshing to see how applications are built that are different from the proverbial “blog” or “store” example (though both are used in the first chapters), but I find myself disagreeing often with how these applications are built. The chosen solutions often seem to work against the framework instead of going with it.



The projects



After the blogging example--which seems to be the “Hello World!” of MVC frameworks--follow chapters that show off e-commerce sites, Google and Yahoo maps clients and Twitter mashups. Interesting examples but not optimally implemented. The e-commerce site implements it's own nested categories instead of using a TreeBehavior and exposes private controller methods as publicly accessible actions. The forum example tries to shoehorn the Command Pattern on the framework.



A more onerous example is the dynamic data fields in chapter 12, which allow SQL injection. Joshua Bloch said it very nicely in his TechTalk on API design.



Example programs should be exemplary. You should spend ten times as much time on example code as on production code (17:05 in the video).



A true statement for a very simple reason: Example code gets copied and put into production, no matter how big the disclaimers are that you put next to them.



Reading the book leaves me with the feeling that the authors are trying to coax the framework into doing things it is not really suitable for. It is interesting to see how they achieve their goals but I do not have the feeling that I am a better CakePHP developer after studying their projects.



Source code



Accompanying the book is a downloadable archive that contains the source code for almost all the examples in the book. A good idea considering there are plenty of examples which are longer than usual for such books. The examples do not work out of the box unfortunately. They all require a running (MySQL) database and the SQL schemas are not supplied with the examples. They need to be copied manually from the book. A missed opportunity, especially when you consider that CakePHP can use SQLite databases so that the applications could have run out of the box.



In addition to that, some of the examples contain bugs and errors that need to be fixed before the examples will run at all. I am not talking about some edge case bugs here but clear and simple errors that pop up as soon as you try to run the projects. These errors should have easily been caught just by trying to run the examples.



Conclusion



Overall I expected more from this book. It has shown me a few interesting ways to (ab)use CakePHP to make it do what you want, but I don't feel that this book has helped me build better CakePHP applications. Combined with the quality of the examples themselves I can't give this book a higher rating than 6 out of 10.

Book information



TitlePractical CakePHP Projects
AuthorsKai Chan and John Omokore
PublisherApress
ISBN978-1-4302-1579-3
YearDecember 2008
Pages379
CD IncludedNo
Overall rating6/10


Return to the LXer Features

This topic does not have any threads posted yet!

You cannot post until you login.

LXer

  Latest Features
Scott Ruecker (Phoenix, U.S.): LXer Weekly Roundup for 14-Dec-2014
Dec 15, 2014

Scott Ruecker (Phoenix, U.S.) : Interview With Richard Kenner of AdaCore
Aug 29, 2014

Carla Schroder: Test Sites for Heartbleed OpenSSL Vulnerability
Apr 09, 2014

penguinist: Better Than a Quad-Head Display: My Adventures with "4K" 2160p and Linux
Mar 31, 2014

Dr Tony Young: Replacing KDE4 with Xfce
Mar 07, 2014

Dr Tony Young: Removing/Disabling The Semantic Deskop in KDE4 Running on openSUSE 13.1 Part 2
Feb 18, 2014

Dr Tony Young: Removing/Disabling The Semantic Deskop in KDE4 (and firing up Thunderbird) Part 1
Feb 08, 2014

Dr Tony Young: KMail Complexity - and a little Patience
Jan 26, 2014

Carla Schroder: Linux Nerd New Year's Resolutions
Dec 29, 2013

Carla Schroder: Fedora 20 Released With New, Newer, and Newest
Dec 17, 2013


View all

  Search Features

Search LXer Features:

[ Copyright © LXer | All times are recorded in Central Daylight Time (CDT) ]

[ Contact Us | Privacy Policy | Terms of Service | About us | rss | Mobile ]

Login