Most Helpful Customer Reviews
|
|
20 of 20 people found the following review helpful:
4.0 out of 5 stars
Very good book, despite some muddled spots, March 20, 2008
I've owned PHP Objects, Patterns, and Practice for over a year, and it's still one of those books I go back to. It's a well written, generally well executed book on what constitutes Object Oriented Programming in the PHP5 environment.
First, the good news:
This book is a crash course on OOP design and thought. It borrows heavily from two monumentous texts in the field - the Gang of Four's book, and Java Enterprise Patterns - and condences their essences into an easy to swallow form. The basics are all here: how to create well designed classes, how to instantiate objects, etc. There's a hidden gem in the introductory portion of the book: the Reflection API. This API is built into PHP, and gives the coder unparalleled access to the guts of the classes and objects in a given project. It definitely has its uses.
The patterns are all generally useful, with the only exception perhaps being the Interpreter pattern. I'm just not convinced that creating one's own command line interface syntax is necessary, given that PHP projects aren't usually interactive. It seems like something best left to an appendex, or extra web content.
Now, for the bad news:
Some sections of the book, especially some of the code examples, could've used a better editor. Small things, the kinds of things that can trip up inexperienced coders, crop up. Using private properties instead of protected. Using the wrong variable name between examples. That sort of thing.
There's also a lack of a satisfying conclusion, so-to-speak. Zandstra himself claims that generating objects is perhaps the hardest thing to demonstrate. Yet, most of his examples (excepting the patterns late in the book) are canned. Objects and classes exist only to drive the theory behind a pattern home. Few real world examples are given. Admittedly, some patterns are simple to transfer to a real project, but concrete examples of that nature could serve to further cement his point. For example, it's not difficult to see how the Composite pattern would work well for dealing with an XML document, but would there ever be a need for a Visitor object to act on one?
Finally, and in continuation of my last criticism, Zandstra never touches one of the things PHP is used the most for: form handling. Can forms be represented by classes? Could forms be generated by objects (perhaps using a Factory pattern)? What about form validators? Wouldn't the Strategy or Decorator pattern work? Supplementing his online Civilization game and CLI/quiz examples with this would've really put the book over the top.
Still, with that said, PHP Objects, Patterns, and Practice is still a text that gets far more right than wrong. It's definitely a must-buy for those PHP coders looking to write modular code.
|
|
|
10 of 10 people found the following review helpful:
5.0 out of 5 stars
Best OO book on PHP ever, March 18, 2008
This is the best book I've read on Object Orientated PHP. This book does a great job of explaining the ins and outs of OO in PHP 5. As a self taught PHP developer of 5 years, I had lots of questions about "am I doing this right", "how should this be done" and the book has answered most of those questions.
I'd recommend the book to those who already have an advanced PHP knowledge but are looking to take their code another step forward by improving it's re-usability. It's also a great read if you want to find out the power that PHP 5 has over PHP 4.
Note: this book doesn't contain code that you can use. It teaches you the principles that you should use in your own projects.
|
|
|
6 of 6 people found the following review helpful:
5.0 out of 5 stars
4.5 stars really, but overall a very good investment, November 17, 2008
It's been about a year and a half since I've read this book, I have the first edition, but I think most of what I write is still relevant for this second one.
This book deserves 4.5 stars, but I could enter either 4 or 5. I'm giving it 5 because at the moment, very few php books come close in trying to actually present the language as a real contender for serious and professional web development. This book might change the mind of many who've always thought of php as a hobbyist language.
PHP has come a long way since its inception, but the teaching material has not really caught up and the community is still pestered with bad code, architecture and practice. This book is an eye opener as it presents php for what it can be: a convenient and flexible tool that, in the right hands, can tough up and do great things. After this you might seriously question your decision to go Java. It's not to say that php can do everything, but before you move away, you should definitely understand why. The book has 3 parts:
The object section is a nice introduction to the goodies in the new php5 object model. As a matter of fact, the entire book is php5 centric, which to me is a plus. You'll learn about such things as the __call, __get and __set "magic" methods, the __toString method, the Reflection API, just to name a few. By the end of this section, you should have a clear idea why it might be good to let php4 rest. One thing sorely missing though, is an intro to the SPL.
The Pattern section is probably the bulk of the book. It's a nice attempt at bringing some java into your php coffee. An intro to the world of design patterns as they can be applied to php. You'll learn about different "enterprise" patterns (there's that java buzzword), to help you better structure and organize your code. If you've heard of such things as Singleton, Observer, Registry, Controller, MVC and are still scratching your head, this might be a good investment.
The Practice section was a bit of a let down. If the author cares for some suggestions:
- forget CVS: there are currently two popular and very good open source version control libraries, SVN and Git. Git being slightly more complex to understand, but in terms of performance and usefulness, in a class of its own.
- forget PEAR: instead have a chapter on frameworks, or maybe particularly about the Zend Framework, which is as close an approach you can get to modular object oriented libraries. ZF embodies exactly what this book tries to preach and is completely written in PHP5. I think it is the perfect candidate to replace PEAR in that section of the book.
Just my 0.02$.
|
|
|
Most Recent Customer Reviews
|