Sunday, February 16, 2014

Persistence in PHP with Doctrine ORM by Kévin Dunglas, Packt Publishing Book Review

Persistence in PHP with Doctrine ORM

In short, Persistence in PHP with Doctrine ORM is a book about harnessing the power of Doctrine ORM, but also:

  • Will let you build a working project using Doctrine involving advanced techniques;
  • Will guard you from doing mistakes early in your getting known Doctrine, and
  • Will advocate on appropriate technologies to use in addition in case your next creation is going to see the world.

I would recommend this book to a developer who worked with PHP already, but getting ready to embark onto a more intensive data processing endeavor.

The book is not terribly long, yet comprehensive enough to allow a person to become proficient in Doctrine say overnight (yes, my Kindle app estimated my reading speed at ~ 2.5 Hrs, that is without me experimenting with code). Personally, I value concise books because they give me a push and allow a relatively comfortable solo sailing with an occasional exploration of a topic I did not encounter learning but stumbled upon doing real-life work.

As an aside, use of an ORM (not just Doctrine specifically) is typically being perceived as a negative phenomenon by the data people (disclaimer: I am the data person), unsurprisingly Kevin mentions performance implications under the so called Big Data scenario. This has it’s grounds, I agree, as for example tuning DML or data retrieval, so let’s not argue here, but at least one aspect on an ORM not possible to beat - is its ability to allow seamless transition from one database platform to another, relatively uncommon in the past, seems to being picking up nowadays. But do not be overly optimistic, no migration is ever smooth, it just alleviates some of the pains and minimizes the costs of engineering and maintaining your software.

On the not so bright side the author does not cover executing stored procedures/packages, and apparently Doctrine (as most OSS projects) has a long list of defects, yeah, I can hear you, this is a book review, nothing else, ditto.

So one last interesting discovery, the Doctrine community focuses more and more on a NoSQL, Mongo in particular, which is thrilling.

You will find information in the book on how to build your own SQL, implement association, inheritance and even a not so often used many-to-many relationships.

On the odd note, I saw a circular reference created in one of the book examples, while possible it is very dangerous! Also the book covers only one approach: building your app code-first: meaning the database schema is created after a class, which I (you know who am I Smile) don’t endorse, alas I am / was new to Doctrine.

I suggest Kevin adds to ver. 2.0 of this book the following:

  1. Building an application the schema-up way, too, and
  2. Provide an example where Doctrine is using a Mongo database.

I give this book a 5 out of 5 rating because it has achieve its objectives, however it seems that Packt could give it the “Instant” moniker due to its material coverage.

No comments: