Battle of the white blades: PHP vs.ASP.NET (excerpt) architecture comparison

  • 2020-05-05 11:10:29
  • OfStack

    by Robert Lair and Jason Intensity Software, Inc

EasyChen Exlcsoft.com

    overview

An ongoing debate in the     development community is which platform is better suited for web development, PHP or ASP. The debate has entered a new era with the dramatic changes brought about by Microsoft's ASP. net. Compared with ASP 3.0, ASP.NET has a completely new design with many new features and advantages. How will ASP.NET affect the debate between PHP and ASP? This article will provide you with information about the answer to this question.

    architecture compares

    PHP

    PHP4.0 is based 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 Zend Engine Executor, which generates the final HTML code that is 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 engines, the Zend Engine is still lightweight and strong. As an extension, PHP also supports object orientation, allowing users to create their own classes and objects. However, for some reason, PHP is not a true object-oriented development environment. The best example is the scope of class member functions and properties. In PHP, all variables in a class can be read and written from the outside, making the implementation of the class impossible to hide.

In addition,     is not a strongly typed language (that is, if you compare the character 4 with the integer 4, the result is the same), which causes problems when building large programs and makes debugging difficult. To make debugging more difficult, you don't even have to declare variables, much like ASP with the explicit option turned off. If PHP encounters a new variable in the script, it simply creates it silently.

    is considered to be the flexibility of the loose PHP framework, but in some cases every developer will spend hours working on the BUG caused by this feature. Objects are language-level variables in PHP. They are treated largely as simple variable types. (just like integer and character variables) the entire object is copied when operations like variable assignment and passing an object as an argument to a function are performed. This leads to inefficiency. In addition, unpredictable runtime behavior often occurs.

    PHP lacks some of the key elements that most modern development frameworks have. One of the most important is structured exception catching. Although it is possible to register an error handler for process errors, it is not convenient for the language itself. Due to the absence of "try.. catch" error capture, many PHP developers simply forget about error capture or use it in a narrow scope.

    ASP.NET

The core of NET is the Microsoft.NET framework. This framework provides common language runtime (CLR) and class libraries on which 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 as Microsoft Intermediate Language (MSIL) code. This code will be run by CLR to produce machine code for web services.

    ASP.NET forces developers to use a true object-oriented approach to programming. All objects are real OO objects that support features such as inheritance, polymorphism (method overloading), and encapsulation.

In addition, all languages in ASP.NET are strongly typed. For example, to compare the integer 4 with the character 4, you need to convert the variable to an integer and vice versa.

    ASP.NET USES an event-driven programming model, which means that code snippets are associated with events that may occur while the program is running.

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

   

    you can visit Microsoft in QuickStart guidelines on Class Browser example, can be in http: / / samples gotdotnet. com/quickstart/aspplus/samples classbrowser/vb/classbrowser aspx run it online.

    Easy note: this article is translated from MSDN and is part of the battle of the white blades: PHP vs ASP NET. Other parts of the article Easy will be translated depending on the event and energy.

Related articles: