Home >headlines >PHP is killing Python!

PHP is killing Python!

藏色散人
藏色散人forward
2022-01-26 09:50:553244browse

Under the impact of popular culture, many people may not agree with the views expressed in this article, but I decided to go against the current again. I think that despite PHP being looked down upon, this programming language is more popular than ever!

Why? How come PHP isn’t dead yet? Aren’t there so many better programming languages ​​than PHP?

No, not really. If such a language existed, they would have taken the lead in killing PHP long ago. We need to re-examine what a "better" programming language is.

Why isn’t PHP dead? If you're confused, it's probably because you don't understand programming, programmers, markets, and democracy. In fact, this has nothing to do with code, functions, or syntax.

It has become fashionable to criticize PHP

Nowadays, in order to become popular in the programming circle, you must criticize and "mainstream culture" A competing programming language. It has nothing to do with the function of language itself, it's just because of culture, a bit like religion.

Programmers are a bunch of opinionated people and very arrogant, but we must overcome these shortcomings. We love to bash programming languages ​​we don't like and don't use. You'll find some engineers who say Java sucks, some who say C# sucks, and some who say Go sucks. It doesn't matter what language it is, there will always be criticism.

In addition, there is a deeper contempt. In recent days, there has been a silent battle between PHP and Python. It seems that the academic community is planning a conspiracy: kill PHP and replace it with Python.

Nowadays, you will even find that in some Wikipedia pages, the P in the LAMP technology stack magically becomes Python. Twenty years ago, when I was using LAMP, these letters referred to Linux, Apache, MySQL, and PHP. The P at that time referred to PHP, not Python, or even Perl. I'm not saying these definitions can't change. Maybe I'm too suspicious? Not inclusive enough? Still saying that Python occupies the position of PHP?

For most of us, we learned Python in college, as well as other niche languages ​​​​that may never be used in actual work. Although our teachers or other noobs will say: "PHP sucks", maybe most of them have never written a line of PHP code.

In fact, you might even wonder if anyone actually does PHP programming professionally. The general public's disdain for PHP is actually illogical and not genuine. However, when chatting with friends in a cafe, we are used to despising certain celebrities, Internet celebrities or PHP together.

Also, there are programming purists who are willing to waste their precious time nitpicking and discussing how PHP sucks. Most of these arguments revolve around personal preferences, or nuances that they don't like, in order to promote their favorite programming language and hope that these languages ​​will dominate the world!

Their complaints are endless:

  • PHP has weak types and a lot of bad code.

Why not Javascript and Node.js? Aren't you using it the same way?

  • PHP has too many functions.

Some people complain about this, is it because it is too convenient?

  • The function names are inconsistent.

Such problems will arise when a language is truly democratized and is not written by any "expert master" alone.

It can be seen that their criticism of PHP usually stems from personal preferences, or just nitpicking. If we say that, we can find the same fault with Python, C#, Java, Go, Javascript or any other language. As programmers, we like to complain and complain.

But the real reason why we, as programmers, love to bash PHP is because of our inherent arrogance and naked jealousy.

PHP is easier to use

PHP was born in the mid-90s, before some of us were even born. I started using PHP in the early 2000s, when the version was transitioning from 4 to 5, and then I started using CodeIgniter, ZendFramework, and writing applications in my own framework.

I think the reason for PHP's longevity, and the main reason why this language will not die, is that it is not only embedded in all kinds of new and old applications, but also embedded in the minds of new and old programmers. They've been using PHP for decades. We're not going away, and neither is the business code we write.

Interestingly, Python was born in 1991, when PHP had not yet appeared. Although Python lived longer, its adoption failed to reach the level that PHP does today.

Why?

In my personal opinion, Python is a pain to use compared to PHP. This problem has been alleviated in Python 3, but 15 years ago, Python did not have a variety of "bells and whistles" functions out of the box, far less than PHP. You have to install many features manually.

In addition, I found that there is another problem with Pyhon, and this problem continues to this day, that is, spaces. I hate syntax that uses spaces as delimiters. I want to separate my code the way I want, and I don't want the programming language to get in the way. No matter how much you talk about it, the code is mine, I can write it however I want, no one can control it.

Python has always boasted that its space syntax is "easy to read," but this is just marketing talk. I personally think that Python uses the worst syntax and doesn't even know it.

This self-righteous syntax can easily introduce errors. Initially, before the IDE could address all these issues, I believe no programmer liked this syntax. At least I personally don't like it. This is part of the reason why the language's adoption has been sluggish for decades. In fact, it is because this syntax is not user-friendly enough.

Also, I don’t think people knew Python existed in the early years. It is embedded into Linux distributions as a scripting language and that is its main purpose. No one will run out and shout: "I can build websites with Python!"

In fact, although we can use Python to build websites, good engineers all know that Python's strength is not building websites. My personal preference for syntax aside, Python is functionally a very powerful language, especially its libraries that can be used in data science or other places where the emphasis is on mathematical computations where precision is a must-have requirement .

PHP is a language that anyone can use

I agree that in the past 15 years, Python has introduced many updates and surpassed PHP, but these updates are ten years late.

Python 3, released in 2008, actually broke backwards compatibility. Python 2 code will not run with Python 3 and you will need to make certain modifications. But if you have a million lines of code that need to be updated, that's a no-brainer, especially in an enterprise environment.

To be fair, PHP 7 and 8 also broke some PHP5 code (no PHP 6). I'm part of the ZendFramework 1 community, which helps update the framework for running on PHP 7 and 8. Fortunately, my enterprise legacy code suffered very little damage when upgrading ZF1 to PHP 7 and 8. Therefore, most PHP 5.6 code remains backwards compatible.

But perhaps the event that really helped PHP become a hit was a small startup called Automattic that was founded in 2005.

WordPress had humble beginnings, but it changed not only developers, but the way ordinary people publish websites.

By far the best publishing options are Drupal, Joomla or some other BBS software. But these software are painful to use because the people who write them think more like programmers than ordinary users.

If WordPress was written in Python, then maybe PHP would really go downhill. But I dare say that Python will hinder the rapid rise of WordPress, or even prevent it completely.

Adoption and extended contributor support will be critical to the survival of a language or application in the open source market. And ease of use is key to spurring rapid adoption.

As a college-educated software engineer, no matter how much you denigrate PHP, you cannot deny that PHP is favored not only by professional software engineers, but also by part-time workers, housewives, graphic designers, and company managers. , entrepreneurs and primary school students can use computers to write web pages.

It can be said that PHP is the BASIC (language) of the information age.

As a software engineer, you must think like a software engineer, not someone who just wants to use limited time and resources to build a website for their small business.

And WordPress and PHP changed all that.

WordPress itself is easy to use, but its functionality is limited. Ordinary people can take advantage of WordPress' plugin architecture and write tiny snippets of PHP code, and they don't need to rewrite entire classes or become software engineers to do this.

Millions of amateur programmers use WordPress to share their successes with others around the web and grow the platform.

The easy-to-understand PHP language allows ordinary people to write effective code. Simple, no special requirements, weak type, no need to compile, it can run.

PHP and the Internet

Today, 15 years later, PHP powers 78% of the Web. WordPress alone accounts for nearly 40% of all websites and holds nearly 2/3 of the CMS market share! The point is that Python wants to capture 10% of these markets! Despite the hatred of PHP by Python purists, Python accounts for less than 1.5% of the web.

I have been contacted by recruiters from corporate clients who want to remove all Python web code and replace it with PHP. You may be shocked, but this should happen more often. Why? Because let’s be honest, the web is not Python’s main battlefield. Python’s main users are data science and other experts, and talent with experience in this area is in short supply.

Often companies need to be flexible. When the time comes to expand the team or someone leaves, they can't spend weeks or months looking for new Python people. And Python engineers are expensive.

For small businesses, it is much easier to find PHP programmers, and they can even be trained if necessary. The point is that you can find senior PHP architects with decades of experience much easier than you can find Python equivalents.

The point is, if you work for a company and want to write web pages or middleware in Python without a valid reason, you will be blamed. Because companies will be saddled with Python code for this, they will need to spend huge sums of money in the future to remove this code and replace it with the right tools.

The first job of the application architect is to choose the most effective technology based on the actual situation of the enterprise. You cannot choose a language based on your own preferences just because it is very popular online or because it is taught in school.

There are very few situations where I would recommend writing a SaaS application entirely in Python, and given Python's web market share, it seems like most application architects will choose the right language. They'll choose Python for what Python does best, and PHP for what it's best at.

Summary

As engineers, we all like to use languages ​​we are familiar with, and we like to turn our noses up at technologies we are not familiar with.

Various universities are trying to use Python as a general business language. But in fact, Python is more suitable for running servers, data science, processing large and complex numbers, and even cryptocurrency mining.

And PHP is the language of the masses, it has become the de facto language of the Internet.

So, if you like, you can continue to bash PHP and continue to despise it. Regardless, PHP is still by far the most widely used language on the web, and with the continued meteoric growth of WordPress and the new speeds of PHP 7 and 8, that status isn’t going to change anytime soon.

Reference link:

https://beau-beauchamp.medium.com/php-is-killing-python-2be459364284

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete