Looking at the future of PHP from the design blueprint of Zend Engine 2.0 (1)

Source: Internet
Author: User
Tags fast web

Some Miscellaneous

The first is the original intention of writing this article. I have obtained the design blueprint document for Zend Engine 2.0 for some time, after reading this article, I had the urge to write a comment-because the next generation of PHP will be a language better suited to the existing object-oriented development habits, at least it is given more object-oriented features. However, the question that arises is, Is it worthwhile for PHP, such a language with the initial goal of rapid Web development, to be fully qualified? This question seems to need some comments to discuss, and I am very willing to put forward my own point of view. However, after some busy things, the impulse was moved back to his stomach a little bit, and I remembered it some time ago. So I read the design blueprint document several times and read this article. (When I first got this English document, I still had the intention to translate this design blueprint document into Chinese, but considering that it was not the final blueprint, second, everyone should cultivate the habit of Directly Reading the original text. Third, translation always inevitably brings some obscure places. However, when writing this article, I decided to translate the article "adventure" once. If you cannot reach your purpose accurately, please correct it .)

The second is the explanation of the focus of this article-in this comment, I will mainly comment on the object-oriented features that will be greatly enhanced in PHP in the future. If you are a PHP developer, I guess you should understand some object-oriented features in PHP; however, PHP is generally used in an "extremely fast development environment" (this is a word I made myself, indicating the development of customer-oriented websites, it is characterized by a very short schedule and unclear customer requirements), so there are not many developers and development projects that really use the Object Features in large quantities. In addition, the current PHP Object Model is inferior to C ++ and Java, and limits the use of this feature. However, in future PHP versions, the focus of the modification is on the object-oriented model in the language, which improves many of the bad features in the current version and adds other features. Therefore, the future of PHP is focused on the object-oriented features of PHP.

Well, let's get to the point and look at the new features of Zend Engine 2.0.

Design blueprint for Zend Engine 2.0(Draft)

From the design blueprint (draft), we can clearly see that the next generation Zend Engine is based on the new object-oriented model. If you have used the object-oriented features of PHP 4, it may feel awkward while finding a little bit of Java or C ++-not only the lack of object-oriented syntax, and sometimes unexpected running results-all of this is caused by a less elegant object-oriented model in the existing Zend Engine 1.0 that supports PHP 4.

To put it simply, the next generation of Zend Engine will move closer to Java and draw a lot from its object-oriented model. The improved features can be divided into three types: the first type is the improvement and enhancement of the existing object-oriented model, including the definition of the builder and the destructor, added object-oriented features such as private member variables, static member variables, multi-inheritance, and overload. The second type is modification and Addition and deletion of control processes, for example, a try/catch/throw violation handling mechanism is added; the third type is about Function Modification and addition/deletion, for example, adding a function to the string offset. (For details about each type of improvement, see the documents listed in references .) From this we can see that through the first and second types of improvement, PHP is gradually improving itself into a language with object-oriented features.

However, the problem arises exactly here:

In a positive aspect, today's programming world welcomes languages with object-oriented features (even though the language itself is not built on the object-oriented basis, you can also add defined objects to prevent the language from falling behind the trend.) -- in this sense, zend Engine 2.0 makes PHP's support for object-oriented development more consistent with the development trend of programming languages, when building enterprise-level applications (which is often accused of PHP today), using object-oriented modeling and implementation is already a de facto standard, this improvement of PHP may cater to this need and solve the weakness of the language itself in this aspect.

In the negative aspect, it seems meaningless to provide developers with a new version of PHP that is more similar to Java. The reason why PHP is widely used is that, apart from the open source code and cross-platform programming, it is also important to adapt to the simple and fast web programming features built on the internet site. Extremely short learning time, friendly language style (especially if you are familiar with C), and a large number of extended class library functions are enough to prove its strength; however, if we transform the next version of such a language into an object-oriented language, it will not only make a large number of original developers at a loss in a short time, and it is not conducive to attracting new developers to join. Since there is a language like Java, why should we study PHP?

The above are some of my "objective" analysis-the so-called "objective", which is to disguise myself as a loyal supporter of Zend Engine 2.0 when writing positive information; when writing negative information, it is the opposite (I hope you will feel objective after reading my analysis ). However, "objective" is actually only used to pave the way for my "subjective" argument --

What Will PHP look like in the future?

In fact, the key to the problem may be the direction in which PHP will be expected, or the field in which PHP will be committed.

The reason why PHP is so popular, especially when there is almost no commercial support (Zend currently provides support for PHP, but it is really insignificant compared with Microsoft and Sun .) It becomes a programming language that can compete with ASP and JSP, because it is completely oriented to a realistic and fast web programming environment. This situation can be clearly seen in many PHP tutorials-to implement some common web functions, using PHP often means less code and complexity; at the same time, for programming in a specific field, PHP also has extended module functions available (although there is no commercial support, PHP has the support of a large number of open-source software advocates, they not only contributed to the generation and development of PHP, but also provided various extension module functions .), In this way, more immediately available and free function libraries mean less workload for developers. All you need to do is read the function manual and use them properly. PHP competitors seem to be somewhat "Knowledgeable"-inflexible and rigorous. Maybe the products of large commercial companies are less convenient to use than hackers are.

However, in order to adapt to the real rapid web programming environment, PHP gave up some things when focusing on ease of use: for example, the developer's own module writing and encapsulation (non-source code level ), and object-oriented features (the existing version only does not fully support some of the features)-but what these PHP lacks is what their competitors possess (for example, ASP can communicate with COM components, JSP can easily use Java Bean. JSP is originated from Java, a fully object-oriented language, and so on. Therefore, PHP is usually excluded from the candidate list for building enterprise-level applications.

The core of the problem is already clear-the current development of PHP has encountered a cross-cutting road: Continue to give full play to the characteristics of your fast web programming language, or is it possible to complete and modify itself into a programming language that meets the needs of a serious business environment?1

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.