What do programmers say about the charm and shortcomings of PHP?

Source: Internet
Author: User
Tags drupal
As a programmer, the following describes the charm and disadvantages of PHP-general Linux technology-Linux programming and kernel information. Editor's note: There are many classical works In the programming field, including Thinking In C ++ and Thinking In Java. They are written by Bruce Eckel, a famous computer science writer. Recently, this programmer contacted the programming languages Java, Perl and Python to analyze the advantages and disadvantages of the classic programming language PHP. Let's take a quick look.

Charm of PHP

When talking about the classic scripting language PHP, we can't help but think of it as an impressive feature, that is, getting started quickly. You can use it to start programming without having to have a deep understanding of the language. Few of the languages we know can fully reflect these characteristics. The opposite is the Java language. Even if you write a simple hello world Program, you need to have a lot of Java knowledge. Running a Web application is not that easy. All of this is a simple task in PHP.

In terms of programming capabilities, PHP only performs better than Perl. Perl is an ancient scripting language. Most of the original Web applications were written in Perl, which is very similar to the C language and flexible to use. It is as convenient and fast as the C language for file operations and processing.

However, due to the flexibility and excessive redundancy Syntax of Perl, the code of many Perl programs is hard to read and maintain. Remember that when the Web was just emerging, when someone says they will use Perl to write large applications, I know they will face failure.

Perl's philosophical thinking is the same thing. There is always more than one way to solve it, resulting in a large number of hard-to-read programs. For a large system, the maintenance cost of Perl writing is relatively higher. In addition, Perl seems to consume a lot of CPU and has some shortcomings in efficiency.

Computer science writer Bruce Eckel

In comparison, PHP has already created some larger applications, such as the famous open-source CMS system Drupal. One of my friends, Nancy niclaisen, said she wanted to build a travel website. I suggest her check Drupal. She listened to my suggestion and finally chose it. After a slight change, she got her website online. In her words, what attracts her in this user community is its power and ease of use.

Moreover, PHP allows beginners to program functions they are interested in without having to spend a lot of time learning programming theories and practices. You only need to write the code and view the effect on the webpage.

PHP Deficiency

But this is also a problem with the language. You will often find many PHP-coded code errors, but these codes are often copied to each other, but no one has to seriously analyze them. These codes are usually written by programmers who are used to copying code from each other. The poor quality of these codes is because these programmers are not used to asking why and do not like to understand the principles, just use it.

When I first wanted to learn more about this language, I wanted to see some examples of File Locking. Although I saw a lot of results, none of them were correct. As it has been proved, PHP is mainly used in combination with databases to handle all consistency issues. Therefore, most people only care about accessing data from databases, you don't have to worry about the underlying problems. However, this language can not only deal with the upper-layer issues of database interaction, but also realize the underlying problems of interaction with file systems. In my opinion, most people in the PHP community only care about how to get a good result, but not many people care about its true implementation principle. Therefore, this kind of error tends to occur.

Later, PHP 5 was introduced, which was greatly improved compared with previous versions, but it mainly added some functions extracted from C ++ and Java, however, some new features are found everywhere, but they do not carefully analyze each added feature and its impact on the language.

In contrast, according to my observations on the Python language over the years, every new feature it has added over the past 10 years has been repeatedly analyzed and elaborated. Time will prove who is right or wrong, or the PHP community will know how to handle these features, but I am deeply skeptical about this.

Recently, I have been using PHP to implement my new site. The key to choosing it is that I only use it for some simple development. For example, PHP allows you to solve very retarded HTML problems. For example, you cannot include files in HTML. PHP can easily achieve this, and make it easy for me to implement my design across the entire site, and sometimes we only need to implement some small things and embed them into the page, PHP is very simple to implement these things.

However, I found that as the complexity of the tasks to be completed increases, a better choice is to use Python, so PHP is more suitable for processing simple tasks.

The Python kernel is very simple and has rich functions. It provides a good foundation for program construction. Combining the advantages of C and C ++, As long as appropriate structures and methods are adopted, the Python program can be expanded infinitely. Of course, it also has its own shortcomings. For example, some friends complain that Python does not support rule expressions as powerful as PHP.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.