“So, why is .Net better than PHP?”. How many times have you been asked that question? It happens frequently for me, as I do most of my development in .Net (note the word “most”, I do some work with PHP). I often find myself scrambling for answer. Not one in favor of .Net, necessarily, but one that explains the real difference, not a surface issue.
Many folks miss the point. The question isn’t “which one is better, inherently?” The real question is “Which one is better for the task at hand?” In this article, I will lay out some of the common questions raised against ASP.Net, and try to show how they are either irrelevent or no better in PHP.
Before I start though, I want to make one point. There is no such thing as a perfect platform. Whether we are talking about the classic Ford vs C…er…I mean Mac vs PC, Firefox vs. IE, or .Net vs PHP. There will never be a perfect platform.
Now that we have that out of the way, lets dive in. The first point I want to make is the distinction between .Net and PHP. .Net is a framework. PHP is a scripting language. .Net is much bigger than PHP, with all the libraries, mobile-support, desktop development, etc. That’s its scope. PHP’s scope is web, and it is doesn’t ship with all the class libraries that you get with .Net. In many ways, we are comparing apples to oranges. But, as they are the two primary way of displaying dynamic content on the web, lets continue.
The first question I want to discuss is very classic, cost. You always hear, “Why not do PHP, its free.”. What do you mean by “free?” Do you mean getting the compiler? If so, you’re wrong. The compiler is free in .Net. Do you mean software licensing? For most companies that actually need a product that is of a decent size, that’s a drop in the bucket. But for Joe Wanna-be programmer who just wants a site for his corner coffee shop that has a few dynamic capabilities, maybe that’s not what he’s looking for. With the .Net class libraries, you don’t have to buy pre-made packages made with PHP, or write it all from scratch (which takes time, which is money). In the end, it depends on the specifics of your individual situation. If you want to make a small, quick project, the requirements will be much difference than a $1,000,000 project. Context is everything. Nothing is free.
Another complaint I’ve heard regards security. “IIS is insecure!”, they say. Lets look at the facts. While IIS can be exploited, so can Apache! IIS has never has a critical security hole. More energy may be spent towards attacking IIS, but you also have one of the largest corporations in history backing it and supporting it (same as IE). Nowadays, most holes come from poor coding practices, not from server vulnerabilities.
One more for today, OS dependability. So .Net really likes IIS. Ok. That’s fine. PHP really likes Apache. Ok. That’s fine. Get over it. Again, look at your specific situation.
In conclusion, no one can say whether one is better than another. They aren’t even in the same programming family for goodness sake! OO vs Structured. Look at your solution requirements, then make your decision.
~The perspective of one .Net programmer.
Discussion on this topic is greatly appreciated.