David Golding



Review of Practical CakePHP Projects Book

By David Golding | Print This Post Print This Post

In recent months, new documentation for CakePHP has been rolling off the press. I’m pleased to forward on to you the newest addition, Kai Chan and John Omokore’s Practical CakePHP Projects. In this post, I’ll give my review of the book, which I hope proves useful for you interested Cake users out there.

Contents

The chapters, in general, focus on one project at a time. In order, here are the projects you’ll build with the book:

  • Blog (of course… :) )
  • Shopping Cart
  • Message Forum Web Service
  • Google Maps App
  • Twitter and Google Translator Mashups
  • Unit and Web Tests
  • Control Panel
  • Translation
  • Custom Automagic Fields
  • Templates/Tags
  • Dynamic Data Fields
  • Captcha

These projects aren’t designed to be absolutely conclusive, in other words, when building the shopping cart, you won’t be building a complete cart solution like ZenCart or Magento (this would probably end up being a book all by itself). But, the tutorials do apply Cake principles to application development and will produce a working application that performs useful methods and tasks.

Pluses

Why I’d encourage you to buy the book… If you’re like me, you want to see code samples of live apps that you can tinker with. In fact, the best way I learn anything is to see working code and dissect it, and manipulate it until I know what’s going on and how I can use it to fit my needs. In theory, my Beginning CakePHP book wanted to ground the reader in the overall principles of Cake development, and though I was pleased with how much code samples I was able to include, it was a fine line between overloading the reader in early phases of learning Cake and giving just the right amount of working code. In other words, I feared putting out too much code that may not make sense to beginners without explaining what was happening.

Well, Practical CakePHP Projects takes on a different theory. In a way, it assumes you’ve read my book or an introduction like it, and goes from there. The chapter on “Cake Fundamentals” does explain some basics for getting a Cake app going, but it still presupposes some knowledge in the framework. Practical CakePHP Projects gives you lots of code, with explanations of what’s happening, but is not so nit-picky that you get drawn out definitions of every line. For the coder familiar with Cake but wanting to see it applied to various projects, this is your book, and it does this well.

Minuses

Though I worked as the technical reviewer on this book, I hope this post here isn’t overly biased. No book is perfect, and useful feedback will help us all as we try to use Cake and make it a better and more widely used platform. I will be upfront: I do have an interest in this book’s success, though I don’t get paid at all for its sales or anything. My interest is two-fold: I’ve had a great experience with Apress and I’ve been spared many an hour due to Cake’s awesomeness. I truly want to see Cake see wider acceptance and use, and the first step is that the platform be sweet (which it is) and the second step is to make the documentation understandable, easy, useful, accessible, etc. Like business gurus know all too well about location, for an emerging platform it’s all about “documentation, documentation, documentation.”

Practical CakePHP Projects adds to the repertoire of Cake docs that leads new users in the right path. But some code samples overly use the controller when a better paradigm would distribute code across the MVC. But let me fore-mention this, and I still believe you’ll have a good experience with the book. Super advanced readers might quibble over some of the code or concepts, but that’s unavoidable. What’s important is that those readers who currently are new to Cake or are looking for ways to improve their working knowledge of the framework get good documentation and useful examples to work with, which I believe this book will do for you. So my own issues with the book included the dependence on the controller to get things done, some naming conventions, and, really only the Captcha chapter. Aside from these concerns, which I believe are minimal, I’m excited about having in one book a nice assortment of applied Cake code.

From Here…

Now, in this sense, I’m definitely biased: I’d love to see you read my book “Beginning CakePHP” (can’t get on my case for that, would you?). But if that’s not in your plans, at least give Practical CakePHP Projects a try. It does operate in a different mind-set, one of giving you lots of code samples to work with, and so getting your feet wet in Cake won’t take long at all with this book. If my book and this one are in your plans, I’d expect after reading these two that you’ll have a firm grounding in Cake and will be ready for as advanced methods as Cake can offer you.

If you’d like more specific reactions about the book, please catch me in Readers’ Forum or drop me line through my contact form. And, from one Cake baker to another, Happy Baking!


Comments

7 Responses to “Review of Practical CakePHP Projects Book”

Justin

Dec 19th, 2008, 5:58 pm

Thanks for the review. I liked the book, but really wonder why the authors beefed up the controllers so much. You’re right about the naming conventions… they just don’t stick to any of them. But it’s a great book, lots of code, good explanations, I think. I really like the chapter on Unit Testing. I think it makes sense why you should unit test.

Ray

Dec 26th, 2008, 4:37 pm

David,

I just tried to do the ACL example. Even if I just go with the straight one in the code base (not the _changed_ one), I get the following error if I try to delete an aco: Fatal error: Call to a member function Delete() on a non-object in C:\web\kenziescloset.org.www\docs\app\controllers\actions_controller.php on line 49

Any suggestions? I’m really struggling with CakePHP… Been beating my head on some projects that are coming due for about 3 weeks and this ACL thing has me realllllyy stuck.

Thanks!

Ray

Dec 26th, 2008, 11:14 pm

David, found the error.

Line 48 of actions_controller.php should be:

$aco->Delete( $delete_id );

Rather than:

$this->Action->Aco->Delete( $delete_id );

Gorgol Camaro Bas Tardo

Feb 20th, 2009, 10:14 am

SO IF the code is WRONG, will this not be changed in the sources? There is nothing more painful than trying to learn from an example and finding out that it was wrong.

Another one: I think it IS extemely relevant if authors are totally confusing readers by using their own naming scheme – cake already seems to have a quite weird “naming convention” – singular, plural, small letters, big letters – every possible variation is used in this “convention” and so turning it in fact into a parody of a convention! If authors add another layer of crazyness it becomes really painful.

Also if they use a WRONG coding style of doing everything in the controller – why the hell did you let them get away as a “technical reviewer”???

I believe we need better, much better quality, not only on code, but also in the books that are written about code. There is no bigger evil you can do than to teach someone wrong things.

David Golding

Feb 20th, 2009, 1:55 pm

You have to remember that the technical reviewer cannot override the choices of the author. The author owns the copyright and makes a final say with everything. So I made many suggestions that would tighten up things with the book that came under the decision of the author, either to accept or not. So, that’s my disclaimer. However, you also have to remember two important things about these book projects. First, the framework changes frequently. It’s best to get something useful by way of documentation to legitimize the framework, and before my book, there wasn’t anything really for English speakers. But, that’s the cost, that the framework might change under you. I personally think readers of technical manuals should expect this and not be overly dogmatic about precision, since every technology evolves and changes. We do our best as authors, all the same, and should, but can’t be perfect at it. Second, remember the audience for the book. At least for Practical CakePHP, the readers should already know about conventions, etc., and see how these authors are proposing their own suggestions for accomplishing tasks with Cake. Because they are up front with this fact about their intended audience, I think you ought to cut them some slack. I do empathize, though, with your concerns, and good authors, I believe, will take them seriously and do their best with them in mind.

ck

Dec 15th, 2009, 6:51 am

A very useful review; one thing missing though?

Would it be possibel to tell us what version of CakePHP this book used?

This is normally the reason why the included code does not run (as given).

ck

Dec 16th, 2009, 3:21 am

Just managed to take a look, seems that Beginning CakePHP is for v1.2 – seems to also hold up for v1.2.5 too.



Submit Comment


Beginning CakePHP: From Novice to Professional by David Golding

David Golding

A blog about CakePHP, web design, and grad studies in religion. © 2008, D. Golding