views:

144

answers:

3

I'm working with a PHP developer who is, shall we say, unhappy with .NET. His complaints include having to rebuild the web application solution for every test (though I pointed out that this is usually only necessary if a .cs file has been changed, not interface .aspx files), having to include every file in the solution that is required to be deployed, etc.

I've pointed out a number of advantages of the compiled model including RTTI (reflection), source code integrity (source isn't deployed to the server, keeping meddlesome IT people from modifying it on-the-fly), performance differences (though he insists that this isn't valid since PHP is now "compiled"), etc. What are some other advantages of .NET over PHP? This may incite a religious debate - please God, no - but I'm such a fan of .NET that some of these questions which I asked years ago seem so silly that I can't articulate a valid response.

There also seem to be significant differences in the way in which he goes about developing a page. For instance, declaring a class which represents part of a page - say, a particular column in a 3-column layout - rather than breaking up the code in a more logical fashion and relying on the .aspx to handle layout. It strikes me as odd that page layout would, in any way, be tied to class structure beyond that of the code-behind for a aspx page.

Comments?

UPDATE BTW, this is an old question, but I felt it necessary to update with a few points:

  1. Optimization This is a big one. Compilation provides the opportunity to perform some optimizations that aren't practical to perform during the JIT.

  2. The article that o.k.w referred to is so obviously biased and created by someone that hasn't worked a significant time in .NET that it's hardly worth reading, (though I did). It also makes points that are entirely incorrect.

  3. It's damn near impossible to make Mac people realize that Windows has its place. On the other hand, most Windows guys I know think that Macs are great for a lot of things. Most even own one. We don't use them for developing websites or embedded systems for a reason. (And, yes, our business involves both, intimately.)

  4. First loves gone bad... excellent analogy. This will probably come out of my mouth in a meeting sometime soon.

  5. This debate is useless. I may as well try and convince the UK to drive on the correct side of the road. And Australia. And Hong Kong. And... you see where this is going.

Cheers.

+1  A: 

The primary issue is that, almost any advantages you can come up with for .Net can be achieved with PHP if a framework exists for it. I believe there are PHP MVC frameworks.

However, I will say this about the compilation model for ASP.Net, it's extremely helpful to know that there are no syntactical errors in all your code behind code. PHP and ASP Classic didn't have this. In a site of 400+ pages it was difficult to know which ones were and weren't functional with a degree of certainty.

Spencer Ruport
aspnet_compiler.exe ships with the .net framework. You can use it to pre-compile all the .aspx and .ascx in your app. I've started doing it as part of my build to catch errors in the front end as soon as possible.
Matt
+2  A: 

From what I understand (not having worked much in PHP myself) PHP is both powerful and easy to use, and really shines on smaller, simpler projects, particularly where the business logic consists mostly of moving content between a database and a web page. ASP.NET lends itself better to larger, more business-logic-intensive applications, where the compile-time checks allow you to catch errors sooner. Catching an error at compile time versus run time can make an order of magnitude of difference in how much time it takes to fix.

Where I work, we use PHP to build mockups to show customers and get them to sign off on our ideas, and then we write the actual product in a compiled language like .NET or Java, since that's the code we'll need to maintain for the next decade or more.

StriplingWarrior
+3  A: 

I work with both languages daily, and both are great for development. It's hard to get into the "compiled vs. interpreted" debate without getting all flamey and zealous, so I don't think I'll say anything about that. However, here are some of things I prefer about .Net:

  • Visual Studio vs. Eclipse.

  • No @includes, and real namespaces. I want to know about my types all the time, and not rely on weird hacky autoloading routines.

  • API discoverability. PHP has horrible, inconsistent API naming.

  • Compile time checking and code analysis

  • Superior debuggers and profilers

This isn't really anything to do with the models they use though, it's just attributes of the tools themselves. I wouldn't suggest trying to change his mind or even arguing with him about it - he'll either see the advantages himself or he won't, but pushing them on him will probably just make it take longer ;)

womp