SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 30 of 30

Thread: asp.net vs php?

  1. #26
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Whether you can do things easier in .NET than you can with PHP would depend on which programming language you run under .NET in the same way that different things can be done easier in different languages under CGI.
    I beg to differ. While C# is arguably a much more powerful language than PHP, the power of ASP.NET comes first and foremost from the framework itself (ASP.NET: System.Web.* namespace), secondly from the rest of the .NET framework which you can leverage for web apps, such as drawing, imaging, workflow, threading, communications, data access, xml, serialization, remoting, string handling, regular expressions, cryptography, file IO etc.

    All of this is available regardless of the language. It is a big mistake to believe that ASP.NET is about programming languages. Indeed, ASP.NET is programming language agnostic. You can use Python, Ruby and even PHP (one of the .NET ports) with the framework as well.


    ---
    Btw, who uses CGI any more? PHP is almost exclusively deployed as scripts executed by mod_php. No CGI. Rails deployed on mongrel with a lighttpd front is using FastCGI. CGI does not scale at all. It launches a process for each and every request; it has a tremendous overhead.

  2. #27
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    In either case usage of the alternative languages would shift and that isn;'t happening to any significant degree.
    That may be so, but check out the usage stats for PHP. PHP usage peaked in september 2005. Since then PHP usage has dropped; only now levelling out.

    But in the meantime (according to netcraft) the Internet has almost doubled both in terms of sites and IP addresses.

    Which means that PHP is losing marketshare, fast! It has been more than cut in half since the peak in sept. 2005. So, while you may be right that there's not a mass exodus, it sure looks as if PHP has a hard time holding on to existing sites let alone attracting new ones.

    I don't buy into the "job offer statistics" as a measure of the popularity of a framework/language.

    But right now, PHP does not seem like a good career move.

    Note: The public Netcraft statistics do not hint about which platforms is on the rise. However, I suspect that Rails is attracting most of those sites/startups/developers who would otherwise have gone for PHP. My gut feeling is that Rails and (to a lesser extent) ASP.NET is gaining; PHP and (overall) Java is slowly, steadily declining.

  3. #28
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Totally agree with honeymonster.

    Just as a very basic example, it's extremely simple to communicate with web services using ASP.NET. In PHP, developers have had to rely on third party libraries for any SOAP communication, up until PHP5, and it is still not as easy as in ASP.NET.

    Further in the way of RPC, there's .NET remoting, which PHP has absolutely no equivalent to.

    There are many, many more examples of things that ASP.NET does a whole lot better and more efficiently than PHP. honeymonster covered these points very well above though.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  4. #29
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,861
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The last couple of years have seen an explosion of new languages such as Ruby, Python etc. so they will have taken market share from the languages that they directly compete with.

    In what way is PHP.NET less efficient than say VB.NET? Surely any language running on a .NET framework has the same capabilities provided to it by the framework.
    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="^$">

  5. #30
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    In what way is PHP.NET less efficient than say VB.NET? Surely any language running on a .NET framework has the same capabilities provided to it by the framework.
    If we're talking efficiency as in execution efficiency (performance) there is several key differences:

    PHP is an interpreted language; VB.NET is a compiled language. Interpreted languages are notoriously slower than a compiled equivalent. Even if you succeeded in making a compiler for PHP, the imperative nature would still impede it. Consider how a class is built by executing code. You can't just have a compiled PHP class definition sitting in a compiled file. You need to execute code which builds a class definition. The same code may actually mean different things depending on the environment, i.e. the script which included/required the code. VB/C# has a context-free grammar which guarantees that a class definition is always considered the same, independant of the code which uses it.

    PHPs dynamic typing nessecitates frequent run-time type checks. In a statically typed language these checks are performed during compilation.

    PHPs weak types incurs overhead when doing type coersions.

    Methods of PHPs classes are all dynamically overridable by name. Every single method call (and even field references) is going to perform a lookup in a hashtable to retrieve the method/field entry point. Methods in VB/C# are non-virtual by default. Non-virtual methods are extremely efficient, as their addresses can be resolved at compile time. When using virtual methods, the actual address cannot be resolved at compile time, but the "method slot number" can. Thus it only incurs an indirection overhead, which, incidently, modern processors are optimized and well-equipped to handle efficiently.

    The static nature of VB/C# allows for static analysis which again enables a number of advanced optimizations, such as inlining, tail recursion elimination etc. You cannot do similar analysis in a dynamic language like PHP, hence these optimization techniques are out of reach.



    In terms of capabilities (meaning access to features?) anything executing on .NET would (as a rule) have access to the same .NET framework capabilities. However, some capabilities are because of the language, e.g. closures.


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
  •