PHP Vs ASP.NET – The Comparison
Having been brought up and grown in a Java development, naturaly when I started developing web applications I chose php as my development language using MySQL as my database back end. However over the years , with the dot-com boom of the mid 200o’ s a lot more corporate web applications are being developed? using Microsoft’s .NEt framework,? which brings the big question. Which one is better, .NET or PHP. Personally, its all about one’s preferences , Facebook is PHP for instance and MySpace was .NET before ColdFusion which it is now.
A Google search of the queries comparison leads one to a hot debate with php guys up in arms with die hard .NET developers. With a little over six months that I have been developing enterprise applications? in both Languages, allow me to trample on some sensitive ground.
PHP:
Even Rasmus Lerdorf (the creator of PHP for those of you who call yourselves fans of the language) will tell you
that PHP was designed as a hacky throw-it-together language so he could call C routines from scripts that were easy to edit. It’s fantastic for small quick websites that need a little data access or dynamic content. It’s also free, which is great because the majority of cheap or free hosts out there support it (usual reasoning: most of their clients only want simple sites and will probably never use PHP, and they certainly won’t use ASP.NET, and linux boxes are cheap and linux comes with PHP and that’s generally why they offer it). PHP is not object oriented. The libraries are not designed to be object oriented, and supporting “classes” isn’t enough to call yourself OO. Classes were just an addin in version 4 (I think) and they’ve been improved in version 5, but they certainly don’t match the capabilities of .NET. In PHP you generally embed your PHP code into your HTML (ie <?php echo “Hello” ?> between HTML’s bold tags (for the more advanced people, templates don’t count).

ASP.NET is a smaller part of the huge Microsoft .NET framework. You can write .NET applications (including ASP.NET sites) in many programming languages (C#, Visual Basic .NET, J#, Delphi .NET, Managed C++, or even in pure MSIL (for the purpose of this discussion, if you don’t know what MSIL is, it’s like assembly code)).
ASP.NET also encourages the use of a multi tiered design. Your HTML goes in a .ASPX page. Your actual C#/VB.NET/whatever .NET language your using> code (usually, though you can chose) goes in a .ASPX.CS file. The code is kept seperate from the presentation. You are also encouraged to keep your data access code seperate to your business code – SQL queries never appear in the .ASPX.CS files for example.
So yes, ASP.NET does make things more complicated than PHP. You can’t just throw a page together, slap in a few render tags and call yourself an ASP.NET developer like you can with PHP.
Now, PHP can do some of the stuff ASP.NET can do. For instance I believe it’s possible to seperate your PHP code from your HTML via templates. The problem is, the PHP documentation doesn’t encourage this, in fact it doesn’t even mention it . You could also achieve a multi tiered design by putting source in different files, but again PHP documentation never discusses this. 99% of PHP tutorials teach you to throw database code between your HTML and business code.
But only half the problem is due to PHP’s “hacky design”. The other half is due to the user population, and it’s the same reason I’ve never stuck with Linux. Now I know there are very talented PHP coders out there, that create beatiful sites with excellent architecture. But you can’t say I’m wrong when I tell you that at least 90% of your average PHP coders are? teenage hobbyists (I was one of them once) who hate “M$” and want to stand up for the virtues of truth and justice by being alternative and supporting open source. It really is a case of the blind leading the blind – the PHP documentation supports “hacky” programming, the users learn from this, they go off and help other users and teach them the same thing. The barrier of entry for PHP is very low – it’s excellent for people new to programming and web technologies.
Conversely, 90% of ASP.NET programmers are probably well trained and experienced programmers. They’ve realized “Micro$oft” wont go anywhere ,? they’ve gotten laid and they’re (most anyway) pretty much over their acne problems. When you have an ASP.NET problem and ask for help, chances are you’ll get an answer that works but also is well designed and documented, unlike a PHP question that’s usually answered by some teenager who threw a script together in notepad and didn’t even think about security or good design.
I can prove it. Show me a major bank that wrote their online banking system in PHP, or their internal account keeping systems in PHP and I’ll show you a thousand that use ASP.NET. No, it’s not because the banks are “in bed with M$”. The banks don’t “suck up to Micro$oft.!1″ like many PHP advocates would tell you. It’s because they actually hire professionals, they write documentation (please, don’t faint, yes, in the real world you do have to document things first), they do a lot of research before picking a technology platform and they spend a lot of money on it.
Now, just because PHP isn’t as professional as ASP.NET, doesn’t make it a bad language – and I never said it was. Like Rasmus will tell you above, it’s designed with completely different goals in mind. PHP is fantastic for students and hobbyists. It’s bad for NASA space missions or the ASX. It’s great for a photo archive or a little forum or a blogging engine. It would probably be great for a hair dressers booking system, but I wouldn’t recommend it for an internal hospital patients records system.
Decide what you want to write or where you want to work before you pick the language. Always pick the right tool for the job and the right tools for your career (if you even want one as a web programmer).
Interesante, yo cotizaci?n en mi sitio m?s tarde.
Dolly
Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which we all need, thanks for all the enthusiasm to offer such helpful information here.
Terrific read! I have got one particular recommendation for your site. It looks like there are a few cascading stylesheet problems when opening some pages in google chrome and firefox. It is working fine in internet explorer. Possibly you can double check that. I’ve just added this content on digg.com to get some more website visitors to your web page.
Hi this is a wonderful article. I’m going to e-mail this to my pals. I stumbled on this while exploring on google I’ll be sure to come back. thanks for sharing.
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck
Love does not dominate it cultivates.
Superb blog post, I have book marked this internet site so ideally I’ll see much more on this subject in the foreseeable future!
Couldnt be published any more effective. Reading this blog post reminds me of my old room mate! He always kept talking about this. I will forward this post to him. Fairly sure he will have a great read. Thank you for sharing! Regards, Matilde.
superlative blog you land
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! I’m sure you had fun writing this article.
Where do you come up with this? Just saying you are very imaginative. Do you still feel this way? Adauga Anunturi Gratuite Buzau
hi terrific site and theme. I am hoping I’m not pestering you I merely sought to inquire precisely what wordpress plugin you use to display the latest remarks on your blog? I really want to do something similar for my free ipod website however I cannot find the plugin or widget for it. Thanks for your time
Wish you 2011 Happy New Year! An astonishing share, I just passed this onto a friend who was doing a little research on this. And he in fact purchased me breakfast because I discovered it for him… smile.. So let me rephrase that: Thnx for the treat! But yeah Thankx for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more info? It is highly helpful for me. Big thumb up for this blogpost!