Wednesday, November 10, 2010

Migrating from PHP to ASP.NET- part2

Comparison

a comparison of some of the prominent features in PHP and ASP.NET.

1. Coding Language

PHP

C, C++ style scripting language with older ASP style mark up. Supports some OOP concepts.

ASP.NET

Supports more than 25 languages, but the 2 that are most-commonly used are Visual Basic .NET and C#. Most developers pick one language but can consume components written in any of the other supported languages.

2. Compiled Application Logic

PHP

Compilable and can be run as a executable

ASP.NET

Supported, in both dynamically-compiled and precompiled modes.

3. Full-Page Output Caching

PHP

No native support

ASP.NET

Supported, caches different versions of the page based on one or more URL parameters, browser type, a custom function, or any combination.

4. Partial-Page Output Caching

PHP

No native support

ASP.NET

Built-in support through use of User Controls. Data and other objects can be cached with sophisticated expiration rules using the Cache API.

5. Database Access

PHP

Has drivers for most databases on the market as well as open-source databases

ASP.NET

Supports OLE-DB and ODBC directly, and includes native drivers for Microsoft SQL Server™ and Oracle.

6. Database Output

PHP

Datasets are returned as PHP variables and can be outputted like any other variable

ASP.NET

Templated data binding to server-side controls for ease of development, or manual looping if that is preferred.

7. External Components

PHP

Can call a variety of packages and the Zend engine can be modified directly by the developer because it is open source. The programmers responsible for Zend are also working on allowing .NET objects to be called from PHP

ASP.NET

Very good support for native C libraries and COM objects, as well as assemblies written in any .NET-compliant language, including Managed C++. No built-in support for CORBA objects or Java classes.

8. XML/XSLT

PHP

Supported in add-on packages and libraries

ASP.NET

Comprehensive and easy-to-use support is provided for XML DOM, XSLT, validation, and lightweight stream-oriented parsing of XML documents.

9. XML Web Services

PHP

PHP packages are currently being developed to support Web services based on Apache AXIS engine as well as others.

ASP.NET

The current release provides extensive and flexible standards-compliant support and makes it extremely easy to both publish and consume Web services.

10. Session State

PHP

Cookie based session management

ASP.NET

Cookie-based or cookieless session state, using a single-server in-memory store, a centralized state server, or a database back-end. In addition, the extensible architecture allows for custom session-state modules to replace the built-in options. Cookieless sessions require only a configuration change to enable.

11. Built-In Functionality

PHP

PHP has built-in functions to cover many common tasks that a Web-based application may need to perform. It can also access Java class libraries with some extra work.

ASP.NET

ASP.NET has direct access to the entirety of the .NET Framework class libraries, which encompass a vast amount of functionality.

12. Regular Expressions

PHP

Supports POSIX and Perl compatible regular expression syntax.

ASP.NET

Supports Perl-5-compatible regular expressions, with additional features such as right-to-left matching, precompiled expressions, named groups, full Unicode support. Also allows the user to specify a function to be called during a regular expression replace operation.

13. Debugging

PHP

PHP does not offer extensive debugging, although various products from third parties and Zend allows for increased debugging and testing.

ASP.NET

Includes extensive tracing and environment information that can be included in the page or displayed in a separate page. Microsoft Visual Studio® .NET allows for easy interactive debugging of pages as they execute, in addition to debugging of client-side scripting and SQL Server stored procedures.

14. Error Handling

PHP

Does not support error trapping but has various error-handling functionality and logging,

ASP.NET

Supports structured exception handling (with the addition of a "finally" block for code that executes regardless of whether or not an error occurs), raising custom exceptions, and specifying custom error pages for different types of unrecoverable errors.

15. Image Manipulation

PHP

No built-in support, although third-party components are available.

ASP.NET

Includes extensive image creation and manipulation facilities. (See the .NET Framework's System.Drawing classes)

16. Code Re-Use

PHP

User-defined functions, ability to create Classes, and included files.

ASP.NET

User Controls, Server Controls, custom classes, and included files.

17. Threading

PHP

PHP has a good threading model

ASP.NET

Fully supported. Not only do simultaneous page requests happen in separate threads, but each page can (if needed) spawn its own threads to perform simultaneous or asynchronous work.

18. Data Caching

PHP

Has limited data native Data Caching

ASP.NET

Includes an extensive cache API that allows nearly any type of data (including database query results) to be stored, with expiration based upon time, usage, or dependency upon a file or another cached item. Also allows for a user-defined function to be called when a given item is removed from the cache.

19. Internationalization

PHP

Full support for Unicode

ASP.NET

Supports Unicode strings and various character encodings. Date, number, and currency functions are all culture-aware and alter their output depending on what the current culture is set to (rather than requiring different functions to be called). Support for using resource files to dynamically localize an application is included.

20. SMTP, HTTP, FTP, POP3

PHP

Native support for a wide variety of Internet protocols

ASP.NET

SMTP support depends upon the IIS SMTP Service. HTTP has very good support. FTP and POP3 are not supported in .NET, but free and commercial third-party components are available for this functionality.

21. Integrated Development Environment

PHP

Numerous development tools with a broad range of capabilities are available at price ranges from free to several hundred dollars.

ASP.NET

There is a free tool for ASP.NET development available from Microsoft called ASP.NET Web Matrix

The most popular tool is Visual Studio.NET which has full support for all .NET languages, database tools for creation of SQL and testing databases, Web Design tools, integration with version control, advanced debugging and numerous other features for a full list see the MSDN® Visual Studio Developer Center.

Other tools, including Borland C# Builder and Macromedia Dreamweaver MX, also support ASP.NET.

22. Web Server Support

PHP

Supports almost every Web server.

ASP.NET

Supports IIS and Covalent's commercial version of Apache 2.0.

23. Operating System Support

PHP

There are ports to almost every commonly used OS including Microsoft Windows®, Mac, OS X, Amiga, Solaris, Free BSD, Linux, AIX and more.

ASP.NET

Currently supports Windows 2000, Windows XP, and Windows Server 2003.