5 ms·
Given a programming task, it will be written faster, easier, and in a more maintainable and less bug-prone fashion if it is not PHP. The opposite opinion is ba
by lectrick 13y ago
Given a programming task, it will be written faster, easier, and in a more maintainable and less bug-prone fashion if it is not PHP.
The opposite opinion is basically indefensible. Sure, you can still dig a trench with a spoon (and if you have enough money to wield a bunch of workers with a spoon), even if a shovel would do a better job.
Let's begin.
1) PHP autocraptastically converts strings that look like numbers, into numbers, resulting in all sorts of weirdness like this: https://eval.in/111886 https://eval.in/111886
2) PHP 5.4's OWN TEST SUITE has 91 failures and only 70% coverage. There is NOTHING more "WTF" than that! Why even bother having a test suite?? http://gcov.php.net/viewer.php?version=PHP_5_4 http://gcov.php.net/viewer.php?version=PHP_5_4
3) Why the fuck are all of these different things equal, and how does this NOT result in problems? http://i.imgur.com/pyDTn2i.png http://i.imgur.com/pyDTn2i.png
4) String increment is dumb to begin with, but why does it not even match the behavior of string decrement? https://eval.in/60631 https://eval.in/60631
5) Why the hell can you jump back into a try block from a catch block? Recipe for disaster: http://phpmanualmasterpieces.tumblr.com/post/33091353115/the-documentation-clearly-says-raptors http://phpmanualmasterpieces.tumblr.com/post/33091353115/the...
6) PHP comparison operators. I'm sorry, but this level of complexity might make you feel smart once you master all its idiotsyncrasies [sic], but it's actually dumb: http://stackoverflow.com/questions/15813490/php-type-juggling-and-strict-greater-lesser-than-comparisons http://stackoverflow.com/questions/15813490/php-type-jugglin...
That's a small fraction of not-thought-out PHP language features that result in REAL bugs and security holes. Which consume large swathes of programmer time. Which, apparently, Facebook can afford to swallow.
I'm sorry, but your position, as valiant as you are defending it, is literally indefensible. And I don't give a fuck how big Facebook is, they would STILL be better-served by switching SOME of their code to a different language. ANY modern programming language wouldn't suffer from this imbecilic, immature language design.
- ghotli 13y agoI can't fathom why you're under the impression that some code hasn't been switched to another language. Furthermore, your vitriol seems quite effective at undermining your thesis.
- lectrick 13y agoFair enough. And to be honest, there was a single night not too many years ago where I wrote up an auction site that had most of the functionality of eBay, in a single night, in PHP (someone else had already done the frontend work, fortunately- I just built the backend).
- orblivion 13y agoYou're making a mistake. The question is not whether to start a company with PHP vs language X. The company is long started. The question is not whether or not to poof into existence a port from all of FB to language X. That's not possible. The question is, given that PHP is the current language, with all its faults, will it it cost more (including all definitions of cost) to make the switch? How long will it take? Does it get the job done? How bad is the damage? The question more pertinent to your argument is, did they make a mistake years ago choosing PHP? That's when the could have conceivably gone with language X. BTW the types of stuff you're listing are documented here. So thorough it's amusing to read: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...
- eevee 13y agoWhy thank you :)
- lectrick 13y ago> The question is, given that PHP is the current language, with all its faults, will it it cost more (including all definitions of cost) to make the switch? How long will it take? Does it get the job done? How bad is the damage? An excellent point. Which in fact is an argument in favor of modularizing your code as much as possible, as early as possible. There are tools now like Apache Thrift which make this easier: http://thrift.apache.org/ http://thrift.apache.org/
- bad_user 13y ago> The question is not whether or not to poof into existence a port from all of FB to language X. That's not possible. And yet Twitter has slowly migrated on the backend from Ruby to Scala/Java. They still use Ruby for the frontend, though it's not clear to what extent, since they've also migrated to a single-page, fat client design on the desktop. And at the very least, their choice of using Ruby when prototyping, was at least sane. I understand that large codebases can't be migrated easily. But you can migrate individual components when needed, if you have a modular, service-oriented design. Also - building new functionality in PHP is indefensible, unless their code-base is one big monolithic hairball, which I doubt it is.
- juchem 13y agoIt's interesting how most people seem to attribute the quality and longevity of a software to the language it is written in or the frameworks it uses rather than to the amount of thought that was put into its design. Sure, the former is important, but largely overrated.
- deleted 13y ago[deleted]
- cybernytrix 13y agoI think most of you guys are missing a crucial thing here -- how decisions get made. Facebook had two options: 1.) Rewrite all the PHP code in Java/Ruby/C++/whatever 2.) Write HHVM/Hack/etc to transparently convert the existing PHP code. Option #2 ended up getting a lot of publicity for the engineers. If they chose option #1, not only is it a lot of hard boring and possibly error prone work, there is no chance for any of the engineers to get the type of publicity they are currently getting. All in all, engineers tend to work on whatever will make them get noticed, not necessarily the better technical choice nor what is in the best interest of the company... this is especially true in companies like Facebook and Google where there are a lot of very smart engineers doing relatively mundane work. So there you have it Hack/HHVM are all just publicity stunts, the more you feed it, the happier their PR gets.
- semoore95 13y agoYou're an idiot.