Here's another book review for you. Our own Azrael volunteered to review Peter Lavin's "Object-oriented PHP," published by No Starch Press, and here it is. The publisher's blurb reads, in part:
If you are a PHP programmer who wants to make the switch to an object-oriented approach, Object-Oriented PHP can ease the transition from procedural to object-oriented programming. Basic concepts are introduced using simple but useful classes. By the time you've finished this book you'll have an excellent grasp of object-oriented programming and numerous classes that can be easily reused in a variety of circumstances. But, more importantly, you'll be able to create your own classes and extend existing ones.
I asked Azrael what biographical information, if any, he'd care to share, and here is his reply:
Azrael is happy to be known as a computing science graduate working at one of
the world's (recently voted) top 10 Universities - if only because while being
absolutely true, it makes him sound far more interesting than he really is. His
interests tend towards the technical and geeky, and in recent years he has been
responsible for all too much sloppy PHP code being released into the wild. He
thought it was about time he read a book on PHP.
The book is also available from Amazon US or Amazon UK and Barnes and Noble, as well as from No Starch Press -- as a book or a PDF -- and you can read chapter 8, Using the PageNavigator Class as a PDF download. No Starch also makes the code examples available for download. Enjoy, everyone!
"Object-oriented PHP," by Peter Lavin - reviewed by Groklaw's Azrael
A few months ago a package came through the letter box, bringing
excitement into my life. I received a copy of "Object-oriented PHP," published by No Starch Press
to review. This is the first time I've
received a book to review, and my excitement was such that I was at once
looking forward to writing something glowing with praise. My immediate
excitement has died down over the time since I received it, and having
now read it I feel able to objectively write a review. Any praise which
glows does so genuinely and not out of any any initial ebullience.
Lifting from the back cover of the book "Peter Lavin runs a web
development firm [...] has been published in a number of magazines [...
and] is a contributor to PHP Hacks (O'Reilly)"...
The books is aimed at PHP developers without much object-oriented
experience, and at object-oriented programmers wanting to learn PHP.
I come to the book having taught myself PHP a little over 3 years, and
having studied object-oriented programming at University about four
years ago. I regard myself as still learning PHP, picking up the bits I
need to know as and when necessary, and I haven't done all that much
object-oriented programming in the past four years. I'm quite sure this
makes me almost the ideal audience for this book.
My initial perception of the book is that it is well-written, and
immediately engages the reader with practical and clearly explained
examples. Code is provided that will give the author an immediate 'win'
in adding certain common functionality to their site.
Chapter one starts with a quick overview of object-oriented programming,
giving the arguments for and against, and ultimately coming down on the
side that every additional tool that might make the programmer's job
easier is well worth learning and that the author is free to decide for
themselves what to use.
Chapter two gives a quick introduction to the concepts of
object-oriented programming, touching ever so briefly on reuse and forms
of inheritance. Being quite comfortable with the concepts of OOP I found
this chapter (all four pages of it) a nice refresher. Anyone new to OOP
might be left feeling as if they are being dropped in the deep end,
wanting more information to fully grasp OOP concepts before continuing.
However, later chapters do not assume too much from the reader, and when
OOP concepts are raised, they are done so with further explanations. An
insecure reader should press on, confident that they are not expected to
grasp the intricacies of OOP from this chapter alone.
Chapter three takes a look at the object-oriented features of PHP5 as
compared with PHP4. Anyone confident with PHP4 should find this chapter
useful. In contrast with chapter two, old-hands at PHP should fly over
this chapter comfortably while the confident object-oriented programmer
new to PHP may find the comparisons between the versions of PHP
With chapters four to ten, the overviews and principles are behind us,
and we start meeting solid code examples of how to get things done.
Example code is immediately useful, and from chapter to chapter the code
builds up in functionality. In addition to leading the reader slowly
through the increasingly effective example code, I felt the benefits of
the object-oriented approach are subtly demonstrated. As a fan of OOP I
felt as if this was exactly what someone new to OOP needs to see: the
increasing complexity of the code pushed into classes, while remaining
easy to call upon and use.
Chapter eleven introduces more advanced OOP concepts and techniques
which from my own perspective are easily understood. Someone new to OOP
might find the easy and gentle approach to the theory a little too
hands-off which might have a negative impact upon thorough
Chapters twelve to sixteen give a cursory introduction to things like
simpleXML, RSS, the Google API, AJAX, SOAP, magic methods, reflection,
extending SQLite, and PHP Data Objects. Just enough detail is given to
whet the appetite, but anyone interested in these areas would be well
advised to get a more advanced PHP book.
For those less concerned with understanding OOP in the abstract and
just interested in getting on with using OO-PHP and getting stuff done,
I think this book hits the right tone. This book certainly lives up to
the subtitle of: Concepts, techniques, and code. If you are part of the
target audience for this book, I think you will find it of great value,
and I can fully recommend it.
This is the first book I've ever read on PHP, so I can't compare it to
other books. However, while the book is easy to read, if I was new to
PHP and didn't have a grasp on OOP, I'm not sure this book would have
worked well for me. If the most damning thing I can say about the book
is that it doesn't work well for those it isn't targetted to, then it is
clear that this book gets a double thumbs-up from me.
While I was working on this review, I noticed another helpful review this book on OSNews,
want to see what someone else thought. It is well worth a look.