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 (San Diego, U.S.): Linux That's Small
Oct 14, 2024

penguinist: Encryption, Trust, and the Hidden Dangers of Vendor-Controlled Data
Aug 27, 2024

Scott Ruecker (San Diego, U.S.): My Linux Mint Tribute
Aug 23, 2024

Scott Ruecker (San Diego, U.S.): How I Turned My Chromebook Into A "Mintbook"
Jul 08, 2024

Scott Ruecker (San Diego, U.S.): Adventures With My New Chromebook
Jun 10, 2024

Scott Ruecker: My Linux Laptop
May 08, 2022

Scott Ruecker: Laptop Dual Boot Project: Part 2
Nov 30, 2021

Scott Ruecker: Laptop Dual Boot Project
Nov 30, 2020

Scott Ruecker: Lenovo Laptop Love..Not!
Nov 01, 2019

James Dixon: Attempting to install Linux on a new laptop, a follow-up
Sep 21, 2019


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