PHP 5 vs ASP.NET

by Ben Chivers
Article Rating:  Star rating: 0 Star rating: 1 Star rating: 2 Star rating: 3 Star rating: 4 
Vote for Article:

History of PHP

PHP, initially PHP/FI – Personal Home Page / Forms Interpreter, was created by Rasmus Lerdorf in 1995. This was initially a set of Perl scripts tracking the accesses to his online resume. Rasmus developed PHP/FI over the years in which he changed the project to various different names. PHP/FI was only officially released in November 1997 as open-source software, spending a lot of time within the BETA stages of software development. Today, we now know it as PHP 4 and PHP 5, both of which are entirely different, implementation of object-orientated programming (OOP) being the main difference. PHP is known as a scripting based-language in which the actually scripts which are developed are not compiled into runtime executables but scripts which are parsed to an interpreter.


History of ASP.NET

ASP.NET is an extension idea of Active Server Pages (ASP) technology which was a scripting language similar to PHP originally released in October 1996. In early 2000, Microsoft introduced the .NET framework together with the upgrade of ASP.NET. Like PHP, AS.NET has gone through various development cycles and improvements since its initially release.


Proprietary vs Open Source

As PHP is open-source software it provides a wider user audience that is more fully supported. PHP was also released before ASP.NET in which PHP has vastly improved since it’s initially release. Being open-source software, developers which are not involved with the project can be involved and can include their own implementation and source code. Therefore allowing the product to be developed by any professionals within the industry.


Scripting vs Compiled Executables

PHP is known as a scripting based language in which the source code isn’t actually compiled into a binary, but is actually parsed to an interpreter at runtime. In contrast, ASP.NET actually compiles the source code into a executable binary which is loaded by the web server during runtime. There are vast improvements over compiling into binaries, one being that it allows fast execution of code over scripting based languages. The only drawback to compiled binaries is that if you want to edit the functionality of the program, you have to edit the source code and then recompile, where as with PHP you can edit the source code directly without having to-do any sort of compilation afterwards for the changes to take effect. Compiled binaries also allow for the source code to be obfuscated, thus allowing you to add additional security to your applications. Obfuscating source code prevents other developers from reading your source code understanding how your application works, that developer may well be a hacker trying to break your application. As PHP code is not compiled it isn’t automatically obfuscated from other developers, although there are third party packages available which allow you to accomplish this.


Rapid Application Development

Having the ability to develop applications quickly is a very important aspect within our modern world. Our clients are always changing their minds reflecting in many changes within our applications Normally when clients want something done they usually want it done yesterday, therefore meaning that rapid application development should play a very important part within your software development life cycle.


Visual Studio 2005 – ASP.NET

Visual Studio 2005 is the latest Integrated Development Environment (IDE) from Microsoft which allows you to rapidly develop applications for either testing or initial release. The IDE interface allows developers to easily drag-and-drop components into their webpages reducing the amount of HTML and coding required for the application to work. Visual Studio 2005 also allows you to create composite controls (user controls) and extended controls for you to use within your ASP.NET applications, allowing code reusability within applications.


PHP IDE

There is no official IDE for PHP, although there are many third party IDE software packages which allow you to improve the software development life cycle for PHP, one of which being Zend Studio. These packages do not currently contain reusable components which can be easily dragged-and-dropped onto your webpages, this therefore means you’ll have to develop your own components using classes.


Scalability

Both PHP and ASP.NET allow for scalability by software developers, by providing the ability to integrated existing code and applications into their projects. PHP provides many extensions which can be compiled and loaded by PHP at runtime and can be called directly within the PHP scripts. These extensions are usually programmed within C and execute extremely fast. One common extension which all PHP developers should be familiar with is the MySQL extension. This consists of the MySQL libraries and allows the integration with PHP. There are many database technologies within the industry which also provide this scalability with PHP. Scalability is improved differently with ASP.NET where classes and components are created and are compiled within the application project rather than the framework it’s self. These components and classes can be developed using any of the .NET framework languages such as C#, VB.NET, J# and C++. PHP has increased the scalability of the project to allow for the execution of .NET compiled binaries within PHP scripts. This module is at its first initial stages of experimental released, but as PHP is an open-source based project this will most likely be developed and improved very quickly.


Portability

PHP and ASP.NET are the two most known web development technologies today, allowing developers to create websites and applications to Web 2.0 standard. ASP.NET has one distinct disadvantage as opposed to PHP where ASP.NET is only fully supported on Windows based operating systems. Although this is the case regarding portability with operating systems, ASP.NET does has a platform which will allows you to create applications to run on Linux based operating systems, known as Mono. Mono is an open-source based project sponsored by Novell to increase the portability of ASP.NET to other operating systems besides Microsoft Windows.


Performance

Performance of the two technologies closely relates to scripting versus compiled executables. Binaries are always known to run faster than script based languages, therefore having a distinct advantage. This advantage does come at a cost, executables usually require greater amounts of memory to execute during runtime and also place a limit on the number of executables running. Binary applications usually therefore require better hardware and configuration of the operating system to work correctly, more memory usually being one of these aspects. PHP does provide exceptional performance when configured correctly with the right software, in which this is likely to be vastly better than ASP.NET configurations. When PHP is compiled directly into Apache on Linux the performance is significantly improved allowing scripts to be executed at an exceptional speed.


Object-Orientated Programming (OOP)

Object-orientated programming is a very important aspect for software development in which the OOP model for PHP has been vastly improved over the years, in which the current release of PHP 5 supports a lot of the concepts of C++ OOP. Both projects support polymorphism, inheritance, overloading and overriding, but ASP.NET supports some additional proprietary based OOP concepts such as indexes, properties, additional accessibility configurations and improved overriding functionality with polymorphism. In respect to web based development, the differences between these two OOP models are very minimal.


Database Support

Database support is extremely important as all web-based and desktop-based applications these days require data to be retrieved from an external source such as a database. Some of the big database technologies which are used within the industry are MySQL, Microsoft SQL Server, PostgreSQL and Oracle. All database technologies provide their own unique features and functionality to make them distinctive within the industry. PHP supports all of the database technologies mentioned above as well as additional technologies such as IBM DB2, Informix and MaxDB in which ASP.NET does not support. Both technologies support ODBC based connections allowing ANSI SQL based database technologies to be used allowing the extensibility for nearly any database. ASP.NET however, does not fully support MySQL or PostgreSQL within it’s ADO.NET libraries, therefore being a distinct disadvantage when compared to PHP.


Conclusion: PHP 5 vs ASP.NET

Being PHP and Microsoft ASP.NET developer myself I am not bias towards one or the other. There are some very big differences between these two technologies pointed out above which should be considered when designing and implementing your application. Some aspects which should be considered are: target platform; database support required, ease of AJAX technology, extensibility of the application as well as maintenance and support required for the application. To conclude, if one of more clients required an application with a quick development turnaround I would not hesitate to choose ASP.NET using the Microsoft Visual Studio 2005 IDE running on a Microsoft Windows 2003 platform.