Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Agreed - I don't use Perl any more, having grown disillusioned with its messiness a long time ago, but it's certainly much more of a serious language than PHP.


I mean really what made you say such things about PHP? not being a serious language like Perl? This is not an attack mind you, but I'm curious to know what Yahoo, Flickr, Wikipedia, and perhaps to some extent Facebook seemed to have missed when they decided to use PHP for server side stuff. What's with all the PHP hate here in YC anyways?


The reason I can't stand it is because I've had to deal with so much of it that sucks. Also, it just doesn't feel like what I want in a language.

The real double edged sword for PHP is that it made it very easy to do web programming. The good side of that is that it let a lot of people write web stuff who otherwise might not have been able to. The bad side of that is that a lot of those people write really bad code that is no fun to clean up.


How exactly did PHP ever make it "very easy" to do web programming? Was that when register_globals was on? Was it that there was plenty of example code to cut and paste?

I hear this "easy" term applied to PHP by many people, but when I look at the language itself, I don't see it. PHP is easy for me because I did C for 12 years, but I look at the comp.lang.php newsgroup and see newbies tripping over all sorts of things.


There is a well-worn path for beginners in PHP, with baby steps and encouragement all along the way. You can gradually mix PHP into your HTML site, line by line and file by file, and make your site better with each step. (Look, I've got the date in my Web page and it actually updates!)

There's a tradition of building simple CRUD apps in PHP - a handful of database tables, and a PHP file for each URL that acts as a thin glue layer between raw SQL and HTML presentation. These are some of the easiest Web apps to understand - which is not to say that they are actually easy - and they are a good place to start.

By contrast, learning something like Rails requires a big up-front investment. There are objects. There's a database and an ORM. There's an MVC framework. There's an abstract mapping between URLs and the methods of your controller objects. All of this makes great sense once you can see the big picture, but to a brand-new programmer PHP must look a lot less intimidating.


"There is a well-worn path for beginners in PHP, with baby steps and encouragement all along the way."

Down that path lies madness. I've seen the newbie-focused tutorials for PHP, and it explains a lot of the garbage that passes for software in the PHP world. It is entirely possible to write good software in PHP (I'm reasonably impressed by the Dokuwiki and Flyspray code, for example), but you have to learn the language at least twice to get to that point. You learn it as a newbie, and learn horrible practices from the vast collection of misguided "help" in the Internet. You produce lots of code with those horrible practices...like no DB abstraction, inappropriate or no use of objects and encapsulation, and "gradually mix PHP into your HTML" design. And then you realize you've built an unmaintainable mess and start rewriting it with all of the better practices that have since been bolted on to PHP.

Of course, despite all of that I still recommend PHP for a large classes of application because it is pervasive, hard to make pathologically slow (whereas Ruby and Python can be made pathologically slow even by really good developers--see Plone for an example), and has a pretty large selection of libraries (some are so bad as to be counter-productive, but many are good). But as a newbie language it's rather toxic.


Compare to mod_perl circa 1997/8/9, any of the Java stuff... Python didn't have anything that great. ASP was probably fairly easy, but limited to Microsoft. The Tcl guys could have competed, but screwed things up and didn't release much as open source until after I created mod_dtcl, which turned out to be too little, too late.

With PHP, it was and is very easy to get started. I wrote about it here some:

http://www.welton.it/articles/scalable_systems.html


What's not to hate? It's not very powerful (lacks first-class functions, for example), it's messy (just look through the function reference), it's weakly typed (try performing multiplication on a string), it's fairly insecure by default and it's simply ugly. It may be convenient to be able to start by inserting a few blocks of PHP in to an existing web page, but you can do the same thing just as easily using Ruby and RHTML.


If you sit down at a randomly chosen web server and write two files, one ending in .php and one ending in .rhtml, which file do you think has the better chance of working correctly? Newbies would prefer not to know what CGI means, let alone how to edit an Apache setup file.

But, yeah, PHP is a scary language. In addition to what you've already mentioned, PHP's core "array" datatype appears to have been designed by a committee of drunken camels.


I would not expect someone trying to learn to program to select a web server to test projects on randomly. Installing mod_ruby is as easy as installing mod_php. Finding web hosts that support it isn't hard either.


Plus, there are Ruby on Rails packages that don't even require apache! You just download the package, install it, then you can run a built-in development webserver by typing "script/server". What could be easier?

(OK, I know of one stealth mode startup that's going to make it even easier, but that's beside the point.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: