SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: Php vs. Asp.net

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2010
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Php vs. Asp.net

    Hello all,

    I've found this on another website, please share your opinion:

    "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 orinted, 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
    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 (and people do) 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 AFAIK. 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 testosterone pumped teenagers (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. They're like the hippies of programming. 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" doesn't "sux0rz" long ago, 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, unlike a PHP question that's usually answered by some 14 year old 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, or even their "quote of the day" page that Doris the secretary uses to pass the time, 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 ROFLZ!!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)."

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,868
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    PHP 5 is a very different language from PHP 1 and the restrictions that you refer to are long gone from PHP.

    PHP is even one of the languages that can be run on the .NET framework.

    The difference these days between what can be dome with PHP and what can be done with .NET basically comes down to which of the two that you know best and which the web hosting supports.

    In determining which of the two to learn if you are intending to make it your career it really depends on the size of the company you want to work for. The biggest companies are likely to be running either .NET or Java while smaller companies are more likely to be using PHP.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2010
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The article you stumbled upon is absolutely and completely biased and most likely written by ASP.NET fanboy.
    Too bad that many points I've read there are completely false, do not rely on them.
    ASP.NET doesn't offer you the all mighty tool that will create space shuttle of an application, it's got its ups and downs but here's some food for thought - flickr and facebook are based on php. There goes the whole theory of a hospital patients records system argument (and that whole thing is reliant on network / database, not the presentation language).

  4. #4
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,617
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    One thing that ASP.NET does quickly is form creation. I only say quickly (and not well) because a lot of code gets auto-generated for that, which isn't the prettiest code in the world.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  5. #5
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Hah, that article is laughable.
    Clearly written by someone who has a problem with PHP for some reason, definately a .NET fan-boy.

    Nothing wrong with .NET, nothing wrong with PHP. Both are two different tool-sets that can be used both properly or badly. The fact that PHP is a little easier to get started with (i.e. you don't need the extensive training the article mentions) means that PHP has a bad reputation for bad code, it also means there's a vibrant community.

    Most banks that I know of (from experience) use (old) COBOL or VMS/ AIX based software or if they're a little more modern, Java/ MAGIC/ Oracle platforms. ASP.NET? Maybe for their website, but not for their core business apps.


    As for the space shuttle, that runs on software written in assembler code in less than 1 megabyte. I doubt it runs on ASP.NET

  6. #6
    SitePoint Zealot
    Join Date
    Jan 2006
    Location
    Gold Coast, Australia
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That argument against PHP is ludicrous.

    It's fantastic for small quick websites that need a little data access or dynamic content.
    If sites like Facebook (alongside Erlang, C++, Python) and Wikipedia can run on such a large scale is a testament to the language.

    PHP is not object oriented.
    PHP 5 represents an explicit endorsement of objects and OOP. PHP however, remains a language that supports OOP, rather than an OO language itself. Its support for objects after PHP5 is well developed to justifying developing from a exclusively object-orinted point of view.

    The libraries are not designed to be object orinted
    Thats just a blatant lie. Plenty of PHP libraries support a well defined OO style. To name a few off the top of my head: PDO, DOMDocument, Xpath.

    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
    I covered this argument earlier.

    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).
    You can choose to do so. However, it this is very easy to avoid. The seperation of logic and presentation is very easy to accomplish, what with the advent of frameworks and MVC methodologies. Lazy programmers who choose not to do so, should not be held against the language itself. One of PHPs merits, is its flexibility. However, in a beginners hands this flexibility can be to the detriment of the programmer. That does not mean the language is at fault, its the programmer. I can assure you rubbish code can be written in every other language.

    As for the space shuttle, that runs on software written in assembler code in less than 1 megabyte. I doubt it runs on ASP.NET
    Random bit of trivia. C++ was the first language used on another planet (the Mars Rover!).

  7. #7
    SitePoint Enthusiast
    Join Date
    Sep 2009
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://forums.whirlpool.net.au/archive/366453 and find Goat Farmer forum reply 2005-Jul-9, 12am AEST and then read http://www.bloogle.co.za/2010/09/15/...he-comparison/.

    Just search for
    "Even Rasmus Lerdorf (the creator of PHP for those of you who call yourselves fans of the language)"
    In both pages. Similar?

  8. #8
    SitePoint Enthusiast
    Join Date
    Sep 2010
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks all.

    I have heard that It takes more lines of code to develop a web application with ASP.NET than PHP, is that true? Why?

  9. #9
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,868
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Web Dreamer View Post
    Thanks all.

    I have heard that It takes more lines of code to develop a web application with ASP.NET than PHP, is that true? Why?
    No it isn't true.

    Since PHP is one of the languages that you can use on a .NET platform you can do anything on .NET with exactly the same code as you can use with PHP.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  10. #10
    SitePoint Enthusiast
    Join Date
    Sep 2010
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks felgall. What about you? What do you prefer PHP or ASP.NET and why?

  11. #11
    SitePoint Zealot
    Join Date
    Mar 2009
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right, it depends what you do best. Even classic ASP can do well if coded right. PHP seems to have less lines of coding compared to .NET for the same task. .NET does support different languages like c#, vb, java, etc. As for performance, it's more to do with hardware, coding styles, optimization, and as well as database which is the most important part for any web applications.

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,868
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Web Dreamer View Post
    Thanks felgall. What about you? What do you prefer PHP or ASP.NET and why?
    I prefer PHP. That's because PHP is one of the several languages that I know and which my web hosting supports.

    My hosting doesn't support .NET and so I have no reason to learn to use that for any of the web work I am currently doing. I do know some of the languages .NET supports and so would consider learning how to use them in that environment if there was a work related requirement to do so.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    SitePoint Zealot ChrisWiegman's Avatar
    Join Date
    Sep 2010
    Location
    Austin, Texas, United States
    Posts
    177
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The big advantage PHP has over .NET today is price. It is both free to use and cheap to implement. Take a look at hosting plans and you will quickly find that Linux hosts are on average quite a bit cheaper than .NET hosts. In addition, PHP's popularity has made it a favorite among many open-source web software projects. While some do exist that will run on .NET, the momentum of the community is definitely on the side of PHP.

  14. #14
    SitePoint Guru
    Join Date
    Jun 2006
    Posts
    638
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    One thing that ASP.NET does quickly is form creation. I only say quickly (and not well) because a lot of code gets auto-generated for that, which isn't the prettiest code in the world.
    That's because the tool to generate the code for this comes with the IDE...
    I have similar code in php, where all I have to do is create the DB tables, then run a script to generate DTOs for my ORM (linking keys by naming conventions) and it generates an administration center to view/add/delete/update those records.

    Can't get any faster than that, no matter the language. Only thing is, in PHP you have to think that through once, and build it. In ASP.Net, it comes pretty much built in.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •