12.07.2006

ASP.Net vs PHP: Love or Money?

This is a response to an email-list question about which is "better", C# or Java for applications, and a separate question about ASP.Net vs PHP.

OK, first the easy question. If you are developing Windows applications, you use C#... never Java. If you need something that is cross-platform, you should probably use Java. The syntax of Java and C# is pretty much the same. The concepts involved are also similar, both being OOP languages with the C-style curly-brace syntax. If you learn one, you will be learning the other as well, they really are that similar. For application development, you need to look at other things as well, such as VB and C++, Java and C# are not the only choices. If you have experience with anything already and you are in a hurry, obviously you should use that.

As for PHP vs ASP.Net... all other things being equal, ASP.Net is 'better' than PHP. However, all things are not equal. It depends highly on the application you are designing, and factors such as budget, size of the development team, existing hardware, and so on. All those things come down to money, and ASP.Net is hands-down more expensive. ASP.Net is also faster and easier to use... IF you understand C# or VB, so you will have to learn one of those languages along side with ASP.Net if you want to be successful. With PHP, you will be able to get up and running for free and with a smaller learning curve, but you won't be able to do as much with it later on. I don't believe there is anything you can do in one language that you couldn't accomplish in the other, so neither choice will limit your possibilities. Here's a brief run-down of the trade-offs...

ASP.Net runs on Windows servers using the IIS web server($$$)
PHP runs on almost any server running Apache. PHP runs on other configurations as well.

ASP.Net is an object-oriented environment.
*PHP is a procedural environment. (Easier to learn)

ASP.Net is easier to debug, but debugging requires Visual Studio($$$)
PHP code is harder to debug, but doesn't require expensive programs.

ASP.Net is elegant and powerful.
PHP requires many workarounds to do complicated things.

ASP.Net requires a lot of system resources and fast servers.
PHP is lean and mean, and runs well on cheaper boxes.

Error handling in ASP.Net is based on Exception handling which is a robust model familiar to many programmers.
*PHP error-handling is tricky, and different programmers use many different methods.

ASP.Net is strongly typed and compiled.
*PHP is a scripting language, resulting in errors that are harder to find.

ASP.Net may be less secure because it runs on IIS.
PHP usually runs on Apache, which is known for good security.

*PHP 5 has addressed some of these issues. It has some better error handling and more object-oriented features.

These decisions all come down to what you know already, what you want to invest, and where you want to go with it. If you know VB or C# already, then ASP.Net is a good choice, but if you're familiar with Javascript, PHP might be a better choice. If money is no object and you don't mind Windows, use ASP.Net, but if you need to run on cheaper platforms, use PHP. If you need a super-rich environment and a robust language with infinite possibilities, use ASP.Net, but if you need to get up and running fast with low cost and are ok with a little extra work for the tough stuff, use PHP.

Clear as mud?
Jasmine

1 comment:

Anonymous said...

Thanks, good post!

 
hit counter script