© Copyright 1999 Mark-Jason Dominus

Object Oriented Perl
Order Object Oriented Perl
online from Barnes and Noble

Object-Oriented Perl

(Damian Conway)

There are a few precious books in my library that seem almost magical. A beginner can pick one up and become an expert, just by reading the book, because of the tremendous breadth and depth of the subject matter and because of the perfectly clear exposition. An expert can also pick up the book and learn something new for the same reasons. These are books that you can buy when you're just starting out in a field, and they even though you pull them off the shelf every week for years and years they never seem to run dry. There aren't many of these books; Tanenbaum's Computer Networks is one. I think Damian Conway's Object Oriented Perl is another.

It may sound almost trivial, but I think the best thing about this book is the division into sections. I read a lot of prose in which the sentence breaks are in arbitrary places: The author wrote for a while, then ran out of steam and pressed the period key. Then he wrote some more and when he got tired he pressed the period key again. Eventually, he went to get a fresh cup of coffee and when he got back he started a new paragraph.

When so few authors have a grasp on something as simple as a sentence, it's really rare to find a book that is intelligently divided up into sections or chapters, and one forgets how valuable such an organization can be.

Each chapter in Object Oriented Perl is about a big idea, like persistence, overloading, encapuslation, or genericity. (Don't worry if you don't know what these things are; Chapter 1 is about jargon.) It's usually hard to understand ideas as big as these. But the organization of this book makes it easy: You can understand a chapter because the big ideas of the chapters are divided into smaller ideas so cleanly and because the smaller ideas are in such a straightforward order. It is very difficult to write a book like this. The clean division of the chapters means that you can pick up the book, open to a section at random, and learn something useful from it even without the context. The order and organization make it easy to understand each section in context so that you can see what problem is being solved and how the ideas presented in each section solves the problem.

This organization is repeated at the next step down also: The smaller ideas are divided into little ideas, and each subsection, while self-contained, fits clearly and neatly into the larger pattern. You can pick up this book for five minutes and come away knowing something useful; you can also study it for ten hours and learn something even more useful.

For beginners, the book starts with straightforward, simple things, including an explanation of OO terminology and a fifty-page summary of Perl syntax and semantics, then follows with a simple example of a class using blessed hashes. Chapter 4 is about blessed arrays and scalars, and chapter 5 is about making objects based on other kinds of data, including blessed filehandles and regexes. The following chapters are about inheritance, polymorphism, and how to construct classes automatically. The transition from simple things to progressively more complex ones is smooth and even.

For experts, I guarantee that Conway will find something to say that you hadn't seen before. For me it was the section on implementing strong member data privacy with flyweight scalar objects. (I don't want to spoil the surprise, so I won't say anything else about it.) Conway isn't afraid to let Perl be Perl, so in the course of discussing object-oriented programming, it also touches on all sorts of Perl programming techniques. For example, Conway isn't afraid to use C to construct code on demand, or to use a glob assignment to install a new method into a package. These techniques have wide applicability.

The book should also work well for programmers who have experience with object-oriented programming in some language other than Perl. Besides the fifty-page summary of Perl OOP features up front, at the end there is a nine-page summary of the entire book, with code examples, and an appendix which compares Perl in detail with Smalltalk, Java, Eiffel, and C++.

There are some small problems. The quality of typesetting, copy editing, and layout is not good enough---certainly not as good as this book deserves. I think that the cover is ugly, and I worry about the durability of the binding.

But I almost forgot to mention that the book is also funny. When was the last time you read a funny programming book? I'd tell you when it was for me but I can't actually remember any funny programming books.

Go buy this book right away. We should all give Damian lots and lots of money to encourage him to write more books.

Manning Publications Web Site

Object Oriented Perl
Order Object Oriented Perl
online from Barnes and Noble

Return to: Universe of Discourse main page | What's new page | Perl Paraphernalia | Reviews