a work on process

Viewing posts tagged: PHP5

book sleeve for Object-Oriented Programming with PHP5With PHP 5.3 looking very close to release, bringing with it significant changes such as namespaces, this is an awkward time to release a PHP book of any generality. Within a few months it will be clearer how well the new features are taking hold and there is almost certainly going to be a clamour for books that show how new features affect development practices and how to make use of them. Even without that, it is hard to recommend this book as it fails to live up to its promise and provides a poor introduction to Object-Oriented programming.

The book’s first problem is the poor quality of the English contained. The author does not appear to be a native English speaker and the publisher has apparently done little to clean up the language. For the most part that simply makes for some curious rhythm and phrasing but there are a number of places where it contributes to inaccuracies, such as constant confusion between objects and classes. Finding such inaccuracies alongside mistakes such as confusing polymorphism and inheritance I’m left wondering how well the authors really know their subject. Packt would do well to employ another reviewer to clean up the syntax and definitions before any reprints.

The structure of the book is curious. Rather than approaching topics through the use of an example project or projects, the author gives disconnected samples, often offering little beyond that which can be found in the online PHP documentation and generally failing to explain how techniques would be useful. While he insists that PHP5’s Reflection API is an important tool, there is little to back up that assertion. There’s a large code sample and a list of the methods and attributes of a reflection object, but no real substance. The database section covers some key examples, such as PDO, ADODB and MDB2, and touches on the ActiveRecord pattern, but uses four pages to list the RDBMSs that ADODB supports and then only spends a page and a half on ActiveRecord, failing to explain either its concepts or advantages in any detail.

The high point of the book is the half chapter on unit testing. A few well chosen examples provide a demonstration of how code can be tested and how that allows for refactoring without fear of regressions. The reasons for unit testing are clear as is basic usage of PHPUnit. I’d have liked to see further examples rather than several pages listing all the default assertions PHPUnit provides, and I disagree with the claim that there should never be more than one assertion per test (individual tests should focus on a single concern, but can use multiple assertions to do so) but by that point in the book it was good just to see a section that made its point clearly.

Fundamentally, I came away from this book feeling it had failed to communicate clearly the core principles or reasons for object oriented programming. By trying to cram in too much reference material, not offering clear contexts for each technique, and not lingering on ideas like encapsulation the book fails to instill OO techniques.

Disclaimer: I was sent a copy of this book for review by the publisher. You can find it at packt, amazon US, amazon UK and all sorts of other places.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

 

Services_Technorati version 2

23 February 2007 (10:51 am)

By James Stewart
Filed under: Announcements
Tagged: , , , , , ,

In an effort to tidy up various older projects that were never quite completed, I’ve turned my attention to my first PEAR module Services_Technorati. It’s a very simple wrapper around the Technorati API, but the PHP4 version never reached a stable release as it depended on some other packages which were also never stabilised.

So it seemed time to make the simple step of converting the code to be PHP5-only and use simplexml for their XML parsing. That removes the dependencies which were slowing me down, and should result in improved speed along the way as the XML parsing is now handled in C rather than PHP. I just released 2.0.0alpha1, but the code should be pretty stable and I’m hoping to run through the steps and get a stable release out very soon.

Update (27th Feb): I’ve just pulled this release and re-released it as 0.7.0. Apparently because the package never release 1.0 in its original version, I should just continue with the previous version numbers despite the change to PHP5.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

 

PHP5 Objects, Patterns, and Practice

13 July 2005 (8:22 am)

By James Stewart
Filed under: Book Reviews, Software Design
Tagged: , ,

Demian Turner’s review reminded me that I’ve been meaning to write a recommendation for Matt Zandstra’s “PHP 5 Objects, Patterns, and Practice” for a few weeks now.

While many of the ‘design patterns’ books I’ve read have been able to impart their core concepts, none has really worked for me in the way Matt’s did. In part that’s because it is the first one I’ve read that’s exclusively PHP-focussed. While I enjoy python more than PHP, PHP tends to be the language I default to due to its familiarity. Matt draws from the example of other languages, but clearly identifies what marks PHP out as a language and applies his techniques appropriately.

Most similar texts to “Objects, Patterns, and Practice” have a tendency to be overly theoretical. In most areas I enjoy getting to grips with theory, so I understand well the tendency to disappear into the logical details while missing the practical, but with something I use on a practical level with such regularity I don’t want to be left with too many “ok, but how do I interface that technique with my web application” questions. I often asked that question as I read this book, but usually found that the next page addressed just that question.

For those who are already regular users of PHP5’s OO facilities, the first few chapters can be skipped over quickly and this book will not come as a revelation, but it is a solid overview and I’ve found myself writing cleaner code since reading it. For those newer to OO (but already comfortable with PHP) this may well be a good introduction to that other paradigm.

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]