4 ms·
TL;DR: Because we used it. Like many people, many years ago I learned php. It was easy to deploy, and make simple dynamic websites. Many hosting services provi
by natmaster 13y ago
TL;DR: Because we used it.
Like many people, many years ago I learned php. It was easy to deploy, and make simple dynamic websites. Many hosting services provided support for it. I was quite happy to use it for these things.
Then in 2008 I interned at Facebook. At the time, there had not yet been any attempts to improve the language by Facebook itself. Using php in an actual codebase - real world software - made me realize just how terrible it was. I vowed to never use it again. I even presented some of the worst aspects of php in my intern presentation to the executive team. Mark was quite intrigued. At the time there were talks of how to deal with many of the problems, but nothing had been figured out by time I left.
Its deficiencies are too numerous to simply list here, so I'll give you a high level summary (which many have also said similar things). Php is a giant hacked language originally not designed for real software and then features added on. It's syntax is the worst of any used language; it's language features are severely lacking; its implementations are contradictory, confusing, and destructive. In short, it is not easy to read, it is easy to shoot yourself in the foot, it is not able to scale both in complexity and performance; and its libraries are a mess.
- jnardiello 13y agoI keep reading always the same things from people who simply don't know how to use it properly and feels hurted by a different-than-what-studied-at-school syntax.
- natmaster 13y agoStrange, I learned php before I ever went to college. By time I went to university I knew 11 programming languages, so I don't think this applies to me.
- jnardiello 13y agoMh, not sure what you mean here. As you know 11 programming languages, you might be aware that "knowing your tools" is always valid and goes far beyond syntax itself. PHP is as capable as complete as any other language. Reasons behind most devs "hate" are mostly minor things and mostly a matter of taste.
- secstate 13y agoArgh! But he just gave an account of how it's syntax is often contradictory, and it's primary implementation slow and prone to scaling issues. Just because some orgs can wring a production system out of it does not mean it's the bee's knees. Far, far from it. PHP is functional, I'll give it that. But arguing it's merits in a world that has Rails, Django, Node.js or even Chicago Boss, is going to lose you friends amongst people who appreciate elegance and speed in their libraries and applications. As if you couldn't guess, my personal opinion is that PHP is one step up from CGI scripts in Perl5. PHP5 gained mindshare because your grandma could figure out how to embed a variable in a template and toss it in a directory that apache was already hosting with mod_php. And that, my friends is why we're even talking about PHP.
- moron4hire 13y agodifferent isn't always a virtue.
- Niten 13y agoWell for what it's worth, I keep reading that from people whose exposure to programming languages and techniques is limited to making LOB applications in PHP and maybe one or two other lowest-common denominator languages. Most people I know who have any real breadth of programming experience find PHP's language deficiencies glaringly obvious, even if they find it occasionally useful due to deployment requirements, etc. But more to the point, if anybody knows how to use PHP properly I'd think it is somebody who has worked at Facebook, and you can't just dismiss natmaster's complaints with hand-waving that he must not have been doing it right.
- jnardiello 13y ago> if anybody knows how to use PHP properly I'd think it is somebody who has worked at Facebook, and you can't just dismiss natmaster's complaints with hand-waving that he must not have been doing it right. Well, considering the scenario he described in his own post, it's obvious that PHP wasn't used in the right way. Working at facebook itself, unfortunately, means nothing as i have no idea how their code actually is and what natmaster was doing there. > Well for what it's worth, I keep reading that from people whose exposure to programming languages and techniques is limited to making LOB applications in PHP and maybe one or two other lowest-common denominator languages. For what is worth, i've seen PHP applied with different patterns and architectures in scenarios that were pretty wide, powering millions of contacts daily. It's probably because of this that i learnt that it's actually a well-done language whose only fault is that it isn't popular among engineers and mostly used by amateurs. But this has nothing to do with the language itself.
- 1010011010 13y agoPHP is not well done. Even its creator agrees.
- pavelrub 13y agoIf it's apparently so difficult to learn how to use it 'properly', maybe it's just a shitty language.
- jnardiello 13y agoPatterns anyone?
- semerda 13y agoGreat points! What many folks forget is that the version of PHP Facebook has in Production (HipHop) is not the same version most have when they deploy PHP. Legacy & inertia has retained PHP at FB but it is far better managed then what others are doing with it today. I have a list of few points and poor excuses used by folks to justify PHP as language of choice in today's times: http://www.theroadtosiliconvalley.com/technology/php-coding-horrors-poor-excuses/ http://www.theroadtosiliconvalley.com/technology/php-coding-... I am sure if Facebook were starting up today they would not choose PHP as their primary language of choice.
- pan69 13y ago>> Its deficiencies are too numerous to simply list here Then just list a few of them. Your comment seems highly subjective and opinionated without any concrete examples.