Overall you're right, this is what irritates me about almost any PHP thread as well. Almost no HNer would go into, say, a C++ thread, spit on it and advertise Python. But yet the same thing is happening regularly with PHP. Then again, I was pleasantly surprised we don't have that in this thread (yet).
However, I don't think this is a worthwhile URL to point to on the grounds of near-irrelevance. There are no major new features being released here.
The reason Python people don't go into a C++ thread is because the C++ people will take care of themselves, getting into bitter trench warfare over wether X feature was a good idea, a great idea, or the worst idea ever.
PHP, Python, Ruby, Perl and C# have a lot of overlap in terms of what they do, but the overlap between C++ and Python is way smaller. C#, C++ and Java have much more in common.
There are some things that C++ is very good at, where the alternative is usually C, something most would prefer to avoid.
There's nothing that PHP is very good at that Python, Ruby, Perl or C# can't do nearly as well. That's why it attracts so much criticism.
...and there we go. I chose this example to illustrate that all languages have individual strengths (yes, even PHP) and it doesn't make any sense to go and shit all over something you don't like while advertising your favorite stuff. It's bad style.
I don't see any PHP people coming into RoR security vulnerability threads just to have a field day, but vice versa this happens all the time.
Admittedly, I could have chosen C++ and Go instead of Python, but in the end it doesn't make much of a difference.
I've used a large number of languages and environments over the years, and I liked a lot of them. Stop forcing people into one camp only.
I don't understand the hate of PHP (or any language for that matter), I've never really gotten a good feel for why people are like this, the best I've come up with is "If someone invests 100's of hours learning X, they then feel the need to defend that investment in X or they made a bad choice".
The other thing I don't get is the need to identify with a language or framework.
My current project is in PHP (Laravel based, absolutely lovely framework last time I used a technology this fun was learning Delphi/VCL after slogging against MFC) except all functional and integration tests are written in Python (Selenium/WebDriver), Python is also used for 80% of my shell stuff (if it's more than 10 lines it gets written in Python).
I'm not attached to anyone technology anymore, I chose PHP for this project because I'd spent two years mostly working with it at work and after doing a couple of small projects in Laravel I got a liking for it.
People hate on PHP for a number of reasons, and that's why it's unusually unpopular. Here's my (highly subjective) take on why.
The barrier to entry for that language is extremely low, that is anyone who can manage to FTP a file to a server that has a bit of PHP in it can as much as consider themselves a "PHP programmer". This means there's an awful lot of extremely low quality PHP code out there written by people who didn't know better.
Secondly the language itself is so dizzyingly confused, where there's literally thousands of methods in the root namespace, and there's no pervading design pattern. Arguments appear in random orders, terminology changes, and functions from C, not exactly known for being programmer friendly, are simply ported, warts and all.
Then there's the problem with deployment, where PHP hosts usually have a woefully out of date version of PHP and many of the extensions that are standard have been disabled for reasons that are never entirely clear. This means writing PHP code that can be deployed on more than one host is extremely frustrating, often leading to writing it for the lowest common denominator just to avoid support issues.
Plus, there's this pervasive attitude amongst the PHP developers that frameworks are a bad thing, leading to enormous amounts of badly written re-inventions of things. People constantly write their own third-rate ORM, implement user authentication that's practically a check-list of what not to do, and seem to have a talent for mashing together different concerns in the same file.
This boils down to a nearly complete lack of leadership in the PHP world as to "how to do things properly". So long as the poisonously bad, brain-damaging w3schools is the go-to source of knowledge for PHP developers, things will only get worse.
If you like PHP for whatever reason, and surely some people do, the most important thing to help promote that platform is to be vigilant about stomping out bad development practices and setting a good example for other developers by explaining how to do things correctly using modern techniques.
This sort of outreach is taken for granted in the Python, Ruby or Perl communities which go out of their way to support aspiring developers. In the PHP world, it's full of nomads that prefer to go it alone.
I came to PHP late in my developer life (I started in the 80's when I was a kid) and didn't touch PHP until ~2009.
I've always used the current leading frameworks (or something close) and written PHP like I'd write Python or Object Pascal (clean, clear, commented, separation of concerns) so my opinion of PHP is probably clouded because of the way I approach it.
The thing that burns me the most about PHP is a worryingly large number of people using PHP think it's perfectly acceptable to start a project by opening Notepad and typing in "<?php $db = mysql_connect(".
From there on it's only misery. It's like new developers start out using techniques that should've died in the 1990s and the only reason they do this is because they don't know any better.
In the Ruby world you'd have to be living under a rock to not know about Rails, and the same goes for Python with Django. You're developing a web app? You use a framework. Period.
Yet in PHP land you have people who are otherwise competent developers that just don't know how to develop a web application. Maybe they've come from Java and they think that writing PHP like that is clunky, but hey, everyone else is doing it so who's to say otherwise, right?
If you like PHP and want to help, call people out when they're doing it wrong. Give them guidance on how to do it properly. Don't just look away and pretend you didn't see them flailing away on re-inventing the wheel.
I'm not even a PHP person but I've been pretty vigilant on the MySQL section of Stack Overflow about petitioning against the use of the deprecated mysql_query extension, pushing people towards PDO or ORMs, and about how important SQL escaping is. This feels like Doctors Without Borders where I'm explaining to a community that boiling water to kill parasites is important.
The PHP world is in really bad shape if people don't even know the basics.
> There's nothing that PHP is very good at that Python, Ruby, Perl or C# can't do nearly as well.
That is a little bit of an overstatement. Php is good at a lot of things that others aren't. Most of all ease of use and deployment. It MAY also be faster than other languages in certain circumstances. Example [1]. All in all, choose what you are comfortable with and what you feel is right for the job.
This is a huge problem, and has the added wrinkle that all the people qualified to solve it won't, because it doesn't apply to the stuff they're deploying and they're clever enough to not need it solved anyway.
This is a huge problem in you if you don't know how to use your tool as a developer. PHP is just a tool. If you don't like this tool called PHP, use another tool like Snake or Python or whatever, and be happy. Have you seen a top carpenter ever to go to another carpenter to complain about the hammer used by the other carpenter?
I think you're confused. The huge problem is that other languages don't have anything for deployment that looks as easy as mod_php.
And yes, all manner of professions grumble amongst themselves that newcomers are using inferior tools. Find some professional photographers and ask what they think of phone cameras.
The huge problem is you are complaining about tools used by other developers. Pick up tools that work best for you and let others choose tools that work best for them.
There is no inferior tool in this world. You select a tool based on your need, affordability and choice.
The important part is not the tool itself, it is what you make with your tool. We remember Leonardo da Vinci for his creations, not for the tools he had used to make those creations happen.
As of now, the most popular cameras in Flickr community are Apple iPhone 5, Apple iPhone 4S and Apple iPhone 4. All of these are phone cameras. You can see awesome photographs taken with these cameras. If you make a rule to accept photographs taken only using expensive DSLRs, sites like Flickr will not exist. And the world will be little less beautiful without sites like Flickr. By the way, Flickr is also powered by PHP.
I think you're misinterpreting what he's saying... I think he wishes that the other languages would make deployment as easy as it is for PHP.
I do too - I use Rails, Django and Flask, but I always dread project and server setup because it's almost always a bitch - there's some unwieldy virtual environment thing, or you have to set up two servers that talk to each other, or there are pathing issues and it's using the wrong version of the language, and the list goes on. On the other hand mod_php generally deploys correctly the first time everywhere, at least partly because it's so simple.
Things like passenger help a lot, but even passenger requires a lot more configuration than mod_php.
"I think he wishes that the other languages would make deployment as easy as it is for PHP" Oops! You are right. Thanks. My honest mistake.
He said in another thread "Right, because we'd spit on it and advertise Rust or Go" [1]. I read that and that created the confusion in my mind probably.
Whenever I see any post about PHP on HN, some people (almost all the Snake lovers, and new Go enthusiasts converted from Snake community) start bashing PHP. That's so bad. So, when I saw above mentioned comment [1], I just wanted to tell him that "PHP is just a tool and that is as good as any other programming language if not better. You can be happy with your language. No need to say anything bad about any other language.".
If someone likes Python or Go, that's fine. Why should he or she try to prove other languages inferior?
mod_php surely makes it easy for anyone to get up and running PHP. It is not clear why Snake lovers, who bash PHP always, couldn't create a good and easy deployment solution so far!
Just want to make it clear, I don't have any problem with Python or Go or any other programming language, I just think it is time for the Snake lovers and Google lovers to STOP bashing other languages and users of other languages.
That other comment was supposed to be tongue-in-cheek :)
I wrote the "fractal of bad design" article, though, so your biting commentary isn't misdirected. But I stress that I rag on PHP in particular because I feel it does a unique disservice to my field. There are plenty of languages I don't like or otherwise wish to avoid that I haven't felt the need to write a scathing deconstruction of.
Deployment is hard. I deliberately said mod_php seems easy because it still has caveats, and most of the reasons it works have significant downsides in the language. But this is something I think about regularly and am trying to find a solution to.
I mention photography exactly because that snootiness is a double-edged sword: perhaps there are now many more bad photos, but there are also many more photographers, and with that ultimately comes more good photos as well. The road to improvement across the board is always more accessible education + finding a way to marry the convenience of the new easy tools with the power and finesse of the old ones.
In that vein, you may notice that phone camera hardware has been getting increasingly respectable lately, and that people tend to (rightly) gripe when a new phone comes out with a really crappy camera. That's how I feel about PHP: I don't begrudge anyone for using it, but the rest of the field has improved considerably and it's a shame that cruftier equipment is still popular.
I don't know how you can be a good craftsperson without being able to judge the tools at your disposal, for good or for bad. I know why I like Python, and I know what Python lacks that I keep an eye out for in other languages. If you don't like Python, that's fascinating and I would love to know what about your perspective is so radically different, how it could be fixed, how it could be addressed in a similar language, or even what language does it better entirely. The intricate personal attachment to our tools is ridiculous, and discouraging criticism of them will only make us all worse at avoiding the bad ones and designing better ones.
"That other comment was supposed to be tongue-in-cheek :)" I somehow failed to comprehend your humor. But, from above comment, it seems I was not incorrect in detecting your stance about PHP.
In your article "fractal of bad design", you have listed problems in PHP. You can get a lot of similar articles, from Google, that list problems in other languages.
PHP (or any other language for that matter) doesn't do disservice to anyone or any community. None is forcing you to use PHP. If PHP doesn't work for you, you are free to find another language that works for you.
Every language has caveats. But good news is - there are a lot people trying to improve the languages.
You are trying to find a solution like mod_php. But PHP community has that solution already. So, PHP has something right, right? It is always good when you try to do something to make the language of your choice better than talking bad about a language you dislike. Good that you are trying something to make something better.
Phone cameras have improved. So has PHP. PHP 5 is better than PHP 4. But if you expect PHP to have all features of Python, then it will become Python. PHP doesn't want to become Python or Java or Ruby. And that is the most important part. PHP is popular because the way it is. It is not the most well designed language in the world. It never intends to have all features taught in programming languages class. Unlike Java, it never tries to be everywhere. PHP just makes it easy to create dynamic web pages. It will not force you to use OOP. It will not force you to use Camel case. It will not force you create XML config files. It will not force you to set type of variables. In short it gives you a lot of freedom and power. But, with freedom and power, comes responsibility. As a developer it is your responsibility to use OOP when needed. It is your responsibility to use right coding style.
Just imagine a world where you can't choose anything. The computer store forces you to buy a Macbook, even though you can't afford one, because the store believes that is the right tool for you. You got to university and the university forces you to take courses they think right for you. You go for buying holiday package and the travel company forces you to choose your destination because they know, based on their experience, what is right for you. Such world without options will be terrible.
So, let the craftsperson choose what works best for his or her work. Don't force anyone to use anything just because you think that is right for them.
If you love Python, you can tell people why you love that language and how using that labguage makes programming fun. After listening to you, people can try Python. If they like the language, they will keep using the language. But going to a PHP thread and then writing limitations about the language or writing bad things about the community is nothing but negative criticism which is bad for everyone.
> PHP doesn't want to become Python or Java or Ruby.
PHP doesn't know what it wants to become. This is part of the problem: for any given question, PHP has multiple answers. That makes code harder to write (which option should I choose here?) and hard to read (this doesn't look anything like my code!) and harder to reason about (how does this feature interact with this other feature?).
> It never intends to have all features taught in programming languages class.
You say this here (and in other comments) as though it were an insult. Is there something wrong with learning? If programming languages are hard to learn then we should make them more accessible, not just throw all the things that make them valuable out the window.
> It will not force you to...
Python does not force any of these things. Nor do Ruby or Perl. It sounds like you like PHP because it's not Java. Surprise: I don't like Java either. Surprise again: that's part of why I don't like PHP. Interfaces, "abstract", private/protected/public, and much of the rest of the OO layer are all clearly inspired by Java.
> Just imagine a world where you can't choose anything.
Who's arguing for this? I imagine a world where the choices are all equally good and you don't get screwed by picking the overpriced underpowered laptop, the underwater basket-weaving class, or the sleazy travel agent.
Third, a group of the Python community (and people from that group who migrated from Python to Go) that bashes other languages and communities at every opportunity deserve such nickname.
It is the venomous Snakes that bite others for no reason.
>There's nothing that PHP is very good at that Python, Ruby, Perl or C# can't do nearly as well. That's why it attracts so much criticism.
PHP does have a very important thing going for it. Its super easy to throw in a PHP script on s cheap webhost. No configuration needed, and if you need database access, there are many libraries that are simply a file drop, and include_once away.
If all you have is FTP, which is basically the fax machine of the internet, then yeah, PHP is easier to "deploy".
For anything more serious you'll need a deployment tool. It's nice that Python (fab) and Ruby (cap) have native deployment platforms with robust command-line tools and version control integration. That, to me, makes them far easier.
This is just a maintenance release. If you want to see what's coming to PHP for the next feature-release version, check the RFC wiki at https://wiki.php.net/rfc
So far, these features will probably make it to version 5.6:
Edit - Checking out that parent link it seems:
Currently variadic functions are implemented by fetching the function arguments using func_get_args(). The following code sample shows an implementation of a variadic function used to prepare and execute a MySQL query (I'll be making use of this example throughout the RFC):
Firstly, by just looking at the function signature public function query($query) you cannot know that this is actually a variadic function. You'd think that the function can only run a normal query and doesn't support bound parameters:
public function query($query, ...$params) { /*...
$userData = $db->query('SELECT * FROM users WHERE id = ?', $userID)->fetch();
When the site is based on and praised for it's "throw everything at the wall and see what sticks" process, you can't complain too much when certain nasty things tend to be fairly sticky.
PHP was picked on because it is too popular?
I dare to say that after some considerations my project is using PHP.
I use python daily, but that does not mean I need hate other languages. All has its places and different projects can have different choices.
Obviously going the "there is/isn't performance gains" flamewar route alone is a conversation nobody would win. So I would through this out there: If you have the capability to move to PHP 5.5, because there aren't performance penalties, you should - if for no other reason than it'll help you stay ahead of the PHP EOL sythe.
You can not make "the most popular language for web development" without attracting a few jealous people and their negativities.
Like it or not, PHP is THE most popular language for developing web applications. And it didn't reach that rank without merits.
Sun pushed Java, Microsoft pushed C#, Google pushed Python in direct and indirect ways (but Google gave up on Python and created Go).
No big company spent a lot of money to push PHP (Yahoo started using PHP when it was already popular). PHP reached there because it had some merits in it.
- PHP is easy to get started and it helps people without CS background to learn it quickly and code apps to solve problems.
- PHP doesn't force you to use OOP unless you need or want that.
A musician named Derek Sivers who had no CS background created CDBaby website after following instructions in a PHP book. When Rails fanboys were making a lot of news, Derek decided to use Rails and scrap the original PHP codes [1]. He hired a top Rails developer and spent a lot of money (compared to the money - i.e. cost of a book on PHP - spent on his original PHP code) to rebuild CDBaby in Rails. The project eventually failed - time and money lost. CDBaby continued to grow rapidly and the site was powered by PHP codes. By telling this story, I am not trying to say Ruby and Rails are hard or bad. Ruby and Rails are tools just like PHP. The point I want to make with this story is PHP can get almost anyone up and running without much difficulties. Many people could get into business easily because of the ease of PHP. Just think if Derek had tried to make his first site using Rails! Probably, we would have never known the story of CDBaby.
I believe, the purpose of a programming language is to make it easy for user (of the language) to create solution instead of trying to prove the greatness (e.g. lot of features) of itself or it's creator.
Why is PHP easy?
PHP is easy because Rasmus Lerdorf didn't have CS background. He didn't want to create a language to have all the features and concepts taught/learn in a CS class of programming languages. Rasmus just wanted to create a tool to easily publish pages dynamically on web.
On the other hand, you can take a look at Java if you want to know how a language looks when the creator has PhD in CS and wants to apply all his knowledge of CS in the language. I am NOT trying to bash Java or Gosling, just trying to explain why some languages are created complex and difficult.
TL;DR: PHP is just a tool like Ruby or C. It has plus and minus points like any other language. PHP makes it easy to get up and running (even if you don't have a degree in CS). If you like PHP (after you try it), stick to it (because with PHP, you can get atleast as big as Facebook). If you don't like it, pick another language that works for you. And this last point is mainly for Snake lovers on HN : never bite a language (or users of that language) because you don't like or use that language.
2007, you know that then he revise him opinion about the ruby/rails.
Some language are better than others. I've work with php for some years. PHP suffers for some serious design. The are A LOT of articles on the internet.
Is so easy to start with php that even a non programming guy will succeed! The same for java/ruby/python/go. When you start is easy and fun. But when you have to use your brain, when you have to do some stuff that are than CRUD then is complicated. And is so fuckin' easy to screw up in php. OMG!
btw, facebook is using php not because is cool, but because of legacy code.
"2007" Yes, Derek wrote the article in 2007 but the facts are still correct.
"then he revise him opinion about the ruby/rails" : Derek didn't revise his opinion (at least I am not aware of that). But I know this. The creators of Rails read the article [1] by Derek. Since, Derek is a popular person on the Internet and he has a lot of followers, his article on his failure to switch to Rails can really make a lot of people stay away from Rails. And this is bad news for the the creators and promoters of Rails. So, the obvious strategy, for the creators of Rails, was to convert Derek into a Rails user to reduce the damage on popularity of Rails caused by Derek's article. So, he was invited to RailsConf. When Derek is invited at RailsConf, do you expect him to talk against Rails at the conf? So, you get the point! Derek can get invited to RailsConf and talk a bit of good things about Rails (and he tried to learn Rails, once more, later), but that doesn't change the original experience he had with Rails when he tried to switch from PHP to Rails. * I don't dislike Rails. I just made an attempt to present the the facts in response to your comment *
"Some language are better than others" : Some language are better than others depending on what you are building.
"PHP suffers for some serious design" : True. So, does any other language. There is no perfect language available on this Earth.
"The are A LOT of articles on the internet" : True. There are many articles that point out problems - Some of them list problems in PHP, some list problems in Rails, some list problems in Python and so on.
"Is so easy to start with php that even a non programming guy will succeed!" : Yes, That is why Derek, without a background in CS, could buy a book on PHP and create first CDBaby site. There are many other examples available on Internet.
"The same for java/ruby/python/go" : I don't deny, because I am not here to talk against any language. If a language works for you, that's great.
"But when you have to use your brain, when you have to do some stuff that are than CRUD then is complicated." : If it is not easy to get started, then you will never reach a point when you will need to use your brain.
"And is so fuckin' easy to screw up in php" : If you don't know how to handle something you can screw up easily with anything. Programming is a skill one acquires over time. It takes time because you learn to avoid the ways that make you screw up. You can screw up easily with any language if you don't know how to use the language.
"facebook is using php not because is cool, but because of legacy code" : Where is the link to source to prove your claim? Facebook has enough money to replace all PHP codes, but instead of replacing PHP they have invested money to improve PHP (HipHop is one example).
I use Erlang in some tasks. Its very cool system but not have some features such in PHP. No OOP and namespaces. PHP stay at important point now and must determinate vector for main moving. I think its may branch to FP and inspired on Erlang. Repeat again its may be branch. But without major types like lists and tuples and pattern matching its not quite...but I dont know. These things make major flower.
* complaints about features it has or has not
* a reference to that "a fractal of bad design" article
* how language x is better
* sarcastic notes about the above
* one guy pointing out we can't have anything involving PHP without the above