This article is from the Why PHP was a ghetto this article translation.
One day I was chatting with the boss of a very good startup company in Dumbo , about why non-PHP developers generally despise PHP and PHP-related communities. He made a point that impressed me, largely because I had never heard of such a statement before.
If you don't know what the majority of programmers will complain about PHP, these complaints will be almost like this:
Ugly grammar
Lack of necessary features in other languages (before version 5.3, no namespaces, closures)
Inconsistent function naming, usage conventions, and other weird things.
Process and object-oriented mixed
Basically, 80-90% 's PHP projects are rotten as a pile of dog poop.
But what he says about PHP is another problem. He did not say there was a problem with the language-he thought it was surrounded by a common cultural phenomenon, a cultural tradition usually created by the creator of language, and now it seems to have encouraged some poor programming practices. That is, it makes PHP code inferior and not maintainable.
It is true that such a language or framework reflects the founders ' philosophical ideas and is respected by the relevant communities. He took out Ruby and its founder Matz as an example. What Matz want is a language that is easy to read and easy to write and that can improve programmer productivity. Don't you see what ruby developers say about rapid development and the elegance of this language?
Then there is dhh and his rails framework. and Guido and his Python language. So I was thinking:Rasmus for PHP?
Rasmus Lerdorf the impression of a very interesting person. He created the original version of the PHP language, and has been improving the language, he is worshipped as a god in the PHP community, he has the greatest authority in any aspect of PHP. He was invited by numerous conferences to make speeches, and was hired by a large network company (Yahoo.com), who gained the respect of everyone-despite the fact that he became the representative of most non-PHP programmers who despised many of the problems in PHP.
Rasmus advocates avoiding the use of frames and using PHP more as a template language. For him, this approach can produce direct operational efficiencies and scalability (the program load is knowable). For everyone else, this has resulted in a lot of simmering procedural code and a large number of items that cannot be maintained. Since 1995, PHP has been born around 10 years, all of the PHP projects are written in accordance with this guidance.
At the same time another problem popped up: Before PHP5.0, PHP gained a lot of novice followers. The entry threshold for this language is surprisingly low, and anyone can download the self-extracting xamp Windows Installer package and use the language in 2 two minutes. In addition, the consensus on the MVC pattern in Web Development mode was not really there. So you can imagine what a group of novices and a language with a lack of good development practices can combine to create? A heap of rubbish that cannot be maintained. And the whole environment is like this.
Don't get me wrong-good PHP developers are still a lot, even then. But, as I said, shoddy rookie work is everywhere. When cowboy-style, unconstrained PHP programmers gather together to develop programs without guidelines, the phpBB, Phpnuke, and many rough. PHP3 packages appear. But can you simply blame the PHP developers? No! Other Web language giants, ASP and Perl, also have a reputation for being a stew-style development.
So that's why PHP gets this kind of infamy. is because of its historical spread. Most PHP developers who have turned to Python,ruby and Java have not turned back to rethink the language as the MVC concept arose. In addition, there are some explicit ironies like "Ruby Childe" Zed Shaw, who complain about the idea of some programmers "being poisoned by PHP", which is rife with rubyinside .
PHP is a concentration camp.
But the advent of frameworks such as Zend and CodeIgniter has pushed this language in the right direction of development. In fact, it pushes PHP in the opposite direction that Rasmus wants to see. Look at the Zend and CodeIgniter frameworks, and you'll find that they're a very good program with very few documents written and code written.
Most developers who have studied Ruby also learn rails and MVC knowledge; PHP has been in use for 10 years. For those beginners, The hateful Ruby doesn't give them the time to let them play free. Rails has standard guidance in place, and it has a relatively high entry threshold, often blocking some inexperienced developers from the door.
In fact, PHP applications can be written in the same way as other languages, and also have some advantage in running speed. The development of MVC style in the PHP world is only a phenomenon that has arisen in recent years. Admittedly, we should be thankful for the change that rails brings.
So what does PHP look like today?
Various standards (not uniform, but most projects use MVC, very few garbage-like procedural procedures)
Very low threshold for entry
Speed and Scalability (PHP should be the best in a variety of scripting languages)
Have a good unit test framework
Have the best translation documents in various languages
In addition, most influential websites on the internet use PHP as their background language or tool, such as Facebook,digg, Wikipedia, Wordpress,drupal, and so on. I believe that having a deep grasp of PHP will enable a programmer to open more doors to unknown fields.
If you disagree with the above, please leave a comment or email to me-I want to hear why you don't think so.
In fact, I am not a PHP fan, I do not feel the language. I used PHP mostly because--you guessed--someone was willing to pay me. So it's all attributed to this:
If you want to make informed decisions about software design, PHP is the best choice for you to develop Web applications.
By the way, if you're sure you want to use PHP to develop the next Web application, try CodeIgniter. It's a lightweight, generic, super fast PHP framework. For CodeIgniter, I'm a fan.