However, I've never really understood why people criticize or mock Facebook for pouring so many resources into PHP. For building cross-compilers, toolchains, and syntactic extensions on top of a language that is seen as a fundamentally weak foundation.
I mean, I DO understand all of those criticisms. I just don't get how the same people can then turn around and use CoffeeScript, TypeScript, Dart, and even Node.js on the server-side. Compared to a JavaScript foundation, PHP is bedrock!
No, they're different. Firstly:
- js is the only choice in browsers. for server stuff, you have an almost infinite choice.
- javascript has warts, sure. but if you stick to "the good parts", then it is possible to use in a relatively sane manner. the compile-to-js languages are trying to make it easier to use the good parts, and harder to use the bad ones.
- node is different, in that bizarre though js may be, if you have to use it in the browser, there is a kind of logic to using it on the server as well.
As for the logic of using a single language throughout your stack, I would argue two points:
[1] It's a myth. If you are a professional software developer, you are going to learn multiple languages... and if you're a GOOD software developer, then this excites you rather than bums you out.
So you're using JavaScript on both the client-side and server-side. Okay, how do you get information from your database without learning SQL? Just stick with MongoDB as the only datastore you will ever use? Document stores are great for the things that document stores are great for (another tautology), but suck horribly when you try to shoehorn them into situations calling for a relational database.
What about the HTML and CSS knowledge you already need to work on the client-side? Do those "not count", because a JavaScript developer usually happens to know them? Nonsense. Doing real work requires knowing multiple languages, because different ones are better suited for different domains.
[2] I would argue that the skills and considerations required to do non-trivial work on the server-side are generally different from those skills needed to do non-trivial work on the client-side. You may be smart and/or experienced enough to master both domains, but you approach design and coding issues differently in those domains.
If you take a developer who is senior on the server-side, but is so junior level on the client-side that he or she barely understands the DOM, then they will struggle at first in the other context. Vice-versa if you take a senior client-side web developer and throw them into the backend world. You're going to need to learn completely different skills, quickly. I'm not convinced that clinging to your "home" language really speeds up that process, rather than impairing it.
Is there any language for which this is not true?
I don thinkt that makes any sense. Should we also use js to implement the OS for the server? If js is good for server-side use it, if not use something else.
My main issues with php is that I dont trust the language and standard libraries to behave as I expect. There are simply to many strange type conversions, silent errors and strange behaviour going on.
I think PHPs speed is largely exaggerated here. The interpreter always used to be slow, and before the bytecode cache it was plain awful. Im pretty sure it only ever got away with it because so much of the standard library is thin wrapping. Is it really faster than CPython like for like?
"Most non-PHP developers judge the entire language by bad code snippets 'written' (mostly copied and pasted) by amateurs for PHP 4"
The old "stop hating on the only language I know! It doesn't have flaws, there are just newbies using it!"
There is plenty wrong with PHP, to this day. When people criticize PHP, they're not usually talking about PHP 4. They're talking about 5.4+. There's some seriously lunacy in the core language. Some of it is there for legacy reasons, and some is brand new.
It is a mixed bag. There are times where PHP is faster because it is closer to C, where as more python is written in Python. I once ran into a situation where it mattered that PHP's file_exists() is much faster than python's os.path.exists(). I have run into other cases where CPython is much better, such as python's heapq crushes a hand rolled PHP priority queue.
In practice PHP tends to be quite fast, because the standard solutions are pretty unambitious like thin wrappers around CURL, rather than actually implementing HTTP in php.
That (specific example) sounds incredibly intelligent to me.
There's one big, primary reason for it.
PHP is dumb.
You can't do clever things in PHP with the language, you have to all the clever things in how you design with it.
You can't overload functions or redeclare them later.
You can pretty much resolve a function at call-time, without worrying about decorators around it or about any meta-programming.
This makes for a fast VM in PHP, because it can make assumptions about function call-order much more than something like python.
I like Hack because it explicitly doesn't support[0] a bunch of cruft from PHP. It feels a lot to me like the BC-breaking PHP.next people want - easy to switch to for modern applications, but not hindered by supporting PHP 4 code. Bit early to start pointing fingers at it's future though.
Not that I think the former is good practice at all, but isn't the latter a kind of weird use of what is a valid variable name?
That isn't what "good language" means.
Thats an interesting sentiment. The exact same could be said for languages like Go (Google), C# (Microsoft), Rust (Mozilla) and platforms like NodeJS (Joyent). In any case it doesn't seem like too much of a worry. Cassandra came from Facebook, and was well done enough that another company came in and picked up development when Facebook left it.
Other than the "web" bit, isn't that true of most new languages, where $proposer is google, microsoft, typesafe, mozilla, redhat, netbrains?
Should people feel more secure if instead of being built and used by one large corporation it was built and used by a single guy? Or should we prefer not to have a big company supporting it?
I saw Tumblrs 'original' code base and it's a giant cluster fuck that is full of horrible design decisions.
They are still in tons of technical debt because of it. So it's funny to see him give an insight on PHP. Kind of ironic.
Either way, Facebook’s HHVM is not for 99% of PHP developers. Most PHP developers need better cache coverage and proper SQL architecture and approach.
Execution speed is not a problem for most of them.
So what is a great language? If it runs the largest active user app on the planet (FB), the most widely used CMSes (WP,Drupal,EE), message boards, MVPs, etc. Why continue the hate, then end the article on how you've chosen it as the greatest option to run some of your systems.
Twitter, famously known as a Rails, now Scala, shop, has used php throughout its life (I know several php coders that have worked there). Their developer/documentation area is Drupal (acquia).
But moreover, as web architectures have become more distributed and JSON heavy, PHP has held onto its language position, especially with International devs.
As a CTO, not a employee, its also important to consider the salaries, roles of the people you need to build the platform.
SF Rails http://www.indeed.com/jobs?q=rails&l=San+Francisco,+CA&rbt=R...
SF PHP http://www.indeed.com/jobs?q=php&l=San+Francisco,+CA&rbt=Sen...
Then look at Non-US prices. Can't find a recent blog post where someone reported on salaries by language.
Quite honestly, there's only a couple or so languages that I would truly describe as "great".
compared to what? IMO an easy to learn language has very little surprises, is consistent and names things intuitively. Would you say that php as the language is easier to learn than ruby or python?
Not really true because HHVM has to run basic PHP before it can apply the Hack annotation. You can pull out the annotations and it's still PHP.
Seems fair - I do like the static typing of hack though. Weak typing has its place but it can become a real PITA (looking at you javascript).
Hahaha! Bigotry is funny! Hahaha!
I don't agree that it's bigotry though.
Transgender people have it tough. Give them a break.