Home >Backend Development >PHP Tutorial >Why is PHP a ghetto?

Why is PHP a ghetto?

WBOY
WBOYOriginal
2016-07-25 08:49:00951browse
Talking about why developers outside of the PHP community generally look down upon PHP and PHP-related communities. He made a point that stuck with me, largely because I had never heard it made like this before.
If you don’t know what complaints most programmers have about PHP, then these complaints would go something like this:
Ugly syntax
Lacks some necessary features that other languages ​​have (before version 5.3) , no namespaces, closures)
Inconsistent function naming, usage conventions, and other weird stuff
Mixing of procedural and object-oriented
Basically 80-90% of PHP projects are shit
But the problem with PHP development he mentioned is another problem. He doesn't say there's something wrong with the language - he thinks the language is surrounded by a common cultural phenomenon, a cultural tradition usually created by the creators of the language, which now seems to be responsible for some bad programming practices. The method played an encouraging role. That is, it makes PHP code inferior and unmaintainable.
This phenomenon of a language or framework that embodies the founder’s philosophical thoughts and is highly praised by the relevant community does exist. He cited Ruby and its founder Matz as examples. What Matz wanted was a language that was easy to read and write and could improve programmers' work efficiency. Don’t you see how Ruby developers talk about rapid development and the elegance of the language?
Then there is DHH and his Rails framework. And Guido and his Python language. So I was thinking: What about Rasmus for PHP?
Rasmus Lerdorf makes a very interesting impression. He created the original version of the PHP language and continues to improve the language. He is worshiped like a god in the PHP community and enjoys the greatest authority in any aspect of PHP. He was invited to speak at numerous conferences and was hired by major Internet companies, and he gained the respect of everyone - despite the fact that he became the PHP guru that most non-PHP programmers despised. A visual representation of many problems.
Rasmus advocates avoiding the use of frameworks and treating PHP more as a template language. To him, this approach yields direct operational efficiency and scalability (the program load is known). For everyone else, this approach resulted in a massive stew of procedural code and unmaintainable projects. In the roughly 10 years since PHP was born in 1995, all PHP projects have been written according to this guidance.
At the same time, another problem suddenly appeared: before PHP5.0, in the early days of PHP, PHP gained a large number of novice followers. The barrier to entry for this language is surprisingly low. Anyone can download the self-extracting ×AMP Windows program installation package and start using the language within 2 minutes. In addition, at that time, there was no real consensus on the MVC pattern in web development methods. So you can imagine what a group of novices can create when they come together with a language that lacks good development practices. An unmaintainable pile of garbage. And the entire environment is like this.
Don’t get me wrong - there were still a lot of good PHP developers, even back then. But, like I said, shoddy rookie work is everywhere. When cowboy-style PHP programmers got together to develop programs without guidelines, the likes of PHPbb, PHPNuke, and many crude .php3 packages emerged. But can you simply blame PHP developers? cannot! Other Web language giants, ASP and Perl, are equally notorious and promote a stew-style development approach.
So this is why PHP gets such a bad rap. It's because of its historical spread. Most PHP developers who had already moved to Python, Ruby, and Java did not go back and rethink the language when the MVC concept emerged. In addition, there are some explicit satires like "Ruby boy" Zed Shaw complaining that some programmers' minds are "poisoned by PHP". Comments like this are very popular on RubyInside.
PHP is a ghetto
But the emergence of frameworks like Zend and CodeIgniter has pushed the language in the right development direction. In fact, it pushed PHP in the opposite direction from what Rasmus wanted to see. Take a look at the Zend and CodeIgniter frameworks, and you will find that they are one of the few programs with well-documented and well-written code.
Most developers who learn Ruby also learn Rails and MVC knowledge; PHP has been used for a full 10 years before this. Damn Ruby for not giving them this time to play freely. Rails has ready-made standard guidance, and its entry barrier is relatively high, which usually blocks out some inexperienced developers.
In fact, PHP applications can be written as well as other languages, and they will also have certain advantages in running speed. The rise of the MVC-style development method in the PHP world has only appeared in recent years. We have to admit that we should be grateful to Rails for bringing this change.
So, what is PHP like now?
Various standards (not unified, but most projects use MVC, and there are few junk procedural programs)
Very low entry barrier
Speed ​​and scalability (among various scripting languages, PHP should be the best The best)
Have a good unit testing framework
Have the best documents translated in various languages
In addition, most influential websites on the Internet use PHP as their backend language or tool, Such as Facebook, Digg, Wikipedia, WordPress, Drupal, etc. I believe that having an in-depth mastery of PHP will open up more doors for a programmer to unknown areas.
If you don’t agree with what’s said above, please leave a comment or email me – I’d like to hear why you don’t think so.
In fact, I am not a PHP fan, I have no feeling for the language. I mostly use PHP because - you guessed it - someone is willing to pay me. So blame it all on this:
If you want to make informed decisions on software design, PHP is your best choice for developing web applications.
By the way, if you are convinced that you want to use PHP to develop your next web application, please give CodeIgniter a try. It is a lightweight, plain and super fast PHP framework. I'm a fan of CodeIgniter.
Receive LAMP Brothers’ original PHP tutorial CD/"Essential PHP in Details" for free. For details, please contact the official website customer service: http://www.lampbrother.net
PHPCMSSecondary development http: //yun.itxdl.cn/online/phpcms/index.php?u=5
WeChat development                                                                    
Mobile Internet Server Side Development http://yun.itxdl.cn/online/server/index.php?u=5
JavascriptCourse http:// yun.itxdl.cn/online/js/index.php?u=5
CTOTraining Camp                                                                                             5

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn