Hacker News new | past | comments | ask | show | jobs | submit login

I still don't understand why php is so frowned upon here. Easy and quick implementation and a low learning curve.



There's a complexity ceiling that you hit fairly quickly in PHP. Since there's no consistency in any of the libraries, you have to cram a massive amount of information into your head (or sit there with the reference manual open and look up every function call). If you're doing a quick one-week project, PHP is probably the tool of choice, but there's a large middle ground where PHP apps become way too spaghetti-ish and yet you don't want to shell out the upfront cost for a C++ or Java webapp.


Apparently Wikipedia, Facebook, Flickr, Wordpress.com, Facebook, Yahoo, Digg... haven't hit that complexity ceiling yet :) (Some of these use other languages as well, but AFAIK it's stuff like Java or Erlang for particular tasks)

PHP is far from perfect, and personally I've also moved from it to Ruby and Python, but the automatic "switch from PHP to anything" on a language that powers so much of the web is meaningless.


Wordpress has definitely hit the complexity ceiling; just look at all the security vulnerabilities and random bugs published for it. ;-)

FaceBook and I think Yahoo both make heavy use of an RPC-based, service-oriented architecture. They use PHP for the frontend but then call out to backends to do any sort of complicated processing. This is basically the only sane way to architect a large system. While I think their choice of PHP to power the front-end is regrettable (it's a major reason why I didn't apply to FaceBook), it's at least defensible.

And I'm also a PHP->Python refugee - I used PHP on a bunch of projects in college, one of which got to the 100k-to-million-user range. I would not take a PHP job unless I was desperate for cash; I hate the language that much.


AFAIK in its recent versions PHP doesn't have any unique design flaws that make them more vulnerable to attacks. In fact, being the most widely deployed web language means it probably had more security patches than most. Bugs and vulnerabilities in applications are certainly not unique to PHP..

I wouldn't take a PHP gig either. I would also prefer Ruby work to Python, since I enjoy it more. But that's my selfish interest as developer, it doesn't mean that for the project itself PHP isn't, sometimes, the best option for the project.

For people who want to create a web app and don't have much programming experience, PHP can still be the best choice - it's easy to deploy, it has great official and unofficial docs, it's easiest to find developers for and it's pretty reliable.

Now, this may sound crazy to many, but not only PHP has some good sides, a lot of them come from intelligent choices its designers made: for example, PHP script only runs in context of the request - no application server here - which helps reliability since memory leaking etc scripts can't cause too much harm. PHP's basically saw itself merely as an Apache module - in a rare, pre-hyposhpere display of egoless coding - making it extremely easy to deploy (compare and contrast with Rails before Passenger). The fact it comes with so many libraries welded into the common namespace is ugly for me, but a boon for beginners, and the fact you can mix PHP and HTML allowed many web designers to tinker with it, gradually moving from design to HTML to PHP - one of whom ended up writing Wordpress, I think :)


With the (possible?) exceptions of Wikipedia and WordPress PHP is used by these sides for the fairly thin front-end layer. The core algorithmic functionality is implemented in (usually) Java and C++ and occasionally Erlang, Python and Perl.

In fact, I am willing to argue that there's more reason to use something else if your app is simpler (i.e. it's a monolithic web application): you can add functionality without resorting to a more complex multi-tier/service oriented architecture or writing C-based extensions.


The article is about PHP & Python. Erlang, C++ and Java don't really compete in the same space - I doubt writing any of these sites in Python would mean they wouldn't need Erlang or C++.


Python is, in many cases, a serious contender for Java and C++. E.g. if you're dealing with any sort of machine learning (suppose you wish to add a recommendation engine to your site), Python (e.g. with NumPy) is more than capable of that (although these scripts will generally ran standalone, they could still use the same libraries for fetching user data).

Yes, there are many cases where Python/Perl/Ruby can't do what Java/C++/Erlang can, but their capabilities stretch far longer than those of PHP. PHP essentially limits you to front-end web development; writing standalone scripts/tools/daemons in PHP -- been there, when a boss at a startup I worked in refused to allow me to use any other language -- is horribly painful.

There's a progression between "simple CRUD pages" and "complex, service oriented architecture". Python can fill a lot more on that continuum.


Wouldn't it be possible to write any additional functionality as a PHP extension in C/C++? This effectively becomes low entry with immense power...


C/C++ are low level languages. C++ has object orientation, but talking to C++ from Zend is very tedious (if I am not mistaken, you essentially end up passing objects as void pointers).

Python, Ruby, Perl, Java, Erlang, allow you to do systems-programming (i.e. writing daemons, doing threading and high performance event driven/non-blocking I/O) while still retaining high-level features such as reflection/meta programming.


Speaking as someone who is tangled in a love triangle between Python and PHP. I do agree that PHP does have it's strengths. For the programmer just making a living, it's quite ok to etch out just using it.

In terms of web applications, what you can accomplish in PHP you can pretty much do in Python. But the difference comes in when you do "care" about the tools you're using.

When you want that extra power. When you want something sane to work with.

Python and friends give provide that for you.

I do love PHP, it's deployment is a snap and the frameworks we have now are kick ass. But Python is such a joy to work with it. And the longer I work with it, it gets harder to come back to PHP.


I'm at the stage where the temptation to use PHP for something quick & dirty (a one-off script or so) is still very strong, mainly because I know all the details by heart and can pretty much realize the script as fast as I can type it in.

In python it would take me a bit more time and that time is not always available.

But the future is clear to me, no more PHP if I can help it. There are plenty of things that irritate me about python, but they are mostly things that you learn about, then it stays learned.

PHP keeps throwing up new ways to trip you up even after years of using it.

In a way I'm glad to have gone this route, in spite of the learning curve with python (and Django), I can already see it pay off when I see functions shrink to 1/3rd the size they were using PHP.

The only thing really still missing from the python under apache model is a multi threaded shared state environment.

That would really allow you to blow other solutions out of the water in terms of speed.

Now you still have to make that round trip to the database on the next page fetch.


What python framework do you use?


Pylons.


Didn't the article just explain that?

I use PHP every day, but have grown a bit tired of the lack of sophistication inherent in the language. The huge flat namespace, the inconsistent design of the standard library, the absence of advanced language features (functions aren't even a first class data member), and so on.




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

Search: