Do a Google search for "PHP vs ASP.NET" (or "ASP.NET vs PHP") and the first hit you'll get is a seemingly well-written Oracle article. When the article was first published, the .NET community certainly made note of it. There's actually a follow up article by the same author, but he only skirts around the mistakes he made and never really corrects them.
Macromedia might write documentation with horrible code examples, but Oracle flat out lies. Shouldn't we expect more from Oracle? There's a fine print at the bottom of the article that says "The opinions expressed by this author are entirely his own and do not reflect the position of Oracle or any other corporation." That's of little value when it shows up on oracle.com and as the first hit on Google.
Honestly, who would ever buy a product/service from Oracle or iHeavy Inc. (the author's employer) when they clearly don't know what they are talking about? Sean Hull's article shows that opinions can be wrong, and ignorance is still king. I'm calling Sean out and daring him to prove me wrong!
Object Oriented:
So according to Sean, PHP 5 and ASP.NET both have "strong" object oriented capabilities. It's true that PHP5 language supports every important OO concept, but that's just one part of the equation. Anyone remotely familiar with the ASP.NET or WinForms control model knows that for .NET, being object oriented goes beyond the language. In ASP.NET, html markup is represented as server-side objects. This provides the ability to easily program against controls as well as extend them. Gone are the day of procedural includes, you now include an object you can program against. This is a non trivial difference that's at the core of the two platforms. PHP5 has really good OO support, but compared to ASP.NET it isn't remotely close .
Exceptions:
Both PHP5 and ASP.NET support exceptions. Funny how your PHP code uses db_check_errors() for it's "exception handling". Is that how you handle exceptions in PHP? Funnier still is that your ASP.NET example doesn't have any exception handling (or the fact that this ASP.NET example uses Console.WriteLine). If you ignore the fact that PHP5 doesn't have a finally (or using), which is pretty minor, the fact is a number of built-in functions don't throw exceptions nearly as much as they should. Let's take a look at the PHP documentation for opening a connection to oracle:
$conn = oci_connect('hr', 'hr', 'orcl');
if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}
So PHP5 has good support for exceptions, but you'll mostly be checking return values to see if an exceptional situation occurred. Joel Spolsky might switch to PHP.
Speed and Efficiency:
PHP5 is quicker than ASP.NET because Sean said so. No benchmark code is provided. It just is! It's really hard to argue against such a phantom point. I will say that PHP5 doesn't have a caching API out of the box or support for OutputCaching (you need a Pear library for that sort of stuff). Oh ya, PHP5 is also more efficient, but there's no explanation as to what that means.
Price:
Any price comparison that doesn't take into account total cost of ownership is incomplete. Sean himself admits that "PHP is the quick and dirty type of solution". I know the TOC argument is thrown around by Microsofties a lot. But any experienced developer knows that maintenance cost can far outweigh all other costs. If PHP really is a quick and dirty (and it really is), shouldn't a sane business owner be worried about how easily and quickly they'll be able to maintain it?
I know this is an old article and most have let it go, but I feel duty bound to clear up some of the FUD. I work with PHP daily, and I do like it. I plan on making a post about why you would pick PHP over ASP.NET (ie, if you are using the SqlDataSource, just switch to PHP now). But Sean clearly has no idea what he's talking about.
Visit:
Makai Studio
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5