C# articles and tutorials on SharpDeveloper.NET

Sharpen your .NET skills with our C# articles, tutorials, demos, and source code by Sameer Alibhai
posts - 63, comments - 53, trackbacks - 1

PHP VS. ASP.NET

This is a very shallow comparison of my experiences with PHP and ASP.NET
Don’t take this as a religious war or something, the idea is just some basic comparison.
 
Here is a summary: If you are choosing which technology to use to build an application, use .NET. You will get more bang for the buck. With the same effort you will be able to build a much more rich user interface. 
 
My Disclaimer: Keep in mind there are a lot of great libraries and tools for PHP which I never got to use, I just had a simple PSPad text editor and my handy PHP web site.  I really wanted some “Intellisense” style code completion but I could not get it to work with PHP since I couldn’t find a decent IDE (i.e. editor)
 
However, it all depends on your requirements. For example, if you are selling something that most of your customers will be on a shared linux hosting environment, then why would you use .NET ? A good example is the software Clipshare, which is a clone of Youtube. The sites purchasing this product are mainly shared hosting customers who have PHP but not .NET. And Mono (.NET port on Linux) is not yet stable or popular enough to use.
 
I did some PHP programming before I started doing .NET fulltime. Before then I couldn’t say much about it, but after working with .NET for a few years now, I have much to say.
.NET does a very good job in handling the whole life cycle. With PHP you have to do it manually.   For example, there is no such concept of “Postback” with PHP. This is such a basic thing that you can easily check with .NET to see if the page has been submitted and what button was pressed. For example if your “btnSubmit” was pressed, it will call btnSubmit_Click. With PHP, you have to do this manually. Not to mention how mish mashed your PHP page can be in terms of mixed code and style/HTML elements.

How about caching? I wanted to implement caching with PHP and I had a fun time, I had to check if the cached output file existed, and then if so, then check how old it is, and so on... Yeah okay again maybe there are some nice components already done for this, but I didn’t have to look very hard to do it with .NET, I simply added a CacheDependency on an XML file (or whatever the case was), and BOOM! It regenerated the file whenever necessary.
 
How about reusable components? With .NET you can create ASCX (Custom Controls) that you can place within a page that expose certain properties and the control itself maintains its state, can have buttons, etc, etc.

How about master pages (i.e. templates) in .NET? Again, super cool reusability! You can create pages with repeatable parts, with headers, footers, all sorts of fun stuff.

I can go on and on...  but in general, the more I use .NET, the more impressed I am with it. However, what makes it not-so-practical is how expensive Windows Server hosting is.  In summary .NET kicks butt!
 

Print | posted on Thursday, May 08, 2008 5:42 PM | Filed Under [ .NET articles Work Related ]

Feedback

Gravatar

# re: PHP VS. ASP.NET

You might want to take a look at the LAMM stack (linux apache mysql mono). ASP.NET apps run just dandy in *nix with mono.

Cheers,

Greg
5/22/2008 4:45 PM | Greg Young
Gravatar

# re: PHP VS. ASP.NET

You gotta admit that ASP.NET has one failing. ViewState and WebForms. Fortunately it's not difficult to replace that monstrocity with your own httphandlers/modules or something like MonoRail, Promesh.NET, ASP.NET MVC (When it comes out), etc.
5/24/2008 10:46 PM | Lucas Goodwin
Gravatar

# re: PHP VS. ASP.NET

I have to agree with Lucas, however, advantages of .NET are amazing, development time is so much faster in rich Visual Studio Interface.

Another interesting article:

http://www.prosperwebsolutions.co.uk/blog/2008/04/19/ASPNETVSPHP.aspx
6/7/2008 4:18 PM | Josh Smigin
Gravatar

# re: PHP VS. ASP.NET

The only thing lacking in the PHP realm is a solid IDE.

PHP does everything .NET does. There is even a very matured framework out there named Prado that is modelled after MSFT's MVC approach. You can check it out @ www.pradosoft.com
6/27/2008 6:01 PM | lami
Gravatar

# re: PHP VS. ASP.NET

Besides the greater argument...Ever heard of Zend IDE?

Also, better bang for the buck??? How much do you expect a LAMP install to cost? A whole lot of nothing. Sounds like a whole lot of bang for NO buck.

Will rant more later..


-W
7/29/2008 10:20 PM | Will Mason
Gravatar

# re: PHP VS. ASP.NET


I am amazed people praise the visual studio development environment. it think it is as clunky as hell.

also the asp.net event/viewstate driven model was a huge leap in the dark: do we really need events to gather information from a webpage?

i have found development timescales (i commision as a manger now) have not shrunk as a result of dotnet, and that maintenance of code has become a greater problem than under scripting approaches.
8/10/2008 3:42 PM | dave

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 5 and 6 and type the answer here:

Powered by: