The Battle of Knives: PHP vs. ASP. NET (excerpt)-Architecture comparison _ Practical Tips

Source: Internet
Author: User
Tags php and php framework php script web services zend
Author: Robert Lair and Jason Lefebvr Intensity Software, Inc.

Translation: Easychen exlcsoft.com

Overview

An ongoing debate in the development community is which platform in PHP and ASP is more suitable for web development. The controversy has entered a new era as a result of the huge changes brought about by Microsoft's asp.net. Compared with ASP 3.0, ASP. NET uses the brand-new design, has many new features and the merit. What effect will asp.net have on the debate between PHP and ASP? This article will provide you with relevant information on the answer to this question.

Schema comparisons

Php

PHP4.0 is centered on Zend Technologies's open Source Engine Zend engine. When the user's browser makes a request to a Web server implemented by PHP, the request is passed to Zend Engine, which compiles the PHP script. If the compilation is successful, the compiled code is passed to the Zend Engine Executor that generated the final HTML code to be sent to the client. From a developer's perspective, the PHP 4.0 framework has both advantages and disadvantages.

Because PHP is open source, it is supported by many different platforms and Web servers. Although larger than the previous PHP engine, Zend engine is still lightweight and robust. As an extension, PHP also supports object-oriented, allowing users to build their own classes and objects. However, for some reason, PHP is not a real object-oriented development environment. One of the best examples is the scope of class member functions and properties. In PHP, all variables in a class can be read and written from the outside, which makes the implementation of the class impossible to hide.

In addition, PHP is not a strongly typed language (that is, if you compare characters 4 to integer 4, the result is the same), which poses problems when architecting large programs and makes debugging of the program difficult. Making debugging more difficult is that you don't even need to declare a variable, which is like an ASP that turns off the explicit option. If PHP encounters a new variable in the script, it will only create it silently.

While the flexibility of a relaxed PHP framework is considered, it is likely that each developer will spend hours in some cases addressing bugs that are caused by this feature. Objects are language-level variables in PHP. They are largely treated as simple variable types. (Just like an integer and a character variable) the entire object is copied when an operation such as a variable assignment and an object is passed as a parameter to a function. This will lead to inefficiency. In addition, unpredictable run-time behavior can occur frequently.

PHP lacks some of the key elements that many other large modern development frameworks have. One of the most important is structured exception capture. Although it is possible to register an error handler for process errors, it is not convenient for the language itself. Because of the absence of the "Try ... catch" error capture, many PHP developers have completely forgotten the error capture or use in a very narrow range.

asp.net

Asp. The core of net is Microsoft. NET Framework. This framework provides common language runtime (CLR) and class libraries, ASP. NET is built on top of this.

When the ASP.net resource is first requested, the high-level language code (like Microsoft Visual basic®.net or C #) is compiled into Microsoft intermediate Language (MSIL) codes. This code will run by the CLR to generate machine code for Web services.

Asp. NET forces developers to use a real object-oriented approach to programming. All objects are real OO objects that support the attributes of inheritance, polymorphism (method overload), and encapsulation.

In addition, ASP. All languages in net are strongly typed. For example, to compare integers 4 and 4, you need to first convert the variable to an integral type, and vice versa.

Asp. NET uses event-driven programming models, which means that snippets are linked by events that might occur while the program is running.

For example, the Page_Load () event in the ASP.net page places the code that will run when the browser reads the Web form. There are many additional events associated with ASP.net Page object, and developers can execute code at any time during their lifecycle. Similarly, each control on a Web form has a series of events that can execute code when triggered. For example, by adding a button to a Web form, you can add a method (called a delegate) to execute when the user clicks the button. Almost all controls have one or more events.



You can visit the example of class browser provided by Microsoft in the QuickStart Guide, which can be http://samples.gotdotnet.com/quickstart/aspplus/samples/ Classbrowser/vb/classbrowser.aspx run it online.

Easy NOTE: This article is translated from MSDN as part of the Battle of Knives: PHP vs. asp.net. Other parts of the article will be easy to interpret as events and energies are selected.
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.