This article is translated from WhyPHPWasaGhetto. One day I chatted with the boss of a great startup company in DUMBO about why non-PHP developers generally despise PHP and related communities. He raised a point that impressed me very much. This article is translated from the Why PHP Was a Ghetto article.
One day I chatted with the boss of a great startup company in DUMBO about why non-PHP developers generally despise PHP and related communities. He put forward a point of view that impressed me a lot because he had never heard of it before.
If you don't know what kind of complaints most programmers will give to PHP, these complaints will be like this:
Ugly syntax
Lack of features required by other languages (no namespaces or closures before version 5.3)
Inconsistent function naming, usage conventions, and other weird things
Process and object-oriented obfuscation
Basically, 80-90% of PHP projects are a bunch of shit.
But what he said about PHP is another problem. He didn't say that this language is a problem-he believes that this language is surrounded by a common cultural phenomenon and is a cultural tradition created by the creators of the language, it seems that this has encouraged some bad programming practices. That is, it makes PHP code inferior and not maintainable.
This kind of language or framework reflects the founder's philosophy and is promoted by relevant communities. He used Ruby and its founder Matz as an example. Matz wants a language that is easy to read and write and can improve the efficiency of programmers. Didn't you see Ruby developers say they must be quick development and the elegance of this language?
The next step is DHH and his Rails framework. There are also Guido and his Python language. So I was wondering: What about Rasmus for PHP?
Rasmus Lerdorf is very interesting. He created the first version of PHP language and has been improving it. he worships it like a god in the PHP community, and he has the greatest authority in any aspect of PHP. He was invited to give a speech at numerous meetings and hired by yahoo.com. he was respected by everyone-despite the fact that: he has become an image of many problems on PHP that most non-PHP programmers despise.
Rasmus advocates avoiding the use of frameworks and treats PHP as a template language. For him, this approach can generate direct operation efficiency and scalability (known as program load ). For others, this approach leads to a large number of process-like code and a large number of projects that cannot be maintained. In the past 10 years or so since the birth of PHP in 1995, all PHP projects have been written in accordance with this guidance.
At the same time, another problem suddenly emerged: before PHP5.0, PHP gained a lot of new followers in the early stages of PHP. The entry threshold for this language is surprisingly low. anyone can download the self-decompressed × AMP Windows program installation package and use this language within two minutes. In addition, at that time, the consensus on the MVC model in Web development did not really appear. In this way, you can imagine what a group of new users can create together with a language that lacks good development practices? A pile of garbage that cannot be maintained. The overall environment is like this.
Don't misunderstand me-there are still a lot of excellent PHP developers, even at the time. However, as I said, the shoddy Cainiao works are everywhere. When a cowboy PHP programmer has no guiding principles to develop a program together, like PHPbb, PHPNuke, and many rough. php3 packages. But can you simply blame PHP developers? No! Other Web language giants, ASP and Perl, are equally notorious. they also promote a method of development in the form of stew.
That's why PHP gets such a nickname. It is because of its history. Most PHP developers who have switched to Python, Ruby, and Java have not come back to rethink the language when the MVC concept arises. In addition, there are some explicit and ironic comments like "Ruby parse" Zed Shaw complained about the ideas of some programmers "being poisoned by PHP". such comments are prevalent on RubyInside.
PHP is a concentration camp
However, the emergence of frameworks such as Zend and CodeIgniter pushes the language to the correct development direction. In fact, it pushed PHP to the opposite direction as Rasmus expected. Check the Zend and CodeIgniter frameworks and you will find that they are a few well-written documents and programs with good code writing.
Most developers who have learned Ruby need to learn Rails and MVC knowledge at the same time. PHP has been used for 10 years before. For those new users, the hateful Ruby didn't give them time to play freely. Rails has ready-made standard guidance, which has a relatively high entry threshold and usually blocks experienced developers.
In fact, PHP applications can be well written as other languages, and they also have a certain speed advantage. The rise of MVC-style development methods in the PHP world has only occurred in recent years. I have to admit that we should thank Rails for this change.
So what is PHP today?
Various standards (non-uniform, but most projects use MVC, with few junk procedural programs)
Low entry threshold
Speed and scalability (PHP should be the best in various scripting languages)
There is a good unit test framework
Documents with the best language translation in different countries
In addition, most influential websites on the Internet use PHP as their background language or tool, such as Facebook, Digg, Wikipedia, Wordpress, and Drupal. I believe that an in-depth understanding of PHP will open a programmer's door to more unknown fields.
If you do not agree with the above, leave a comment or email to me-I want to hear why you do not think so.
In fact, I am not a fan of PHP, and I don't feel the language. I use PHP mostly because-you guessed it-someone is willing to pay for me. So all blame is on this:
If you want to make informed decisions on software design, PHP is the best choice for developing Web applications.
By the way, if you are sure you want to use PHP to develop the next Web application, try CodeIgniter. It is a lightweight, common, and super fast PHP framework. I am a fan of CodeIgniter.