Page 1 of 2 12 LastLast
Results 1 to 16 of 22

Thread: Why would I use ASP.net instead of PHP?

  1. #1
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Why would I use ASP.net instead of PHP?

    I'm not sure if it's a question that can really be answered without hearing my specific needs but the truth is, I have no specific needs, I am literally asking in as vague a way as possible

    Are there any general benefits to writing a web based site/tool in ASP.net instead of PHP? I am aware that with ASP.net I have more choices for the language I use, but for me it boils down to presenting HTML in one way or another.

    I've always used PHP and am very comfortable with it. I did try ASP.net a while back because of some potential changes where I work, but it never felt quite as direct as working with PHP. That is, in PHP it feels like I can change whatever I want, at whatever stage and this would be reflected in the results. ASP.net felt like I was always working behind a layers (e.g. web forms) that I found restrictive.

    I've no doubt if I had started off with ASP.net and barely touched PHP, I could be asking the question the other way round, but as it stands, I just can't see any general benefits with ASP.net (for web stuff).

    So, any thoughts?

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Why would I use ASP.net instead of PHP?

    PHP is really quite a bad language, its very limited in power, has no 'modern' design patterns and even the 'nock it up quick' lot have really left it in favour of ROR and other such ideas.

    The first issue is the way PHP blurrs things. From its outset they had ideas like Magic Quotes, this mean that you could just write variables inside the strings your formatting. This sounds good, but makes understanding the flow of the application harder and also have many security concerns.

    ASP.Net is no panacia, in fact m0n0rail is in many ways better than the web MVC, but it does lend to better seperation of concerns and better performance. The former allows it to be extended with less development cost, the latter allows for scaling.

    Its not a simple there is one thing better than the other and you can easily write very bad ASP.Net, hell you could even use phlanger and write it in PHP. But ASP.Net has a lot more power, a lot more features, you've got better ORMs, you've got concepts such as lambdas and LINQ for dealing with data collections, things like Rx or PLinq for having a better concurrency system.

    Non of that matters for "this is meh blog" but it does if your making a big complex website.
    throw new ArgumentException (String, String, Exception)

  3. Received thanks from:

    Raz316 (21-03-2012)

  4. #3
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: Why would I use ASP.net instead of PHP?

    The first issue is the way PHP blurrs things. From its outset they had ideas like Magic Quotes, this mean that you could just write variables inside the strings your formatting. This sounds good, but makes understanding the flow of the application harder and also have many security concerns.
    I would say it's only an issue if you use PHP in a way that blurs things. As a rule, I don't ever do include variables in " ... " based strings.

  5. #4
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by Raz316 View Post
    I would say it's only an issue if you use PHP in a way that blurs things. As a rule, I don't ever do include variables in " ... " based strings.
    I used that as an example of a bad language feature.

    The thing is you can write perfectly readable and legable assembly code, but some languages lead to better qualities.

    The fact that PHP only had classes introduced yesterday, makes me suggest the language itself never considered readability.

    This is not to say if you take a very good language like C# you won't get some idiot who writes a 8,000 line .cs file....
    throw new ArgumentException (String, String, Exception)

  6. #5
    Gentoo Ricer
    Join Date
    Jan 2005
    Location
    Galway
    Posts
    11,048
    Thanks
    1,016
    Thanked
    944 times in 704 posts
    • aidanjt's system
      • Motherboard:
      • Asus Strix Z370-G
      • CPU:
      • Intel i7-8700K
      • Memory:
      • 2x8GB Corsiar LPX 3000C15
      • Storage:
      • 500GB Samsung 960 EVO
      • Graphics card(s):
      • EVGA GTX 970 SC ACX 2.0
      • PSU:
      • EVGA G3 750W
      • Case:
      • Fractal Design Define C Mini
      • Operating System:
      • Windows 10 Pro
      • Monitor(s):
      • Asus MG279Q
      • Internet:
      • 240mbps Virgin Cable

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by TheAnimus View Post
    The fact that PHP only had classes introduced yesterday, makes me suggest the language itself never considered readability.
    You mean you were only introduced to PHP classes yesterday, surely?
    Quote Originally Posted by Agent View Post
    ...every time Creative bring out a new card range their advertising makes it sound like they have discovered a way to insert a thousand Chuck Norris super dwarfs in your ears...

  7. #6
    PHP Geek Flash477's Avatar
    Join Date
    Dec 2008
    Location
    Devon
    Posts
    822
    Thanks
    51
    Thanked
    72 times in 65 posts

    Re: Why would I use ASP.net instead of PHP?

    Well I am very much a PHP developer, so my opinion is probably going to be somewhat biased by that, but....

    Every language has it's pros and cons, and insecure code can just as easily be written in either language.

    Classes in PHP have been around for quite a while, since PHP 3 in fact, and was improved in PHP 4 which has been out a long time now. Sure it was php 5 that introduced proper class functionality like create and destroy etc, but that has been out since around 2004/5.

    One of the things with ASP is that you need to invest in more hardware and pay licence fees to Microsoft in order to run it, whereas PHP runs on Linux (and Windows!), which requires less hardware for the same performance and no licence fees.

    Sure it is well and good that you are able to programme ASP.net in a number of different languages, but if you have someone programme it in say J# (or any of the other countless languages), but you only know C# then you are pretty much screwed for making changes. PHP on the other hand changes very little, so if you know PHP you can work on any project that has been done in PHP. This also means that you can move PHP projects from version to version with generally no changes required.

    ASP.net also requires compilation, which although may have some advantages, it does mean that it is harder to make small changes and also requires a package with which to do it, whereas all you need is a text editor for PHP and if there is a quick fix that needs doing you can do it from anywhere as the source code is right in front of you.

    I'm sure that out of the box ASP.net has more widgets that you can use, such as in form building and displaying data, but this can also be limiting. Also I'm not sure if it has changed a lot, but certainly in the past a lot of the widgets were very biased to IE.

    As long as the coding is done using a proper MVC methodology then PHP can do an awful lot, whilst being very easy to read and edit. It is just that a lot of beginners make the mistake of weaving their code throughout the html, rather than building central libraries and classes.

  8. #7
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS

    Re: Why would I use ASP.net instead of PHP?

    PHP is easy. Really really easy. It's also crap. Really really crap. The question is how much you care about the trade-offs between both of those factors. Great webapps like Mediawiki and Wordpress are done with (or in spite of) PHP, but PHP's completely haphazard "design" mean a PHP webapp can end up looking like spaghetti very quickly (and is reasonably hard to secure compared to alternatives).

    ASP.NET is a much harder thing to learn, especially with some of the ass-backwards paradigms it uses (stateful webforms?). But PHP is a system about as sophisticated as original ASP Classic, which somehow has been twisted into being used as a premier language by millions of developers.

    See also Javascript.

  9. Received thanks from:

    Mblaster (21-03-2012),Spud1 (22-03-2012)

  10. #8
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: Why would I use ASP.net instead of PHP?

    Directhex: in what way would you say it's really crap?

  11. #9
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: Why would I use ASP.net instead of PHP?

    Flash: Yeah, I'm probably in the same boat as you.

  12. #10
    Almost Ex-HEXUS Staff Jonatron's Avatar
    Join Date
    Sep 2009
    Location
    London
    Posts
    705
    Thanks
    48
    Thanked
    272 times in 167 posts

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by Raz316 View Post
    Directhex: in what way would you say it's really crap?
    Well i'd say it's crap because it wasn't really designed, it just kept having stuff tacked on. It's also had a lot of security problems over the years and it makes it difficult to be secure with functions like mysqli_real_escape_string (previously mysql_escape_string) and htmlspecialchars. It has too many ways to connect to databases (mysql , mysqli, PDO) and a ton of database abstraction libraries to choose from. There's no proper organisation or naming standards or standard parameter order to the standard library. You can't handle errors properly because not everything uses exceptions (which are fairly new to PHP IIRC).

    It does have a low barrier to entry and it's easy to deploy though.

  13. #11
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by Raz316 View Post
    Directhex: in what way would you say it's really crap?
    It's got a floppy scripting-language approach to type safety, which tends to be a horrible magnet for exploitable code (i.e. you need to manually sanitize everything, and someone always forgets once). And there is absolutely no logic behind the method names and arguments - everything started life as a "we should have a command which does foo" without the slightest bit of thought as to why and how.

    It works, don't get me wrong, but it's not been "designed", ever - it just sorta happened, then kept sorta happening until this day.

  14. #12
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by aidanjt View Post
    You mean you were only introduced to PHP classes yesterday, surely?
    No it was a flippent comment that it didn't even get a concept of a class until 4, and its still VERY broken in 5.
    Quote Originally Posted by Flash477 View Post
    Well I am very much a PHP developer, so my opinion is probably going to be somewhat biased by that, but....
    Not biased, just ignorant of computer science terms.
    Quote Originally Posted by Flash477 View Post
    Every language has it's pros and cons, and insecure code can just as easily be written in either language.
    Not so, see quotes example, the fact documentation suggested using it for SQL queries with no sanatising. Compare that with the idea of using an ORM, well hell using objects.
    Quote Originally Posted by Flash477 View Post
    Classes in PHP have been around for quite a while, since PHP 3 in fact, and was improved in PHP 4 which has been out a long time now. Sure it was php 5 that introduced proper class functionality like create and destroy etc, but that has been out since around 2004/5.
    Proper class functionality is create and destory!?

    Proper class functionality is polymorphisim. PHP does not have proper a polymorphic implementation. This is because people who promote its use, don't understand the merrits of this (source http://stackoverflow.com/questions/7...y-polymorphism )
    Quote Originally Posted by Flash477 View Post
    One of the things with ASP is that you need to invest in more hardware and pay licence fees to Microsoft in order to run it, whereas PHP runs on Linux (and Windows!), which requires less hardware for the same performance and no licence fees.
    Hardware, utter bollocks, Zend optomiser is needed to get close to .Net performance. I would love to see one suggestion that performance is better at any operation in PHP without compiling it somehow such as Zend. You also have m0n0rail and the like which do not require MS license.
    Quote Originally Posted by Flash477 View Post
    Sure it is well and good that you are able to programme ASP.net in a number of different languages, but if you have someone programme it in say J# (or any of the other countless languages), but you only know C# then you are pretty much screwed for making changes. PHP on the other hand changes very little, so if you know PHP you can work on any project that has been done in PHP. This also means that you can move PHP projects from version to version with generally no changes required.
    But what if you want to use a library written in F# (seriously, no one uses J#, its not actively maintained and is just ****.) or Boo or Nermal? Not a problem. People don't generally write projects in multiple languages without a damn good reason. A common use for VB.NET is its great XML handling with Linq To XML and inline support for it. That would be a case of a 'DSL' or Domain Specific Langauge. In the hands of good devleopers, those, are a VERY good thing.
    Quote Originally Posted by Flash477 View Post
    ASP.net also requires compilation, which although may have some advantages, it does mean that it is harder to make small changes and also requires a package with which to do it, whereas all you need is a text editor for PHP and if there is a quick fix that needs doing you can do it from anywhere as the source code is right in front of you.
    You need an environment running PHP with the interpreter, you have to drop the code live, you surely have to go through the unit tests and QA right? You do that before releasing right?

    As soon as you've more than 1 dev you must have CI and SC anyway, so that as a downside is a moot point.
    Quote Originally Posted by Flash477 View Post
    I'm sure that out of the box ASP.net has more widgets that you can use, such as in form building and displaying data, but this can also be limiting. Also I'm not sure if it has changed a lot, but certainly in the past a lot of the widgets were very biased to IE.
    You actually have a lot more interoperability with .Net if you want to say make a SOAP interface for a really rich client? And also only the MS controls support just IE, why would vendors be so limiting?!
    Quote Originally Posted by Flash477 View Post
    As long as the coding is done using a proper MVC methodology then PHP can do an awful lot, whilst being very easy to read and edit. It is just that a lot of beginners make the mistake of weaving their code throughout the html, rather than building central libraries and classes.
    It is not easy to read and edit, from 4 onwards the way they intended classes to be a glorified include system. Hell how many people even use DI with PHP?

    I have never seen any good code in PHP that isn't just a sprawl which makes sense only to its creators.

    I'd also hazard a guess you know nothing of the other technologies. Asp.Net might have commited vicious crimes with WebForms, but they were no worse (arguably better) than the PHP at the time. I still can not understand why anyone would still use PHP given the many alternatives, its hard to find one that is worse.
    throw new ArgumentException (String, String, Exception)

  15. Received thanks from:

    Shad (28-05-2012)

  16. #13
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by Flash477 View Post
    One of the things with ASP is that you need to invest in more hardware and pay licence fees to Microsoft in order to run it, whereas PHP runs on Linux (and Windows!), which requires less hardware for the same performance and no licence fees.
    *cough*

    In addition to Mono running on most things, I should point out that Microsoft released ASP.NET MVC under a Free Software license too.

    Please note that I'm not waving the flag for ASP.NET - I still haven't successfully converted my way of thinking to wither WebForms or MVC well enough to write something useful. I write PHP when I need to knock something together - but my code is **** and I know it.

  17. #14
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by Jonatron View Post
    Well i'd say it's crap because it wasn't really designed, it just kept having stuff tacked on. It's also had a lot of security problems over the years and it makes it difficult to be secure with functions like mysqli_real_escape_string (previously mysql_escape_string) and htmlspecialchars. It has too many ways to connect to databases (mysql , mysqli, PDO) and a ton of database abstraction libraries to choose from. There's no proper organisation or naming standards or standard parameter order to the standard library. You can't handle errors properly because not everything uses exceptions (which are fairly new to PHP IIRC).

    It does have a low barrier to entry and it's easy to deploy though.
    Quote Originally Posted by directhex View Post
    It's got a floppy scripting-language approach to type safety, which tends to be a horrible magnet for exploitable code (i.e. you need to manually sanitize everything, and someone always forgets once). And there is absolutely no logic behind the method names and arguments - everything started life as a "we should have a command which does foo" without the slightest bit of thought as to why and how.

    It works, don't get me wrong, but it's not been "designed", ever - it just sorta happened, then kept sorta happening until this day.
    Got ya Thinking about it, I do get this. If a function needs a haystack and a needle, I never know if it's ($needle,$haystack) or ($haystack,$needle). Regarding sanitizing, I guess I've never really considered it a problem, because I've always done it myself and always considered something that needs doing myself. But again, this is a problem in itself and I shouldn't really have to think this way (i.e. be expected to get it right each time)

    I have never seen any good code in PHP that isn't just a sprawl which makes sense only to its creators.
    That's subjective, I've seen plenty of good PHP code.

  18. #15
    Senior Member
    Join Date
    May 2009
    Location
    Norfolk
    Posts
    474
    Thanks
    3
    Thanked
    26 times in 26 posts
    • pipTheGeek's system
      • Motherboard:
      • Asus P6T Deluxe
      • CPU:
      • Core i7 920 @ 3.6GHz
      • Memory:
      • 3 * 2Gb Corsair XMS @ DDR3 1800
      • Storage:
      • 300GB 15K SAS + 500Gb
      • Graphics card(s):
      • GTX570
      • PSU:
      • corsair 760i
      • Case:
      • Corsair 550d
      • Operating System:
      • Windows 7
      • Monitor(s):
      • Dell Alienware 23"
      • Internet:
      • VM 50Mb

    Re: Why would I use ASP.net instead of PHP?

    Quote Originally Posted by Flash477 View Post
    ASP.net also requires compilation, which although may have some advantages, it does mean that it is harder to make small changes and also requires a package with which to do it, whereas all you need is a text editor for PHP and if there is a quick fix that needs doing you can do it from anywhere as the source code is right in front of you.
    You'd never do that though? Right?

    However, ASP.NET does allow this. If you create a web site instead of a web project you just drop all the source on the web server and IIS sorts out the compilation. If you change a file, IIS detects it and re-compiles. It does cause the worker process to recycle so in-process session state will be lost, other than that no one using the site would notice.
    Even if you stick with a web project, deployment is hardly a hassle. Compile the code, copy the necessary files to the web server. Only difference is you dont need to copy the .cs files (or .vb etc...) but you do need to copy the bin folder.

  19. #16
    Not a good person scaryjim's Avatar
    Join Date
    Jan 2009
    Location
    Gateshead
    Posts
    15,196
    Thanks
    1,231
    Thanked
    2,291 times in 1,874 posts
    • scaryjim's system
      • Motherboard:
      • Dell Inspiron
      • CPU:
      • Core i5 8250U
      • Memory:
      • 2x 4GB DDR4 2666
      • Storage:
      • 128GB M.2 SSD + 1TB HDD
      • Graphics card(s):
      • Radeon R5 230
      • PSU:
      • Battery/Dell brick
      • Case:
      • Dell Inspiron 5570
      • Operating System:
      • Windows 10
      • Monitor(s):
      • 15" 1080p laptop panel

    Re: Why would I use ASP.net instead of PHP?

    Bleurgh, so many silly and incorrect points (which thankfully have mostly been picked up already).

    Why would you use ASP.NET instead of PHP? Dunno, I can't speak for you

    I can tell you why I use it though: a proper object/class model. The choice of either chucking everything into a traditional web-script style page, or carefully separating out the logic and display elements of my website/web application. The huge power of the .NET framework - ALL of it - at my beck and call. The immense flexibility of being able to use webforms (although why you'd want to I don't know), MVC, or doing my own thing entirely. Because MS will give me a well-featured IDE/server for absolutely nothing. Because I have a choice of languages to develop in.

    In fact, there's really no comparison between ASP.NET and PHP. A better comparison would be ASP.NET and JSP, tbh. PHP does not, and will probably never have, the depth of framework behind it that .NET and Java have. Don't forget that the .NET framework is built for writing fully-featured desktop apps as well as web-based stuff, and the entire thing can be called from an ASP.NET application, so you have stupidly large amounts of power and flexibiltiy available. In fact, I've probably only scraped the surface of the reasons I'd rather use .NET than PHP, and I've spent about half an hour composing this post. In case you hadn't noticed, having used both for a variety of projects I'd much rather do everything in .NET, and wouldn't do anything beyond the simplest web sites in PHP (given a free option, obviously).

    Oh, and lest I forget - if you're doing anything data-related at all, the classes within .NET for dealing with data handling are significantly more intuitive than anything I've found within PHP.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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