Explaining why not PHP

scrottie on 2009-07-02T21:01:38

Some times people come to me wanting to learn to program. Often we have this same discussion -- they want to learn PHP "because it's easy", and I want them to learn anything but. Seriously -- Java, JavaScript, Python, Ruby, C#, Haskell, Forth, Objective-C, Pike, Scheme... there are a million good languages to learn and PHP is not one. Oh, but it's easy!

There are two ways of thinking here. Either the world is a large, interesting place full of things you can learn. The stories have plots and twists and surprises that astonish and humble you. You have to grow to take it all in. Smart people play leading roles in the drama.

Or else everything is exactly as you expect it. There are no surprises. You can't get lost. No one is any smarter than you and even though you're a novice, no one really has any experience with what happens when things get complex because they just never do.

The first is the stuff of Hemmingway.

The second is preschool and old lady tour buses. It's for the proud who are afraid of their own weaknesses and risking not only defeat but fear any struggle. It's a cynical attitude that thinks little of the world and other humans. It's the wife who tells you what she wants for every birthday and anniversary. It's lost opportunity, low expectations, and narrow horizons.

Yes, the world is big and scary. Yes, it's full of surprises. Yes, smart people make you feel dumb, and there's a lot there for you to learn, at some pace. Don't pretend like there isn't. It all makes for a great story... a wonderful adventure. Don't fear it.

Logo, the old programming language for "turtle graphics", where you steer and move a line drawing cursor, is an old Lisp dialect but without all of the parenthesis. BASIC on the other hand is pointlessly limited for anything but the underpowered shared computer it was written for at Dartmouth. Would you continue to write BASIC when Logo is just as easy? Do you want your confined space to be that much smaller than necessary? Likewise, learning Ruby is no harder than learning PHP but far, far more rewarding. I'm not dissing Perl here; Perl does have a longer learning curve than most languages.

PHP does not make programming simpler. It just pretends that programming is simpler than it is, just as a tour bus doesn't make Italy more easy to experience, it just lets you pretend that you're experiencing Italy.

-scott


PHP does one thing very very well...

Alias on 2009-07-03T09:19:53

I was vexed for a long time about PHP, how the hell could anything so patently dangerous and backwards (code inside template? huh?) be so popular.

What PHP did right, when everyone else did it wrong, was to make the "first hour" of your PHP experience utterly effortless.

When I first tried to do a website, PHP didn't really exist, and so I ended up learning CGI. And it took me almost an entire day to get it to work, with a weird little webserver running on Windows, and a little ActivePerl install, and a lot of jiggery pokery.

If PHP had existed at the time, and been easily installable, I almost certainly would have given up on Perl and ended up with PHP.

What's so astonishing is that their one big party trick (letting you make a Hello World page that you can upload to shared hosting, editing it in DreamWeaver, and having the page be reasonably fast) has taken them so amazingly far, when the language has almost no other advantages.

Re:PHP does one thing very very well…

Aristotle on 2009-07-03T13:31:05

It’s amazing only if you are also amazed that the most successful programming environment in the world is Excel.

Re:PHP does one thing very very well…

Alias on 2009-07-06T16:25:32

Yes, I still find that amazing as well.

Re:PHP does one thing very very well…

Aristotle on 2009-07-06T16:37:59

I don’t. There are a lot more people out there who don’t think of themselves as programmers but who have needs that can be served by a little bit of a programming. (And yes, a little bit of programming is very much like a little bit of knowledge…) Lowering the barrier for these people is a genuinely good thing, even though the means by which this is achieved may be less than suboptimal from the perspective of “real programmers”, and thence we enter classic worse is better territory. There is nothing magic or surprising about it.