Fog Creek Software
Discussion Board




PHP / ASP : Side by Side Comparison?

Hey guys,

I've been looking into learning PHP, but was told that ASP is very similar, and should be considered as well. Can any of you provide me with a run down on some of the similarities between the two, as well as the differences? What are the advantages and disadvantages to each? Which one would you choose, and why?

HeyCoolAid!
Tuesday, November 11, 2003

ASP is history! Get your hands on ASP.NET (www.asp.net)

qwerty
Tuesday, November 11, 2003

Are you taking about ASP or ASP.NET as they are very different beasts.  PHP beats ASP hands down, no contest, move along.  However, a comparison between PHP and ASP.NET is a bit more complicated and ultimately it depends on your needs.

A *very* old, why php is better than asp:
http://php.weblogs.com/php_asp_7_reasons

From Microsoft, PHP vs. ASP.NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/phpvsaspnet.asp

I haven't gotten to much into ASP.NET programming but I'm very fluent in PHP and ASP.  Let me know if you have any specific questions.

Almost Anonymous
Tuesday, November 11, 2003

Well ya, the .net part is a given... but what else?

HeyCoolAid!
Tuesday, November 11, 2003

They are essentially the same, although VBscript is a crippled and pathetic language, while PHP is a bit more useful. PHP runs poorly on Windows, ASP runs naught on *nix.

ASP.NET is the 'future' on the Windows platform.  It's quite different than the scripting paradigm - more of a "write code to write code" system.  If you're a fan of the VB-style of dev, you'll feel right at home with ASP.NET.

Despite claims from the Microsoftians, the shift from scripting to OOP is not as "revolutionary" as the hype would have you believe- ASP.NET is less about OOP and more about code generation - so I think that without VS.NET, the productivity gains aren't so great.

For someone who's got a fairly large library of datagrids and form builders in 'classic' ASP and PHP, ASP.NET's built-ins are hardly cause for excitement. 

Matthew Lee
Tuesday, November 11, 2003

I personally believe that well-written ASP.Net will be far more maintainable than wel-written ASP or PHP. Also don't forget that ASP.Net knowledge is portable - learn .Net & C# or VB.Net and you can write web apps or windows applications or Windows Services or web services...

Learn PHP and you can write web apps.

Philo

Philo
Tuesday, November 11, 2003

If you truly think that ASP.NET & ASP are of minor variance, then you quite simply must not be using ASP.NET correctly: Being able to properly "objectify" and black-box code into self-contained entities is absolutely beautiful in ASP.NET, and makes the limitations of ASP all the more obvious (of course with ASP and the WSH, you could make rudimentary script "objects" that get wrapped with COM callable wrappers). Atop that the massive functionality that the .NET Framework brings into ASP.NET development is fantastic, though of course ASP itself had limitless expandability via COM.

Dennis Forbes
Tuesday, November 11, 2003

"I personally believe that well-written ASP.Net will be far more maintainable than wel-written ASP or PHP."

I don't see why PHP is harder to maintain than ASP.NET. 

ASP is hard to maintain because the platform (it's not really a language) doesn't provide much in the way of facilities to aid this.  The only modularity you have in ASP is from it's crude <!--include--> functionality which is extremely limiting.

I just finished rolling out a 1,000 file web project in PHP.  There are no problems maintaining it; it's well structured and modular.

Almost Anonymous
Tuesday, November 11, 2003

Hrm, okay - guess I need to learn PHP then. I was under the impression it was a variant of ASP (inline scriping for HTML/Javascript generation).

My apologies for the uninformed opinion. :)

Philo

Philo
Tuesday, November 11, 2003

"Also don't forget that ASP.Net knowledge is portable - learn .Net & C# or VB.Net and you can write web apps or windows applications or Windows Services or web services..."

I would agree that C#, VB and .NET framework knowledge is portable - but ASP.NET knowledge ain't really so useful outside of making web apps.  It's just another way to do it, this time without having to know HTML, Javascript, or basically anything about what you're doing. ASP.NET reminds me of "Drumbeat 2000 / Allaire Spectra / Macromedia Ultradev"

And yeah, PHP is only good for Web apps, but that's OK.  We're already expected to know 10 languages anyway, and PHP is an easy one to know.

If your goal, as the poster above states,  is to "properly "objectify" and black-box code into self-contained entities ", than ASP.NET (or Java) is for you.  To me, this is really not a productivity issue until we start talking about big LOC numbers.

I've always been a fan of "learn em' all".  Unless you're vendor-committed, there's plenty of room for different tools.  ASP.NET is fairly easy to get going with, as is PHP- no reason not to learn them both.
As always it depends on your needs, your knowledge, and your project.

Matthew Lee
Tuesday, November 11, 2003

when it comes to dynamic websites I always preferred coldfusion.  So simple yet so powerful, with a great database abstraction layer.

I wonder where that stands in the marketplace today?

i like i
Tuesday, November 11, 2003

Philo- you're right - PHP is an inline HTML language.

Thing is, you don't have to put any HTML in your scripts at all. Most of my apps are written without a smidge of inline HTML.  Most of the better PHP people are using template classes (think Mason or Freemarker) to pull data-bound content into separate, static HTML files.  This is very  different even from the ASP.NET model- which, without codebehind- still runs ASP.NET inline with HTML (Look at what the Web Matrix generates).

ASP.NET is very similar to the JSP custom tag concept, where XML is used to declare "widgets" containing some logic and display capability.  ASP.NET is also event-driven, like VB.  My experience with ASP.NET is that this leads to a very GUI-bound application.  Not necessarily a bad thing - but not something I'm necessarily used to as a Web developer.

The biggest difference is that PHP lacks the capability to define business objects in a application-neutral way -  this is the biggest deficiency in PHP.  In Java or ASP.NET, you can wrap a class and "Web" it- PHP has nothing like that.

Again- I simply do not feel there's a clear-cut win for ASP.NET on any level.  It's a choice- and certain developers will latch on to it- others won't.  At the end of the day a Web app is a Web app.

As for Coldfusion- I live in a "second-market city" and CF is in wide use- mostly due to it's appeal to non-porgrammers.  To me CFML is the worst of the lot for writing maintainable code- but it was definitely first on the block with using tags to simplify routine tasks.

Matthew Lee
Tuesday, November 11, 2003

Having worked in PHP for 4 years and a beginner in ASP.NET,

I completely agree with what Matthew has to say.

Your choice between ASP.NET OR PHP depends on many a factors and one needs to evaluate all the requirements to arrive at a decision.

JD
http://jdk.phpkid.org

JD
Tuesday, November 11, 2003

I have a semi-related question: I tried PHP a couple years ago, and absolutely LOVED the language, but the app I wanted to use it for is very database-intensive (MSSQL), and I found the database options faily immature. Has this improved in the past couple years?

Troy King
Tuesday, November 11, 2003

I haven't used ColdFusion since 4.5, but ASP.Net really has a LOT of ColdFusion concepts built in - IMHO it's a lot like the best parts of ASP, CF, and JSP combined.

Philo

Philo
Tuesday, November 11, 2003

"I have a semi-related question: I tried PHP a couple years ago, and absolutely LOVED the language, but the app I wanted to use it for is very database-intensive (MSSQL), and I found the database options faily immature. Has this improved in the past couple years?"

PHP supports all major database platforms (Oracle, MSSQL, etc) directly as well as via ODBC.  It was a bit crude to make use of these in the past but now PHP has several good abstraction layers including PEAR-DB and ADODB.

Almost Anonymous
Tuesday, November 11, 2003

"Philo- you're right - PHP is an inline HTML language.
Thing is, you don't have to put any HTML in your scripts at all. Most of my apps are written without a smidge of inline HTML."

I make use of the inline capabilities only as a template engine (why use an external engine when you can just include PHP code in HTML).  Basically 100 files or so out of my 1,000 files contain any HTML.  It's considered bad practice in PHP to mix your PHP code and HTML for anything but display purposes.  Although it is fairly common to make small (1-2 page) apps in PHP which do that.

Almost Anonymous
Tuesday, November 11, 2003

I agree with Philo.

ColdFusion rocks.  After using CF, using PHP and ASP (non-dot-net) seemed painful by comparison.  I've only played around with ASP.Net a little bit, but it seems to have borrowed the good stuff from CF.

If I were starting out from scratch, I'd probably learn ASP.Net.  CF isn't very popular these days.

That said, CF is NOT going away anytime soon.  It's just too good of a tool.

Myron A. Semack
Tuesday, November 11, 2003

"That said, CF is NOT going away anytime soon.  It's just too good of a tool. "

I agree, even though I'm no  fan of CF.  I think all these tools - CF, Perl, JSP, ASP, CFM, .NET - I think all of em' are gonna be around for quite a while. 

The Web's just settling in. We got enough tech, let's worry about putting something up that matters.

Matthew Lee
Tuesday, November 11, 2003

"The Web's just settling in. We got enough tech, let's worry about putting something up that matters. "

Hey, can I add that to my .sig file?

Philo

Philo
Tuesday, November 11, 2003

It would be an honor, Philo.

That is, if you're not being sarcastic. :-)

Matthew Lee
Tuesday, November 11, 2003

Well, there's also PHP GTK (http://gtk.php.net/), which allows you to write GUI apps on top of the GTK environment.

TJ Haeser
Tuesday, November 11, 2003

"PHP runs poorly on Windows"

Actually, from what I heard PHP 4.0 on Windows , even on IIS, outperforms ASP. It probably runs faster on Apache and UNIX, but it still runs reasonably on Windows.

Shlomi Fish
Thursday, November 13, 2003

I've run PHP 4.2 on windows and IIS as a testbed for a site I was building.

I didn't do any speed tests, but stability was awful. It crashed IIS several times, and would often just stop serving pages. I had to bounce IIS every half-hour or so.

Chris Tavares
Thursday, November 13, 2003

I have been using php for the about a year. I found php is very interesting and powerful. I can do almost any kind of application by using apache, php and MySQL.

Specially if you want to learn hacking web sites, PHP is the right choice.

Shaphyx
Wednesday, April 14, 2004

*  Recent Topics

*  Fog Creek Home