Author: Robert Lair and Jason Lefebvr Intensity Software, Inc.
Translation: Easychen EXLCSOFT.COM
Overview
One debate on the development industry is the platform for PHP and ASP more suitable for website development. This debate has entered a new period because Microsoft's ASP.NET has entered a new period. Compared with the ASP 3.0, ASP.NET has adopted a new design with many new features and advantages. What impact is ASP.NET will bring about the debate between PHP and ASP? This article will provide you with information about the answer to this question.
Architecture comparison
PHP
PHP4.0 is the core as the open source engine of Zend Technologies as the core. When a user browser issues a request to a web server implemented by a PHP, this request is passed to Zend Engine, which will compile the PHP script. If compilation, the compiled code will be passed to the Zend Engine Executor of the final HTML code sent to the client. From a developer perspective, the framework of PHP 4.0 has both advantages and disadvantages.
Because PHP is open source, it has been supported by many different platforms and web servers. Although it is larger than the previous PHP engine, Zend Engine is still light and strong. 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. The best example is the scope of the class member function and attribute. In PHP, all variables in a class can be read from the outside, which makes the implementation of the class unable to hide.
In addition, PHP is not a strong type language (ie, if you compare characters 4 and integers 4, the result is the same), which brings problems when architecture large-scale styles, which makes it difficult to debug the program. What makes debugging is more difficult, you don't even need to declare the variable, this and the ASP turns off the Explicit option is very similar. If PHP encounters a new variable in the script, it will only create it quietly.
Although it is considered to be a flexibility of a relaxed PHP framework, it will take a few hours to solve the bug caused by this characteristic in some cases. Objects are language-level variables in PHP. They are treated to be treated as simple variable types. (Just like integer and character variables) When the image variable assignment is performed and the object is passed to the function as a parameter, the entire object is copied. This will result in inefficiency. In addition, unpredictable runtime behavior occurs frequently.
PHP lacks some of the other modern development frameworks have key elements. One of the most important one is structured abnormal capture. Although you can register a Error Handler for a process error, it is inconvenient for the language itself. Due to "Try.. Catch" error capture, many PHP developers are completely forgotten by erroneous capture or in a narrow range.
ASP.NET
The core of ASP.NET is the Microsoft .NET framework. This framework provides Common Language Runtime (CLR) and class libraries, and ASP.NET is built.
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) Code. This code will run by the CLR to produce machine code for web services.
ASP.NET forced developers using real object-oriented ways. All objects are real OO objects, supporting features such as inheritance, polymorphism (method of overloading) and package.
In addition, all languages in ASP.NET are stronger. For example, to compare integers 4 and character 4, you need to convert the variable into an integer, and vice versa. ASP.NET uses event-driven programming models, which means that the code snippet is linked by an event that may occur at the time of operation.
For example, the Page_Load () event in the ASP.NET page is placed when the browser reads the web form. There are a lot of additional events and ASP.NET Page Object, which can execute code at any time in their life cycle. Similarly, all controls on a web form have a series of events that can be executed when triggering. For example, by adding a button to a web form, you can add a method (called a delegate) to execute when the user clicks on Button. Almost all controls have one or more events.
You can access Microsoft's example on Class Browser in the QuickStart Guide, you can run it online at http://samples.gotdotnet.com/quickstart/aspplus/sample/classbrowser/vb/classbrowser.aspx online.
Easy Note: This article is translated from MSDN, which is a white blade: PHP vs. ASP.NET part. Other parts of the article Easy will seize the events and energy selection.