Skip to main content

Book review: CMS Design Using PHP and JQuery

A couple of weeks ago I got a request from Packt Publishing to review the book "CMS Design Using PHP and JQuery". I accepted the offer because we're using more and more JQuery in our applications these days and I thought this book would give me a better insight in how to best use JQuery.

After receiving the book I started reading it. But right from the start the author displayed bad practices and mis-use of PHP. Reading the book from front to back, the author Kae Verens (@kae_verens) has confronted me with bad use of variables (like $a, $b, $c), bad use of PHP structures and a complete wrong approach of using JavaScript, where JavaScript should enrich an application instead of incorporating business logic.

The good:
It was nice to see JQuery has a variety of plugins to get things done, most of the plugins discussed in the book were developed by the author himself.
I do like the way Kae Verens (@kae_verens) breaks up a CMS basic functionality and targets it one by one to describe it's functionality and purpose. Without the code samples, this book is a good guide for anyone who wants to build a home-grown CMS.

The bad:
It's not bad, it's worse!

The ugly:
As already stated in the introduction, this book is a complete contradiction to the things we try to promote. Clear separation of business logic and presentation layers (where JavaScript is another presentation layer) has gone out of the window in this book.

Since the audience for this book are beginner to intermediate PHP developers, I can only curse at the author to be more responsible. Never use meaningless variables like $a, $b, $c!!!

Filtering and Validation of received data was something I missed in the code.

Another thing, if you use SPL functions like DirectoryIterator to traverse a directory on your filesystem, use the SPL methods that come with it (e.g. $dir->isDot() to verify if it's a "." or "..").

At the end of the book the author says this application only works on a *NIX platform. I think this statement reflects how this application is build: poor design.

Conclusion:
After reading this book, I should advice Packt Publishing to put a sticker on it "Warning: explicit content - bad coding practices" as this book is dangerous in the hands of novice PHP developers.

I'm very sorry for the authors and Packt Publishing as the topic of this book is very promising and could be a good read for everyone, but at this point with this type of coding I strongly advice people NOT to buy this book. Maybe a next edition…

Comments

  1. Thanks for the review

    ReplyDelete
  2. At least an honnest review !
    Thanks

    ReplyDelete
  3. Anonymous24/2/11 03:42

    Your review seems too negative, these are minor flaws and are common in many programming books. My complaint is that $30 for the e-book is too expensive!

    ReplyDelete
  4. Anonymous24/2/11 10:27

    probably fair enough review.. I bought the author's other book "jQuery 1.3 with PHP" myself and to be honest the coding quality in it was a bit of a dogs dinner as well.

    ReplyDelete
  5. Anonymous24/2/11 12:20

    From your review:

    At the end of the book the author says this application only works on a *NIX platform. I think this statement reflects how this application is build: poor design

    I think this is quite daft. Unless you are developing an open source applications, it's entirely correct to build for a single, tailored-environment. In fact this is how you can take full advantage of the systems capabilities rather than having hordes of ifs to verify if the method/function exists in the N platform.

    I would even go as far as saying that anyone that designs their applications to run on windows and linux in production environment are complete idiots.

    Nonetheless, this is an honest review. I'm not sure if it's fair considering I've just read http://verens.com/2011/02/24/response-to-dragonbes-review/ but at least it's honest even though some arguments are unfounded and/or simply off the point.If this were a PHP Best Practices book, it would however be another story.

    ReplyDelete
  6. @Anonymous:

    I for one am happy that Michelangelo speaks the truth. He wasn't a jerk about it, he just told the truth.

    If something is bad, why not say it is bad?

    ReplyDelete
  7. Great book. I strongly recommend it for my developers.

    ReplyDelete
  8. jQuery is one of at least a dozen JavaScript frameworks that have exploded onto the scene during the last few years, and for good reason. The Web 2.0 era has called upon JavaScript in a big way, turning to it as the driving force behind all the gliz and glamour that defines any Web 2.0 site. This huge increase in workload for JavaScript has called out for JavaScript frameworks that do the heavy lifting of common Web 2.0 tasks for us, from common visual effects such as fading, DOM traversal/ manipulation, to of course, Ajax interaction. jQuery has risen to become one of the most popular JavaScript framework due to its small footprint and focus on just the core tasks shared by almost any Web 2.0 project.

    ReplyDelete
  9. I've notice the quality of the Packt Pub PHP books haven't been all that great. Some of the books I feel like is a waste of money, since I can easily find the information by searching for a tutorial on the subject. Some just are mashed together and are inconstant in presentation.

    ReplyDelete

Post a Comment

Popular posts from this blog

PHP 7 and Apache on macOS Sierra

I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install. The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands. I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial. APACHE AND PHP WITH HOMEBREW I’ve made this according to the installation instructions given on GetGrav. The installation procedures These installation procedures will set up your macOS Sierra with PHP 7.1 and Apache 2.4. Install Xcode command line tools (if not done yet)xcode-select --install Install Homebrew/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Set up for in…

Sessions in PHP 7.1 and Redis

In case you have missed it, PHP 7.1.0 has been released recently. Now you can’t wait to upgrade your servers to the latest and greatest PHP version ever. But hold that thought a second… With PHP 7 lots of things have changed underneath the hood. But these changed features can also put unexpected challenges on your path. Our challenge One of these challenges that we faced was getting PHP 7.1 to play nice storing sessions in our Redis storage. In order to store sessions in Redis, we needed to install the Redis PHP extension that not only provides PHP functions for Redis, but also installs the PHP session handler for Redis. Because we upgraded our servers to PHP 7.1, we were looking to use the latest provided version for this Redis extension: redis-3.1.0. Once installed, we bumped against a nasty problem. Warning: session_start(): Failed to read session data: redis (path: tcp://127.0.0.1:6379) Searching the internet for this error, we didn’t got many hits that could point us into a dire…

Speeding up database calls with PDO and iterators

When you review lots of code, you often wonder why things were written the way they were. Especially when making expensive calls to a database, I still see things that could and should be improved.
No framework development When working with a framework, mostly these database calls are optimized for the developer and abstract the complex logic to improve and optimize the retrieval and usage of data. But then developers need to build something without a framework and end up using the basics of PHP in a sub-optimal way.

$pdo = new \PDO( $config['db']['dsn'], $config['db']['username'], $config['db']['password'] ); $sql = 'SELECT * FROM `gen_contact` ORDER BY `contact_modified` DESC'; $stmt = $pdo->prepare($sql); $stmt->execute(); $data = $stmt->fetchAll(\PDO::FETCH_OBJ); echo 'Getting the contacts that changed the last 3 months' . PHP_EOL; foreach ($data as $row) { $dt = new \DateTime('2015-04-…