Le Tue, 12 Jun 2007 11:19:32 +0000, peter a écrit :
At one time, I did a bit of perl but now I see php alot. I was wondering
what you guys thinks of the pros/cons of perl and php.
php is a specialized tool. It's very good for the quick and dirty job, and
good for the kind of stuff you'll often find on thedailywtf.com or
codinghorror.com .
It has a lot of very nasty defaults that are mostly unvisible to the
beginner and the people without a "real" programming background, that will
bite you sooner or later :
- no real namespaces
- cluttered main function namespace
- lots of redundant functions with slightly different syntax and behaviour
- helps "bad programming" by mixing up html markup and php logic
- many security caveats; nothing similar to the "-T" flag in perl, or "use
strict", or "use warnings"
- syntax and defaults vary quite alot from version to version ; I had to
rewrite big parts of my php code to go from php 3 to 4, then 4.0 to 4.2,
then 4.2 to 5.0... Perl4 code written in 1992 works out of the box 99% of
the time with the current perl binary
- stupid typing : making things simpler for beginners make them unsortable
for everyone, see the ridiculous "==" and "===" comparison operators
- two entirely different object models in the current implementations,
php 4 and 5.
php pros :
- it's very easy to install and setup (it's made for windows users and
programming teenagers, not system administrators and real programmers)
- the php 5 object system is at last pretty good (but for perl, Moose
beats anything else on earth, and the default object system is the most
flexible for the knowledgeable)
- if you use php, you may have endless discussion on usenet/forums/IRC/AIM
with gazillions of beginners and bad programmers, about the bad ways to
get your bad code mostly working
--
Le commissaire : Comment vous appelez-vous?
Garance : Moi je ne m'appelle jamais, je suis toujours là. J'ai pas
besoin de m'appeler. Mais les autres m'appellent Garance, si ça peut
vous intéresser.
Prévert,"les enfants du Paradis".