PHP v. Perl

Here is a presentation on why Yahoo! chose to go with PHP as a the server-side scripting language. I found it interesting that their own benchmarks apparently show mod_perl is better than PHP every time. And their reasoning makes sense. Except:

Why not Perl?

  • Pros
  • FreeBSD support and performance is great
  • huge CPAN library
  • we already use it for offline processing
  • Cons
    • There’s More Than One Way To Do It (TMTOWTDI)
    • poor sandboxing, easy to screw up server
    • wasn’t designed as web scripting language

    They got the “Pros” right. But they mis-stepped on two of the “Cons”.

    • Java wasn’t “designed as a web scripting language”, but that wasn’t one of the reasons they didn’t choose it.
    • They say TMTOWTDI was a “Con”, but that is essentially “the way other people write code”. If this is really an issue, then you enforce a particular coding style. And, from looking at PHP code, I can tell you that the problem is just as bad there.

    Worse, by using PHP instead of Java or Perl, they’ve guaranteed two sets of code: PHP for online and Perl for offline. The presentation indicates that duplicate processing is done off-line.

    I would’ve also recommended they look at AxKit since it allows much better separation of data and logic than PHP will let you have. PHP allows too much spaghetti and it is easy to get confused about where the data is and the code is. Or when code is really data.

    Oh, I should add that PHP is no where close to being lisp, but Perl is pretty far along the curve.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.