Review: PHP Programming with PEAR (Packt)

Packt recently sent me a copy of the book “PHP Programming with PEAR” to review. I rather wish they hadn’t, because it faces me with the dilemma of having to post a really negative review of a book, and potentially hurt the sales. On the other hand, it’s my obligation to tell you, the PHP programmer, that this book should be avoided at all costs.

Unfortunately, it probably also means that Packt will stop sending me free books to review. But I gotta do what I gotta do.

1) The book is about PEAR. However, nowhere does it tell me what PEAR is, other than a short paragraph in the preface, which nobody will read. Much more importantly, there’s nothing whatever in the book that tells me how to locate, download, and INSTALL a Pear module. So when it jumps right into a chapter on one of the more obscure of the Pear modules, almost without telling me what it is, what it’s for, or why I would consider using it in preference to PDO, I’m completely at sea. Where do I obtain this module? How would I install it once I had obtained it?

If you type ‘pear help’ at the command line, you get more information than is contained in this entire book about the pear command line utility. It isn’t once mentioned, as far as I could tell.

Chapter 1 is missing, entirely. Chapter 1 should be “What is PEAR?” Chapter 2 should be “Using the pear command line utility” Those two chapters would be what most buyers of your book would actually be looking for. Without those chapters, the current book is an exercise in frustration. Yes, this stuff looks cool, but where the heck do I find Pear::DateTime? It’s not installed on my server.

I see that Packt has a separate book called The PEAR Installer. Presumably that book answers these questions. The problem is that if I go to the store to buy a book about PEAR, I’m going to buy one or the other, not both. A chapter on the pear command line utility is essential for this book.

2) The code examples are almost always there without showing the output. In the few cases where the output is shown, it’s almost always difficult to ascertain which code example led to it. The worst example of this I found was in the calendar chapter, where an example is shown of a HTML table rendering of a month calendar, complete with a description of what color the various dates were. I was unable to find the code that generated this output. Since this is one of the things that I’d actually like to do today at work, I find that very frustrating. This was the rule, rather than the exception.

I have found, in years of writing and presenting at conferences, that examples carry 100 times more weight than pages of exposition. Showing a line of code, and the output that it produces, communicates more than discussing the function and its uses. This book shows a lot of functions, and very seldom really shows what they do.

3) The book assumes that you already know what OO syntax looks like, and almost never shows it to you. One reason that PEAR developed was that with the transition of PHP from 4 to 5, nobody knew about OO syntax, or how to build objects, and PEAR was a way to provide these object models to people to get them started. Showing them how to use PHP objects is critical to success. CPAN did this really well with Perl, and PEAR has done it less well with PHP. I’m not real sure why so few PHP programmers know about or use the stuff on PEAR, while Perl programmers universally use CPAN. This book, and others like it, are an opportunity to tell people about the great stuff on PEAR. Reusable code is a really big deal, and PEAR is, and should be, the place for that code to live. Unfortunately, this book doesn’t communicate that.

4) The selection of modules to cover was, to be charitable, random. There are (as of today) 534 packages on PEAR. (See http://pear.php.net/packages.php for details.) This book chooses, at random, 5 of them, and covers them in a rather haphazard manner. Now, I don’t claim that I know which modules should have been covered. But I can assure you that if I wrote this book, I would do some research into which ones were most popular, and which ones seemed neglected, but amazingly useful, and which ones nobody uses because they’re not useful.

5) This book completely overlooks what I consider to be almost the most important topic, after “what is PEAR” and “How do I install a module”. Specifically, “How do I write a PEAR module?” And the related question of, once I’ve written a really useful module, and I’d like to share it with the world, how do I go about contributing this to PEAR. CPAN has done a wonderful job of answering that question, and, as a consequence, I have something like a dozen modules on CPAN that are used by thousands of people. I don’t know how to contribute my code to PEAR, and have some that I’d like to contribute. I was hoping that this book would answer this question.

6) I’m a huge calendar geek. I was looking forward to the calendaring chapter, because I figured it would give me the same charge that the calendaring stuff in Perl does. Calendars are a lot of fun, and PHP has put a LOT of effort into datetime code in the last few versions. A lot of brilliant people have devoted hundreds and hundreds of hours to making the datetime implementation respectable.

The calendar chapter was a huge disappointment. It focused largely around a code example to generate a HTML table rendering of a calendar, although early in the chapter it hinted at the fact that you can do this with a single function call in the Tabular class. But it didn’t tell me what that function is, which just pissed me off for the rest of the chapter. And since I was at the pool when I was reading it, I couldn’t look anything up, or try any code examples.

So ….

all of that to say, I think that this book is significantly below the standard that I have come to expect from Packt books. I was very, very disappointed. I think that this book is really important – that is, a book in this space – and it’s frustrating that it wasn’t done well. It felt like someone’s first writing experience. We’ve all been there. My first book was an embarrassment, and I’m glad that it’s out of print. I hope that these gentlemen progress in their career enough to feel the same way about this one. I felt a number of times that I could have written the book better.

50% of writing a book like this is research. Another 25% is experimentation – writing code with the stuff learned from the research, getting a feel of how it actually works, and coming up with interesting examples. A poorly written book on a topic like this is just a rehash of the documentation. However, I don’t think that this even goes that far.

Straight to the source

I used to marvel at the fact that when I asked a question on IRC, or a mailing list, I would, as often as not, get a response from the very person who wrote the software I was asking about.

That was a long time ago. The internet has gotten bigger, and, with that, the probability or ease of going straight to the source has diminished. Nowadays, not only are you likely to not be talking to the author, you’re also less likely to be talking to someone who knows anything at all. Often they tell you something that simply isn’t true, or is half-true or misleading. Usually this isn’t out of maliciousness, but just out of ignorance, and the imperfect transfer of knowledge in the form of tutorials written by people who themselves weren’t quite sure.

The same is true in the business world, of course. The larger a company gets, the less informed the tech support tends to be, until you get to a point where the front-line customer support are nothing more than note-takers for the folks who actually know something.

Unfortunately, being the hot-head that I am, this leads me to say unkind things about the entire company, because, to those of us who may our monthly dues and use your product, your customer support is the entire company.

You can have the most marvelous product in the world, but if your customer support reps are ignorant, belligerent, or even have bad grammar, we, your customers, make assumptions about your entire company based on that interaction.

I was very pleased to get a direct response from Jim Wong about my above-referenced posting. It’s fascinating to me that the very best way to get someone’s attention on today’s internet is to make a comment on MY site, or on Twitter, rather than on the site of the person I want to contact. I suppose this shouldn’t be unexpected — it’s much the same in the real world. An letter to the editor of the local newspaper gets more attention than a letter directly to the mayor’s office, when I’m disgruntled about city policy.

Fortunately, my opinion of a company can often be turned around by being contacted by the folks who *do* know something. It means a lot to me that the head of a company is aware of what’s being said about his company, and takes a proactive role in correcting misconceptions. It also helps when his answers make sense, and actually show an understanding of my questions.

Now, while I’m not sure that I feel the answer was the one that I want, I at least think that Jim understood the question, and had thought through the implications of his answer.

Sugarsync Customer Support

It’s amazing how much difference good customer support can make.

SugarSync has a good product. It could be better, but for the most part it’s really good. However, their customer support is rapidly turning me from being a fan to wondering if I made a mistake.

Sugarsync is basically a fancy front-end to rsync. This is what I expected, and wanted. They also have a web front end where you can browse your files. As expected, this interface is accessible only via SSL. So far so good.

However, it also has a feature where it detects that a directory contains images, and creates an album/gallery view of that directory. This content, for some reason, is accessible over http, and can’t be accessed over https.

Now, if you’ve ever been somewhere with an open wireless network (conference, airport, coffee shop) and experimented with a program like Etherpeg, you’ll immediately see the problem with this. Not that my photos are confidential, or blackmail material, or whatever, but they’re my photos. If I wanted them to be public, I’d put them on Flickr. Until I choose to put then on Flickr, I want them treated as though they were confidential.

So I opened a ticket, asking for SSL on the gallery view. I received a response that said that SSL isn’t necessary, because they use cookies for authentication, and so nobody can log in to get my content.

Um … huh?

I wrote back saying that I was well aware of what SSL is, and what cookie auth is. I didn’t wave my HTTPD credentials – perhaps I should have. But you can’t pretend that cookies substitute for SSL with a straight face.

I received a response back saying that my ticket had been closed, because it had been dealt with in a satisfactory manner. I wrote back once more asking that they consider what I had asked for a little more carefully, and that they take a look at Etherpeg.

No response.

Later on, I was trying to manage files on the server. They have this gallery preview, but in that view, you can’t rename or delete files. They have the file browser view, but there you can’t see which photo you’re looking at. I asked if they could either add the filename to the gallery view, so that I could at least know which files to delete, or add a delete option to the gallery view.

I got a rapid response saying “Our product doesn’t have that feature.” And the ticket was closed.

Seriously? That’s the response I get?

So, I guess that the feature set that’s there is the one that I get, and their feature request form on their website isn’t actually treated seriously.

Or, maybe they just use it as the inbox, and they have another issue tracking system behind the curtain somewhere.

One can hope.

Ode to the GPS

Ode to the GPS
July 11, 2009

It’s difficult to think of inventions
that don’t in the long run,
make life worse, rather than better.

Sure, I suppose they’re used
to call down missile strikes,
so it’s not all roses and ponies.

Since the invention of the road,
men have been plagued by the terror
of getting lost.
Being lost, itself, isn’t so bad,
at least not from the vantage point
of being found again, laughing
about it over a pint of ale.
But while you’re there,
it’s pretty awful.

Yes, because you have to admit
that you don’t know.

Now, with this marvel,
this chunk of metal and plastic,
smaller than a breadbox,
talking to the stars,
I am freed —
liberated to get lost
without having to admit to it.
Freed to wander far from
the so-called-free-way,
which binds you to the path
most travelled.
Free to explore those roads
where one might imagine
real people living,
sitting on their porches,
sipping lemonade while the stars
come out and the crickets
scream into the night.

Drive past corn and soy,
soy and corn,
more corn, more soy,
interspersed by fields where
someone’s parents are planted
deep in the earth,
driving slowly enough
to read their names.

(Saint) Paris, Ohio

We went to Paris on our honeymoon, and determined that we’d go back to Paris every year for our anniversary. Of course, Paris France is a little hard to get to, both in terms of budget and schedule, so we’re going to go to other Parises until we can afford it. Turns out there’s somewhere around 37 Parises in the USA.

Last year we went to Paris, KY, and this year we had three Parises to choose from in Ohio. There’s Paris, New Paris, and Saint Paris. We couldn’t get a room at the B&B we wanted to stay at in New Paris, so we went to Saint Paris, staying at the Simon Kenton Inn in nearby Springfield.

Saint Paris isn’t a big town. As we drove through it, we were trying to determine whether we had in fact gone through downtown when we saw the “Leaving Saint Paris Township” sign. But, hey, we went to Paris. 🙂

Next year, Paris Tennessee.

SugarSync

For some reason, I was sure that S3 was an end-user file storage service. It’s not. It’s for web developers who need somewhere to store a large amount of data for back-ending their website. So, say, someone like Flickr might use S3 for the actual photo storage. (I don’t know if they do. Just an example.)

So, thanks to a suggestion from CGNaughton, I am now using SugarSync, which was remarkably easy to set up, and seems to work pretty well, although it took three days for the initial sync of my data.

I’m also planning to put the 24G of photos, which I have on an aging Linux box at home, up on SugarSync, which will likely take all weekend. Once that’s done, I will finally shut down Buglet, which I have operated out of my house for more than ten years now, and I will then have a total of *zero* servers in my home, for the first time in probably fifteen years.

Having my servers managed, and, in particular, backed up, by someone else, has an awful lot of appeal. It’s no longer fun to keep servers updated, patched, backed up, free of dust, and restarted every time there’s a power dip.

On a related note, if you’re in the Lexington area, and you need a half-dozen aging server machines, come and get them. We’re only too delighted to offload them. Most of them were great machines in their time, but I no longer have need of them. Monitors too.

mod_pony

mod_pony has been a pretty long-standing joke on #httpd on Freenode, and has also made a number of appearances in conference presentations of mine when I wanted to refer to an imaginary module for some reason.

I’m pleased to announce that there is now actually a mod_pony. It really doesn’t do anything useful. But it does build, and output a pony. And, really, what more could one possibly want?

Patches welcome.

(See mod_pony in action HERE.)

EDIT: mod_pony is now moved to Github. The “in action” link is not working – I’ll try to fix it when I get a moment.

Hypocrisy

What you see here is the cover of the new People magazine.

Other than the quote, which is sure to be a favorite of her daughter once she can read, this looks like a promotion for teen pregnancy. She’s beaming, obviously very pleased with herself. Girls everywhere are going to be saying, wow, where can I get me one of those?

And, according to MSN, she’s going to make more than a quarter mil on the photos. What’s not to love. Better run out and get preggers as fast as you can.

It would be lying to say I’m shocked by the startlingly bad judgement of this magazine. I lost my last shred of respect for the media years ago. But surely, somewhere along the chain of command, someone has a daughter? Even one of you? Show at least a scrap of common sense, would you?

The Margin Is Too Narrow