Article
Debate - .NET V. PHP: Top 10 .NET Myths Exposed
Welcome to another SitePoint Debate. Today, daggers are drawn over that long-running battle of the technological titans -- Open Source and Microsoft.
Specifically, we ask "Does .NET mean the end for PHP?" Judge for yourself...
Here's a lesson for anyone in advertising - confuse your customers. It's a dream ticket, as Microsoft have demonstrated with their marketing of .NET. You can almost hear Google straining under the weight of "What is .NET?" queries. It's almost as cunning as PHP's definition:
Q: What does PHP stand for?
A: Hypertext Preprocessor
Q: ?!?
As anyone browsing the SitePoint Forums knows, the hottest debate right now is PHP vs. Microsofts .NET. Discussions range from reasoned interchange to wild argument; anything from ".NET -- who cares?" to ".NET -- the greatest thing since sliced bread". What is clear from many posts is there's a lot of uncertainty about what .NET actually is, and what impact it has on Web development.
This article is intended as "self-defence" for any PHP developers being harassed by over-exuberant .NET fanatics. It's just one PHP's coder's point of view, but it should help clear up some of the most common misunderstanding, based on what's been said at the SitePoint Forums in recent weeks.
The Top 10 Misconceptions
1. PHP is like an open source .NET.
You can't compare PHP with .NET. .NET is an application framework (an environment for building and executing applications) not a programming language; it's like comparing a truck to a road. PHP can, however, be compared to languages which run under .NET, such as ASP+ or C# (referred to as "Language.NET" here).
2. .NET is going to be the future of the Internet!
.NET is the future platform for all Microsoft technology -- it's not aimed solely at the Internet. In fact, it's likely to make its first big appearance on corporate Intranets, with Office.NET and .NET versions of existing Windows NT server software.
3. .NET is the best technology for building a Website.
Both PHP and "Language.NET" are viable solutions for Web building. Whether it's delivering a dynamic Web page generated from a database, sending an email, or interfacing with a payment gateway, both are perfectly capable. In assessing them as technologies for building your site, the only significant difference is the price. Try asking yourself "So how much does it cost to host this ASP.NET page I just wrote?"
4. PHP is not compiled, other than when it's interpreted at runtime, whereas .NET enjoys all the benefits of being compiled.
Here's news for the .NET crowd -- you've finally caught up! Microsoft's use of the word "compiled" in regard to .NET is not what a C++ coder would call "compiled". Zend, the corporate face of the PHP project, have been doing this for a while now with PHP Accelerator (for a free equivalent, try php-accelerator.co.uk). Unfortunately for Zend, they chose to describe what Accelerator does as "advanced caching" (read more on what Zend means by "caching"). For more technical detail, try this thread at SitePoint Forums.
5. ASP.NET has accountable support. PHP has none.
Apart from the support services offered by Zend (effectively PHP's creators), NuSphere, ThinkPHP and other corporations also provide support for PHP. You don't need it, thanks to the ever-expanding PHP community being what it is, but if your boss wants someone credible to blame, there's more than enough choice!
6. .NET supports multiple languages. PHP doesn't.
Try Java for PHP or the upcoming Python extension. Obviously this isn't quite the same as C# or J# but the point needs to be made -- PHP is very flexible, and offers useful solutions for the Internet. Don't expect to find yourself to be writing a successful Website in Cobol.NET -- it's likely each .NET language will eventually "tune in" to a particular type of application development.
7. Language.NET has superior object orientation.
For those who know PHP and its limitations, you may be amused by this .NET FAQ -- sound familiar? In fact with PHP 4.3 in the wings, it may be that PHP can claim superior OO support, when you consider that FAQ.
What is significantly different is "Language.NET" will force you into an object oriented approach from the start, while PHP won't. The Web typically does not require OO -- for your average dynamic Website, a few "hacked" scripts are perfectly fine if they meets the site's requirements. Deliver a live site now, rather than a beautifully abstract piece of code that's ready one year after it's needed. Paraphrasing SitePoint's recent interview with Rasmus Lerdorf, PHP's down-to-earth approach to problem solving is what has made it a success. And when you need OO, it's there waiting for you.
8. .NET offers superior templating and web development features.
Microsoft has come up with some nice features with .NET that are certainly enticing, like the datagrid, and the templating mechanism. But you could easily reproduce these with a little PHP (try DaDaBIK, for example).
The basic notion of templating is to separate logic from content, so those with artistic skills can make a site that looks good, while developers apply the code "behind the scenes". How Web designers feel about working with .NET's templating system remains to be seen. With PHP, rather than being forced into a single approach, you have the choice of numerous Open Source projects (Smarty, Pat Template, etc.).
Harry has been working in corporate IT since 1994, with everything from start-ups to Fortune 100 companies. Outside of office hours he runs