Are you expecting it? --- View PHP from ZendEngine2.0 design blueprint (draft)

Source: Internet
Author: User
Tags fast web
ZendEngine is the core of PHP syntax interpretation. its development and changes will inevitably greatly affect PHP's language features and execution features. ZendEngine2.0 has not yet been launched in public expectations, but some PHP future looks can be inferred from its release of the future blueprint (draft. First of all, some miscellaneous are the original intention of this article. I have learned that Zend Engine for ZendEngine2.0 is the core of the syntax interpretation of PHP language. its development and changes will inevitably greatly affect the language features and execution features of PHP. Zend Engine 2.0 has not yet been released in public expectations, but some PHP future looks can be inferred from its release of the future blueprint (draft.
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 (now you can download it from the reference URL ), 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 (draft) for Zend Engine 2.0)
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 --

Key to the problem-what do we expect PHP to 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?

What exactly -- not too much hope
From the design blueprint of Zend Engine 2.0, it seems that the creation maintainers of PHP have chosen the next policy-almost rewrite the object-oriented model of the interpretation Engine to enhance the object-oriented feature of the language. I personally think there are some reasons for this choice:

PHP seems to have done a good job in adapting to fast web programming, based on the existing language architecture, it is impossible to make too much changes in this aspect (only modifications, additions and deletions of some core functions, and step-by-step addition of more extension function libraries ), PHP must develop ...... J
Most people are aware of the limitations of PHP, and its creation maintainers are more clear-if PHP can be paid attention to in enterprise-level applications, that would be a bigger victory (for open-source software advocates, it may be more meaningful ). The shortcut to improving its competitiveness in this field may be the content presented in the Zend Engine 2.0 design blueprint-adding a new object-oriented model for this process-oriented language to the traditional language, this allows developers to easily adopt object-oriented programming methods.



However, it is a pity that there are still too many PHP attempts to enter the enterprise-level computing field-there is not enough commercial support, A large number of expansion modules are in the experimental stage, and some of them need to be used to take responsibility for enterprise-level applications, and lack of planning and support for system architecture, perhaps the most important thing is whether the idea of the business community can accept open source rather than commercial-supported programming languages to build the entire business system (however, Linux applications seem to be showing bright prospects, but it is only the prospect ). Even optimistic PHP supporters (like myself) are skeptical about using PHP in enterprise-level computing-even after Zend Engine 2.0 was launched, as stated in the design blueprint.

Therefore, I do not have much hope for the new version of PHP using Zend Engine 2.0:

Its application lies in the rapid web programming environment, such as the Internet site. it is very careful to choose PHP as the main supporting language for building key commercial systems.
Although Zend Engine 2.0 focuses on strengthening the object-oriented feature (maybe the creation and maintenance personnel of PHP will strongly advocate using them), for most existing PHP developers, writing PHP programs in the current process-oriented style will not be affected (Zend Engine 2.0 is also very considerate to consider the problem of backward compatibility)-that is to say, on the surface, PHP is more powerful because it is given the object-oriented features. In fact, Zend Engine 2.0 and 1.0 are used by most developers (supporting the interpretation Engine of PHP 4) PHP is no different.



Of course there are some areas worth looking forward:

The rapid web programming environment also requires good modeling. object-oriented design and implementation are much better than process-oriented or page-oriented methods. Some PHP developers (including the creation maintainers of PHP) are already advocating the use of language object-oriented features (PEAR is a good example ), zend Engine 2.0 will bring them the gospel-a better object-oriented model, object-oriented design and implementation can be almost unrestricted (currently, PHP cannot do this because of its extremely incomplete object-oriented support ); at the same time, the object performance can be improved.
The introduction of the violation handling mechanism will have a positive impact on PHP projects, which can effectively improve code efficiency and encourage proper error handling.
The improved object-oriented model of Zend Engine 2.0 makes it more convenient and reasonable for PHP to call external components (such as COM and Java Bean) and improves the efficiency. This improvement may increase the possibility of using PHP as a front-end for heterogeneous systems (such as systems developed using Java) (the domestic mini J2EE project is a typical example of this ).



Suggestions for PHP developers
First, you don't need to worry about the future of PHP-your development skills are still applicable and work well in the new version (this reminds me of Microsoft. the embarrassing position of Visual Basic in. net -- PHP won't ). Even if you do not know anything about object orientation, you can develop it in the traditional way (also the technology introduced in most books on PHP development on the market.

Second, if you are interested in PHP's object-oriented features, or you have actively explored the features, in the future, PHP will be more suitable for your taste-you can use the object-oriented method for project analysis, and then use PHP to easily implement your design. There may also be some modeling tools for PHP (maybe adding features to existing tools, maybe another contribution to the development source code community) it is more conducive to PHP's object-oriented design and coding. However, for such developers, the key to note is that you are not limited to the PHP world. what suits your needs may be more object-oriented C ++ or Java; maybe PHP is the most familiar to you, but C ++ or Java is more powerful.

Again, it is for PHP developers who are "getting interested" (I am referring to PHP developers who are affected by the useless argument ), most of the arguments that blame PHP are focused on whether it is more scalable, that is, whether it is suitable for building enterprise-level systems. if you give up PHP for this purpose, then the above points are as follows, in the future, PHP may rarely become a programming language that can challenge Microsoft and Sun products-in this sense, your choice may be correct.

Finally, for developers preparing to access PHP, both existing PHP and future PHP are at least very suitable for rapid web development-but for the same reason, if you are looking for a "heavyweight" programming language that can support a complete commercial system, consider PHP carefully, even if future versions will greatly enhance the popular object-oriented feature.


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.