11 ms·
"It’s a pity some people still build important apps in PHP..." Getting real tired of seeing these baseless statements from so called software professionals. H
by xd 13y ago
"It’s a pity some people still build important apps in PHP..."
Getting real tired of seeing these baseless statements from so called software professionals.
Here is an off-the-top-of-my-head list of features of modern day PHP:
* yield
* event
* pthreads - yeap, real threads.
* closures (including support for $this)
* consistent hashing api
* "finally" added to try-catch
* empty() now supports expressions, rather than only
variables.
* array and string literal dereferencing
* foreach support for list() - foreach($array as list($var, $var))
* array_column
* traits
* short array syntax
* namespaces
* json manipulation is second to none.
* runkit - all kinds of danger here
- enneff 13y agoSo what? Part of the reason PHP is such a disgusting mess is because it is a raft of haphazardly accumulated features.
- xd 13y agoFor someone that works on Go at Google I'm shocked by your very much subjective view of PHP. Elitist much?
- ciupicri 13y agoIt's not just his view, there are other people who feel the same way about PHP.
- dmak 13y agoThat comment didn't even come across as elitist. There was no need to get personal.
- xd 13y agoHe works on Go at Google. A skilled professional no doubt, could he not have made some valid points rather than simply calling PHP disgusting. It didn't add anything to the conversation. If you where in the pub and someone spent some time listing the virtues of the pint they where drinking, and then someone joined in the conversation and called it disgusting with no basis .. wouldn't you find that to be odd behavior?
- grey-area 13y agoHe probably didn't elaborate because he felt the basis for the view was clear - there are clearly areas of PHP which still need work. PHP is often frowned upon because the APIs are a mess of legacy cruft like addslashes, magic_quotes, mysql_escape_string, mysql_real_escape_string, mysqli_real_escape_string versus prepared statements. Efforts are being made to clean it up, but for a language to ever end up in a place with that sort of library functions is a pretty big red flag.
- xd 13y agoCheck the manual; magic_quotes, mysql_escape_string and mysql_real_escape_string have already been deprecated/removed.
- grey-area 13y agoI'm aware of that thanks, as noted in the last line: Efforts are being made to clean it up, but for a language to ever end up in a place with that sort of library functions is a pretty big red flag.
- xd 13y ago"for a language to ever end up in a place with that sort of library functions is a pretty big red flag." At the time it was reasonable .. but PHP evolved and learned lessons, it didn't just stop there as you seem to be saying.
- cowsandmilk 13y agomysql_escape_string [1] mysql_real_escape_string [2] Why is exposing a C library's functions and their names PHP's fault? [1] http://dev.mysql.com/doc/refman/5.5/en/mysql-escape-string.html http://dev.mysql.com/doc/refman/5.5/en/mysql-escape-string.h... [2] http://dev.mysql.com/doc/refman/5.5/en/mysql-real-escape-string.html http://dev.mysql.com/doc/refman/5.5/en/mysql-real-escape-str...
- 13y ago
- aaronem 13y ago"Elitist?" I came into web development via the PHP tradesman's entrance, and until by the grace of God I found my way out into the wider world, I didn't even begin to suspect just how miserable I had it. If there's a tinge of elitism in the wider world's attitude toward PHP, I'll be the first to contend that it's justified.
- ThomPete 13y agoYeah I think you are more like an ex-smoker who after you managed to quit tells everyone who awful smoking is :)
- aaronem 13y agoNot really a parallel; you'll never meet a long-time cigarette smoker who doesn't know how awful a habit it is, although you'll probably meet some who will lie about it. On the other hand -- and I say this as a smoker, albeit as one who's cut back his habit to almost nothing over the last couple years -- smoking is an awful habit, which is both severely addictive and without meaningful benefit for the person with the habit or for anyone else. So I suppose I'm not all that inclined to quibble about the not-quite-perfect parallel, after all. :)
- ThomPete 13y agoIn other words. The parallel is perfect.
- deleted 13y ago[deleted]
- enneff 13y agoI wrote PHP code for 10 years. You could say my relationship with the language is pretty subjective.
- xd 13y agoWhen did you stop developing with PHP? edit: you know what would be great, if you could show some common programming examples in PHP and how Go would manage the same situation.
- thirdsight 13y agoThose are great features. However the objection people, including myself, have with PHP is that the legacy stuff is inconsistent junk. I still use it on occasion but it pains me.
- xd 13y agoPHP is making strides to remove legacy pain points. Check the changelogs i.e. http://php.net/ChangeLog-5.php#5.4.0 http://php.net/ChangeLog-5.php#5.4.0 As to parameter ordering .. I've been using PHP for so long now that they've been memory to committed ;)
- coldtea 13y agoPHP, especially post 5.2, is a flexible and battle tested language to do work in. It has some bad design choices inherited but nothing that you can't overcome and never have to think about again in a couple of weeks of learning the language. Exactly like Javascript in this regard. I've been programming JS for over 15 years, and with the exception of cross browser support back in the day, there's nothing that had me startled after I learned the language -- except for a few issues related to floating point that I stumble upon now and then, but then that would be true for floating point math in any language. The only PHP inconsistency is with the naming of the built-in functions. Functionality wise, most are solid bindings of respected C libraries. And, really, the needle/haystack thing has been blown out of all proportion. As if that's the biggest challenge one faces when programming.
- grey-area 13y agobaseless statements from so called software professionals You're calling this guy[1] a 'so-called software professional' because he criticised PHP? [1] http://en.wikipedia.org/wiki/Tim_Bray http://en.wikipedia.org/wiki/Tim_Bray
- stiff 13y agoI'm not a real programmer. I throw together things until it works then I move on. The real programmers will say "Yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I’ll just restart Apache every 10 requests. -- Rasmus Lerdorf
- andyroid 13y agoYeah, xd clearly missed to list that the creator of the language also has a sense of humor, but trying to limit it to technical features seems reasonable.
- poolpool 13y agoFor all the folks getting excited about my quotes. Here is another - Yes, I am a terrible coder, but I am probably still better than you :) @rasmus
- jokoon 13y agoI agree, but that can't really work on the long term...
- seabee 13y agoIt's the equivalent of smacking a malfunctioning (mechanical) appliance to try and make it work again. Maybe you just want something to last long enough until you can get a better-designed, more reliable appliance.
- daphneokeefe 13y agoPercussive maintenance
- thejosh 13y agolucky php has very clever people doing clever things with it - see hhvm for a recent great thing for PHP.
- 13y ago
- mseebach 13y agoIt's a pity that people still build important app in PHP, because despite improvements to PHP, there are several, even many, languages out there that beats PHP flat out on all fronts. PHP used to be by far the easiest language to get started with for web dev. This is not the case anymore. And while you're certainly entitled to disagreement, Tim Bray is about as far from "so called" you can get for a software professional.
- lsh 13y ago"PHP used to be by far the easiest language to get started with for web dev. This is not the case anymore." um - who would be the contenders? in terms of getting started, which also means deploying and see your stuff on something other than your local machine, I can't think of anything better supported than PHP. Most budget hosting you can simply upload your brand new, first-ever PHP script and have it 'just work'. No need to worry about wsgi, cgi-bin, application servers or anything. As much as I loathe PHP because it sweeps the developer towards bad habits and unreadable, bug-ridden, slop, I love it because, rather like a bash, it's a flexible and comprehensive tool in my toolbox.
- mseebach 13y ago> who would be the contenders? Here's a good start - and I'll bet that Heroku's free tier is a better option than most $5/month PHP webhosts: https://devcenter.heroku.com/categories/language-support https://devcenter.heroku.com/categories/language-support
- JackMorgan 13y agoMy perception is most developers who choose to use PHP these days for new development efforts either do so because it's their strongest language and do not want to reinvest the time to retool, or because of political reasons orthogonal to PHP's technical chops. Thankfully, it is still actively developed, so those who make that choice are able to take advantage of such new features. I totally understand the choice to work in shops that have legacy php code: they have money and often times don't want to change off php. Handily enough, most of us like working for money. What caused me to retool away from php was the fear that not enough new systems were being built in it, leaving a diminishing pool of jobs for a constant pool of developers not wanting to retool. I figured I'd give up my space to someone else, and seek my fortunes on other stacks. I don't think there is anything wrong with deciding X language will be the one you ride into the sunset on (some COBOL programmers I know make crazy money due to the economics of the ratio of jobs/developers). I just personally considered the risk of a job shortage to outweigh the rush of a talent shortage. (And I am so practiced at retooling, I could probably be ready to interview for a PHP job in a few weeks if I had to). I think of choice of stacks from the agile way, "make it fast to change, and you'll be ready to snatch up arbitrage opportunities when they arise." Rather than the waterfall way, "pick the right tech that will last your career at the point of maximum ignorance". I think most people mock PHP just because it's fashionable to do so, it's the "easy joke" that vb6 used to be. I wouldn't take it personally, you should own your choices.
- daGrevis 13y agoShould I be impressed? Mess on top of existing mess. :(
- chrisweekly 13y agoFor me, this is the definitive take-down of PHP: 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... Even if a handful of those issues have been addressed in the intervening 15 months, the depth and breadth of fundamental problems remains. /$.02
- xd 13y agoObviously you believe everything you read on the internet without question .. https://news.ycombinator.com/item?id=7030283 https://news.ycombinator.com/item?id=7030283
- chrisweekly 13y ago"Obviously... everything... without question"? Um, hyperbole much? There's a lot wrong with PHP, and that'd be the case if even a quarter of the points in the article I linked to were valid. PS Feel free to get the last word in after this, I don't plan to reply again since it's not very constructive. Have a nice day.
- Sanddancer 13y agoYes, php is more checklist complete than it was a few years ago, but there's still quite a bit of ugliness in the language. For example, you mention * closures (including support for $this) I looked at this a couple days ago, because closures make a lot of problems easier. However, PHP's handling of closures is more than a bit ugly and hackish. Yes, it supports $this, but this was done after the initial release, doesn't give much confidence in how it's handled under the hood. Plus, you have some real syntactic ugliness; in order to scope variables into a closure, you have to declare them again with a now overloaded keyword -- use -- with them passed by value by default. Closures in pretty much any other language, you just put them in the scope of your function and the compiler/interpreter knows how to handle them without any hints from you. While php is less bad now, there's still quite a bit of ugliness in it due to its tendency to just spackle new parts on without any regard for what the end result looks and functions like. The php team needs to make a concerted effort to clean the language of its rough points, even if it breaks backwards compatibility, otherwise, useful ideas will continue to be hampered by an overbloated ugly core.
- abvdasker 13y agoCall me crazy, but PHP JSON manipulation is maybe second to node.
- krapp 13y agoNode as javascript does handle the object notation natively, which is an advantage over PHP in terms of handling JSON. Which, coupled with the (recently corrected) awkward syntax for arrays, unfortunately makes PHP's most common pattern (conversion of SQL data into arrays and maybe into JSON) more of a hassle than it should be.
- dscrd 13y agoPHP certainly has features and it certainly is successful, and people are certainly doing stuff with it. It also certainly has severe and fundamental design flaws that are never going away. It's distressing to say the least to many of us people who have studied programming languages a lot, that the quality of design and coherence in your programming language has almost no effect (or even negative correlation!) to how well it succeeds.
- Joeri 13y agoSpeaking as someone who has written hundreds of thousands of lines of php over the years, i think php's main problem is not that it lacks features, but rather that it doesn't have a sane subset, a javascript-like 'good parts' if you will. PHP added OO api's for date and database handling in the 4 to 5 transition, but it never got around to doing the same for strings and arrays. So frameworkless php is by necessity a mixture of procedural and OO code (unless you go pure procedural), and always looks ugly. PHP's stewards could solve this by bringing all the API's into the OO fold, and I have experimented [0] with what PHP could look like if strings and arrays were objects, but so far this hasn't happened. You do have some really nice frameworks that hide the procedural stuff, like laravel, and that code looks nice, but it is really slow. And this is the inherent conflict of the php developer. If you write raw php, it is ugly but fast. If you use a framework it is pretty but slow. The techempower benchmarks [1] demonstrate this, where raw php performs at near-native speeds, but frameworks like symfony and laravel are embarassingly slow in comparison. So, php's scorn is well deserved. It's productive, yes, but it is impossible to build a world-class top-performing app in it and still get clean and consistent code without jumping through some sizeable hoops (like facebook did by building their own php engine and php-like language called Hack, in addition to their own frameworks). [0] https://github.com/jsebrech/php-o https://github.com/jsebrech/php-o [1] http://www.techempower.com/benchmarks/#section=data-r8&hw=i7&test=query http://www.techempower.com/benchmarks/#section=data-r8&hw=i7...
- krapp 13y agoThis was a competent and accurate criticism of PHP. Backed up with references, neither of which were veekun's rant. Thank you for adding some signal to the noise which usually accompanies threads where PHP is mentioned.
- antocv 13y agoThrowing a bunch of buzzwords or features at the problem doesnt mean the language magically becomes elegant, consistent and logical. PHP with these features has become more of a headache.