On Tuesday 08 December 2009 12:36:01 am Marnen Laibow-Koser wrote:
[Warning: no Ruby content whatsoever.]
Generally so. But Perl is awful for writing Web applications.
Because I’d definitely disagree here. I think Perl is generally useful
I think Ruby is also generally useful. I just think Ruby is prettier and
easier to work with than Perl.
Second, just look at the number of global functions in PHP. I’m not
about the ones you’ll write yourself, but the ones that are built into
I’m not sure I understand your point. PHP was obviously designed
primarily as a procedural language, so it’s sort of appropriate for
there to be lots of global functions.
Even supposing it was… Erlang is designed as a pseudo-functional
and it still has the concept of namespaces. I realize PHP has
I wasn’t seeing them actually used, and there’s still a bunch of cruft
seems to be from before PHP realized namespaces were a good idea.
Everything I ever did in PHP used the Pear DB or
MDB2 library, both of which support prepared statements. I learned that
trick back in my ColdFusion days, and wouldn’t have given it up in PHP.
I’ll grant this point – I guess it had to be solved at some point.
So the language itself doesn’t lend itself to particularly high quality
WTF? Just because the standard DB library has problems, you make this
sweeping conclusion? Isn’t that kind of like concluding that Ruby sucks
because TMail and REXML are awkward?
I actually kind of like TMail, though REXML has been improved on.
No, the point is that in a default PHP setup, there’s tons of this
Again, from the global function count alone… It wouldn’t be so bad if
was some kind of convention to them, but there isn’t.
There was a much better thought out rant against PHP, by a Perl guy, who
this point very well:
To summarize it:
- Arguments and return values are extremely inconsistent. That’s with
standard PHP libraries.
- PHP has separate functions for case insensitive operations – and
inconsistently named. (Contrast to Ruby, where I can add /i to a regex,
can just downcase the string.)
- Continuing on that theme, functions are inconsistently named.
- Scoping. Seriously.
- Too many functions.
Wow, I’d forgotten most of the reasons I hate PHP!
For what it’s worth, though, the “modularity” section may not apply –
may have solved that.
He updates it for php5 here:
This didn’t really fix anything in the above list, but added classes, so
criticizes the PHP object model. But then, you agreed that the object
wasn’t that good, so I won’t care.
It did, however, add exceptions. But since they were added after the
they’re probably about as useful as they are in Perl. In Ruby, nothing
ActiveRecord, apparently) ever just returns an error, it raises an
if something’s wrong. This means no silent errors. Noisy errors are a
In Perl, while there is a strange way to deal with exceptions, nothing
them. Perl objects tend to return a false value when something goes
have to use it that way. It’s possible – and recommended – to write
entire PHP files without any HTML in them.
I realize this. My point is that many of the design decisions of a
language – very simple syntax, just sprinkle some global functions, the
assumption that no one will ever write anything huge in this – all of
leaves a lot to be desired when you want to use it for something else.
Perl started out as a report language, but it’s at least extracted the
“format” concept into a separate module.
To make it even more perverse, even PHP people tend to use other
languages (like Liquid) instead of PHP, to do their templating in PHP.
profoundly ironic to me. I suppose next thing you know, Liquid will
Turing-complete, people will be writing Liquid apps, and we’ll need a
safe/better template language for Liquid?
People who learn PHP usually start as designers, who learn a
of HTML and CSS, and need a tiny bit of server-side logic in their HTML
so they learn a bit of PHP or paste a bit of code in…
or two at a time, so they never really learn to use the language. Both
rather than considering them extensions of HTML.
Oh, I agree. And just because some people learn Rails because it’s easy,
never bother to learn Ruby the language, isn’t really a point against
Rails. But then…
object system including prototypal inheritance, and the unification of
and hashes (combined with that prototypal inheritance) means you can
your own inheritance system, or use classical inheritance…
It could almost be called multi-paradigm.
like Ruby syntax better, and Ruby actually has bindings to native stuff
language. A lisp in disguise.
Scratch the surface of PHP, and it’s… more PHP. The next step in the
evolution of a PHP coder is probably to learn another language.
For that matter, I’d guess the better developers would see that there
better languages, and would migrate away from PHP, in the long run.
That’s what happened to me – but it wasn’t PHP’s language features that
did it. It was the fact that TDD was more feasible in Rails than in any
PHP framework I could find.
Now look at BDD, and at rspec. Or maybe rake.
Can you imagine building anything like that in PHP?
Maybe things have changed
last used it.
Maybe you never really learned what you could do with it – as witness
your ignorance of DB library options.
Probably – I was mostly working with Wordpress and Drupal.
Good for you. Hey, I’ve seen Drupal. I was amazed – there are things I
strongly dislike about it, but here was object-orientation, modules,
all kinds of good stuff. Sure, it was completely hacked together, and
all supported by the standard, but it was decent.
That must have been Drupal 6. Drupal 5 was horrible – basically
reinventing OO in a fragile procedural way.
It actually might have been Drupal 5.
Drupal 6 was a complete rewrite, and I believe it does use PHP OO.
Yeah, so it would’ve been Drupal 5 that I was using.
VB is brain-dead. PHP is not, at least if you don’t try to use its OO
features to any great extent.
Or its reflection. Or the features it doesn’t have…
I’m sorry, but it’s obvious that you don’t know what you’re talking
about with respect to PHP.
I have a feeling I should be glad of that.
But just a quick test to see if it’s worth learning more again:
Does PHP have closures yet? Or even anonymous functions?
I’ll give you this: Languages evolve. It’s possible I don’t know what
talking about. It’s possible the tnx.nl guy no longer knows what he’s
about. It’s possible that PHP will one day evolve into a beautiful
or at least a decent one, leaving me only able to grumble about syntax
snipe at the <? at the top of each file.
On the other hand, from what I do know of PHP, I can still name four
better languages off the top of my head. Why would we want to evolve PHP
a good language when we have so many good languages already?