Tales from the Evil Empire

Bertrand Le Roy's blog

News


Bertrand Le Roy


Add to Technorati Favorites Tales from the Evil Empire - Blogged

Blogs I read

My other stuff

Some comments on Oracle's comparison of PHP and ASP.NET

Oracle recently published an outrageous article in a rather strange attempt to convince people that PHP is the best platform to write web applications. Not ASP.NET, which is not surprising coming from Oracle, but not Java either, which is a little more puzzling.
 
In this blog entry, I'm explaining what I thought when I read this paper. The disclaimer on the left applies, of course: these are my own opinions, and I'm not talking on behalf of my employer.
 
This article is completely unreal. Arguing that PHP is preferrable to ASP.NET is a very difficult exercise. I can imagine the marketing people at Oracle ordering this article and determining its conclusions even before it was written... It is even touching to see that the author can't hide all of the ASP.NET qualities nor all the problems of PHP.
Let's read the article together and comment it along the way.
 
First, the subtitle, "One developer's view of the pros and cons of the two most popular means of building web applications" should probably be more along the lines of "One PHP developer who has no clue what ASP.NET is reviews what he thinks are the pros and cons of the two most popular means of building web applications". I've built applications for years with both systems before I was hired by Microsoft, so I can probably spot most of the many voluntary or unvoluntary errors and inaccuracies in the text.
 
In the first paragraph, the author tries to convince us that PHP and ASP.NET fall into the same category of web platforms that "[embed] code into HTML pages with special tags that signal to a preprocessor that they contain code, and that it should do something with it". This is true of PHP, but not of ASP.NET, where the code can, but should not be in the HTML markup. Instead, a well-written page would have a declarative or templated part (the aspx file) and some codebehind (or not) that orchestrates the controls and communicates with other layers of the application if there are any.
So whereas PHP follows the flow of the page and inserts dynamic text in some places, ASP.NET separates the code from the declarative markup and has a much richer page lifecycle. Most important, in ASP.NET, the execution flow is distinct from the markup's flow.
This difference is absolutely fundamental and differentiates a platform that encourages spaghetti code from one that encourages good design and separation of concerns.
The author also tries with this simple sentence to have us believe that the "special tags" of PHP and ASP.NET are equivalent. Nothing could be more wrong: while PHP only has tags to signal the limits of the server code from the rest of the markup, ASP.NET's tags are really abstract representations for full-blown controls that embed complex behavior (such as treeviews, grids, etc.). While one forces you to output raw HTML, the other enables you to use familiar widgets like those that you would expect from a desktop application framework. Using PHP to create web pages is a little like creating desktop applications with a tool that would force you to draw every control using dots and lines (just a little, I'm pushing the analogy: PHP is not THAT bad). Abstractions are good.
 
The second paragraph is very touching because the author explains us why he is so biased. No comment.
 
So what is ASP.NET to Oracle (except for a menace)?
 
"ASP.NET works with scripted languages such as VBScript, JScript, Perlscript, and Python, as well as compiled languages such as VB, C#, C, Cobol, Smalltalk, and Lisp". Wrong. ASP.NET works only with compiled languages such as VB.NET and C#. There are .NET compiled versions of "scripting languages" like Perl, JScript or Python, though, and that's probably what caused this confusion.
 
The next paragraph is more or less accurate, but let's note for later that the author is aware of the fact that the .NET class library contains classes that do "image manipulation". Later, he'll tell us that "with ASP, however, you're investing from the very beginning, and you're spending for add-on technologies—libraries for doing graphics manipulations, for instance".
 
"in ASP.NET, integration with databases can be accomplished through ODBC". Technically, he's not lying, here, but he fails to mention that ODBC is just one of several ways to access a database, the one that should be used only if all other options are impossible. There are direct providers for Sql Server and Oracle, and third parties offer native providers for all major databases (including an Oracle provider for Oracle databases, in addition to the MS provider). Most importantly, these APIs derive from a common base, which makes it almost equivalent from a developer's point of view to develop against Sql Server or Oracle, or any other database. Whidbey also makes it a lot easier to make your code database-agnostic (like, I have to admit, Mono did before us). More on this later.
 
"ASP.NET's strength lies clearly in its clean design and implementation. It is an object-oriented programmer's dream, with language flexibility, and with sophisticated object-oriented features supported. In that sense, it is truly interoperable with your programmers' existing skills. Another strength of ASP.NET is the development environment." Say no more. ASP.NET rules! Oracle says so!
 
But don't worry, the next sillyness is in view: "But what you gain in robustness, you pay for in efficiency. ASP.NET is expensive with respect to memory usage and execution time, which is due in large part to a longer code path."
Oh? Really? What backs these gratuitous affirmations? Execution time? Can we have some pointers to check that? Because as far as I know, a web platform that is natively compiled and that has built-in page and fragment caching is very likely to be faster than a scripted, non-cached platform. Of course, you can compile PHP using a free tool, but it's an afterthought. And you have to pay for the page caching solution, whereas it come for free with ASP.NET.
I can see where the memory thing comes from. It is true that if you open the task manager on a server that's running an ASP.NET web site, you could be a little frightened by the amount of memory ASP.NET uses, if you know nothing about servers. Guess what! Memory that's not used is useless. The rational thing to do on a server is to use the memory you have (to cache stuff, for example). The quantity of memory that's used by ASP.NET can be configured in machine.config if you feel you can tweak it better than the default setting (which you usually can't, that's why  it's the default setting).
The performance of ASP.NET is certainly sufficient for "small traffic" sites such as Microsoft.com, MSN, match.com, etc...
 
The "What is PHP" section is focused on database access, but fails to mention Sql Server as a possible database for PHP (this is an Oracle paper, after all).
It tries to convince you that database abstraction is bad (just to tie you to Oracle, but you got that part yourself) because you so badly need these marvelous Oracle features: LOB, BLOB, CLOB and BFILE.
This coming from the same people who will explain later that OS independance is an absolute necessity...

So let's summarize:
Oracle dependance: Goood!
Microsoft dependance: Baaaad!

Seriously, database independance is an important feature for many modern applications.
Due to the uncoordinated development by different teams, the database access libraries in PHP have been notoriously inconsistent to the point where the code you'd write to access a MySql database is different from the code you'd write to access a PostgreSQL database. Not in the SQL queries, which is more or less normal, but in the actual PHP code! So other people have developed so-called database abstraction layers (dba, odbc, etc.)... which do not work with all databases, and are of course largely inconsistent with one another as well as with any specialized provider.
 
In the "strengths and weaknesses", we only see weaknesses, except for platform independance (but not database independance), open-source development (if you happen to consider that as a strength), and "a smaller code path," whatever that means.
He misses a few other important weaknesses, like the fact that its library is terribly messy, being a function library instead of a hierarchical class library like that of .NET or Java, and having horrible names (can you guess what readline_completion_function does? It "Registers a completion function". Yes, I know, that's not very much clearer, but this is the kind of documentation you get with PHP: no sample, no clear explanation).
The author then goes on to showing us how great the new PHP5 is (whereas to say the truth, it barely gets where Python was years ago). The code example is absolutely hilarious. Anyone writing this kind of code in a job interview with me would be politely but immediately shown the door. I have to show you:
 
class blue {
 
  function openFile ($inFile) {
    if (file_exists ($inFile)) {
      # code to open the file here
    } else {
      throw new Exception
 ("Cannot open file: $inFile");
    }
  }
}
 
$blueObj = new blue ();
 
try {
  $blueObj->openFile ('/home/shull/file.txt');
 
} catch (Exception $myException) {
  echo $myException->getMessage ();
 
  # rest of exception handling code here
}
 
Do you really think you should throw an exception to test a perfectly normal application error condition? Shouldn't you throw and catch something more specific than Exception? Shouldn't openFile be static? This code sucks. Just write this instead:
 
$fileName = '/home/shull/file.txt';
if (file_exists($fileName) {
  #work with the file
} else {
  echo "File: $fileName does not exist";
}
 
If this is how you explain the benefits of OOP and structured exception handling to PHP users, we'll just get unamageable and ununderstandable object-oriented spaghetti code instead of plain unmanageable spaghetti code.
 
I'm skipping the "security comparison" FUD for now, I'll get back to it later. Let's go directly to the "database coding examples" section.
 
"With ASP.NET, however, it's a little more complicated, because you have the option of any of a number of languages to choose from." How that makes it more complicated and how it has anything to do with database programming elude me completely.
Let's look at the code sample. The PHP code does absolutely nothing except create and destroy a database connection (please note the "very elegant" error handling code, though). The destructor prints a useless message for no identifiable reason.
 
class oracle_object {
  protected $theDB;
  protected $user;
  protected $pass;
  protected $db;
 
  function __construct($u, $p, $d) {
    $this->user = $u;
    $this->pass = $p;
    $this->db = $d;
  }
 
  function db_open () {
    $theDB  =  @OCILogon($this->user,  $this->pass,  $this->db);
    db_check_errors($php_errormsg);
  }
 
  function db_close() {
    @OCILogoff($theDB);
    db_check_errors($php_errormsg);
  }
 
  function __destruct () {
    print ("so long...");
  }
 
}
 
Many things can be said about this code: the fields are not encapsulated, and it is generally not a good idea to open a connection if you're not going to use it right away (because of connection pooling), so if you write a database access helper class, opening and closing the connection should be done just around the request to the database itself. At least in .NET where the connection pool is automatically managed.
And now, the VB.NET code that is supposed to be equivalent to the one above:
 
Imports System
Imports System.Data
Imports System.Data.OracleClient
Imports Microsoft.VisualBasic
 
Class Sample
 
  Public Shared Sub Main()
 
    Dim oraConn As OracleConnection = New OracleConnection("Data Source=MyOracleServer;Integrated Security=yes;")
 
    Dim oraCMD As OracleCommand = New OracleCommand("SELECT CUSTOMER_ID, NAME FROM DEMO.CUSTOMER", oraConn)
 
    oraConn.Open()
 
    Dim myReader As OracleDataReader = oraCMD.ExecuteReader()
 
    Do While (myReader.Read())
      Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", myReader.GetInt32(0), myReader.GetString(1))
    Loop
 
    myReader.Close()
    oraConn.Close()
  End Sub
End Class
 
Why are they skipped lines in there? To make the code seem longer? And who wouldn't notice that this code does a lot more than the PHP code?? It opens a connection, queries the database and outputs the results before it closes the connection. So what does this prove? Absolutely nothing.
 
It should be pointed out that displaying database data in a table in ASP.NET Whidbey is as simple as that:
<asp:SqlDataSource runat="server" ID="myDataSource" DataSourceMode="DataReader"
  ConnectionString="<%$ ConnectionStrings:MyOracleConnectionString%>"
  SelectCommand="SELECT CUSTOMER_ID, NAME FROM DEMO.CUSTOMER" />
<asp:GridView runat="server" ID="MyGridView" DataSourceID="myDataSource"/>
 
Of course, this is the quick and dirty solution, and you can substitute an ObjectDataSource to the SqlDataSource if you have properly defined your own DAL, business and service layers.
 
Now, let's "make a choice"... The author pretends to think that "[PHP's] only weakness is its lack of a pure and perfect OOP implementation". Err, see above. He then says "Though language constructs do help, ultimately, good coding is a matter of practice, execution, good habits, and discipline". Sure, but what if you are incapable of that? I'm not pointing to anybody... Oh well, yes I am.

We now can read a very informative (not!) table "summarizing" the weak and strong points of each platform. The criteria that have been chosen are completely arbitrary, as well as the "values" in the table (what do $$, weak or strong mean? Is it something that I can measure? How much is $$?). We also note that ASP.NET security is "strong" whereas one of the main points against it according to the author is precisely the security. Consistency anywhere?
 
Price. ASP.NET is free, and the TCO of Windows Web Server Edition can be favorably compared to that of a LAMP approach (see http://www.microsoft.com/mscorp/facts).
 
Speed. I really don't know. I have yet to read a performance study that compares PHP and ASP.NET performance. If anyone knows one, I'd be happy to talk about it. The article does not point to such a study. PHP has a reputation for speed, as does ASP.NET.
"Speed is not the only consideration. Memory usage is also important." See above? Why is that important? We won't find out from the article.
 
Security. This is my favorite part. After all the usual FUD about IIS security, the author gives us a link to a site that proves him wrong. This is very nice of him. Let's follow the link to www.securityfocus.com and do less than 5 minutes research. First, let's do a search on IIS 6. The first article that comes out has this to say about IIS:
"[IIS] provides a reliable and secure infrastructure to host web applications."
Then, let's look for vulnerabilities: choose Microsoft / IIS / 6.0. Results:
1 (One!) x-site scripting vulnerability in a web administration tool that's not even installed by default
And three for ASP.NET
 
OK, let's do the same for Apache 2. Results:
25 (Twenty-five!) vulnerabilities, including DOS and Buffer Overflows
Wow, that's a lot! Let's look for PHP 4 now... Results:
19 (Nineteen!) vulnerabilities, including integer overflows, arbitrary file disclosures, cross-site scripting, etc.
 
Is this guy so stupid that he really thinks noone will click his link and verify what he claims? Or does he think his readers are stupid? In either case, I wouldn't give him a web site to develop...
 
Cross-platform applicability. Sure, if that's really paramount to you, choose J2EE ;) at least for the moment...
 
Open-source opportunity. Sure, if that's important to you. If consistency and accountability are more important, then I guess that's a different story.
 
And of course, one thing you won't hear about in Oracle's article is developer productivity. ASP.NET is the platform that will make your web developers the most productive, because it manipulates higher level abstractions, it handles all the plumbing for you and it encourages reusable code. But Oracle doesn't want you to know about that.

Comments

Mike Kozlowski said:

That Oracle article was one of the lamest, most preposterous pieces of cheerleading I've seen since Dave Massy said that he was afraid to use non-IE browsers for security reasons.

I mean, c'mon, PHP? Back in 1996, when I was writing CGI apps in Perl, I would've turned up my nose at PHP. It's a horrid little hack of a platform that nobody in their right mind would ever want to use -- it's as if somebody saw ASP (a horrid little hack in its own right) and made a cheap rip-off without even bothering to develop a proper language in which to embed their page-template stuff. At least when Sun ripped off ASP with the original JSP spec, they had the decency to graft it on top of fundamentally sound technologies.

But not only is PHP bad in comparison to other antiquated techniques, it doesn't even bear comparison with modern development methods. JSP 2.0 with JSTL (and possibly JSF, which I haven't had a chance to really try) is amazingly better than old, hackish JSP. ASP.NET is incredibly advanced over old, hackish ASP. PHP 5 is... a slightly better lousy hack than it used to be. Um, yay.

# July 23, 2004 9:42 PM

Andrew Storrs said:

I know many former PHP programmers (myself included)...

"former"... Nuff said. :)
# July 24, 2004 2:27 AM

Muntedhar "Pzycoman" Alhakim said:

That article is just plain silly.

It lists ASP.NET as Slow, as opposed to PHP which is fast.

I did this tests a long time ago (about a year, maybe more) - http://www.pzycoman.myby.co.uk/lspeed.html

Even with a precompiling doohicky (Zend Accelerator) (Which kind of makes the tests unfair, as there arnt many ASP.NET accelerators), its still as slow as a 3 legged rocking horse.

In the same time (roughly) it took PHP to do 8 million calculations, ASP.NET did 1.6 Billion.

Enough said :)
# July 24, 2004 2:47 AM

Matt said:

That's a very basic test, and I hope the results aren't due to compiler optimisations. The compiler should be able to get rid of the comparison entirely!
I prefer ASP.NET myself, but that test is as bad as Oracle's info.
# July 24, 2004 3:39 AM

Jouni Heikniemi said:

Bleroy: Many good comments, too bad some of them got a bit too biased and personal - they're just eating the credibility of your writings.

There's one point I'd like to comment on: "Open-source opportunity. Sure, if that's important to you. If accountability is more important, then I guess that's a different story." I don't think there's much Microsoft can defend itself with against that claim. For most products, I can't really say MS has been very responsible and accountable. The lack on open information flow and the relatively slow speed of fixing bugs and providing patches is certainly a factor when considering whose products to deploy.

Many open source groups manage to provide much more reliable and useful customer support than Microsoft has traditionally been able to offer. This especially has been true for many of the Internet applications. Add in the possibility to do (no matter how unsupported) custom hacks, and there certainly has been an air of flexibility around LAMP platforms when compared to the stagnation of ASP.

That said, Microsoft has taken significant leaps with ASP.NET, the new developer community (not to ignore this blogging business) and now with Whidbey's relatively open bug tracking. Even though the direction is right, you'll need years more to convince people to trust on Microsoft's accountability. One of the greater things working for you is the developer community that now has sufficient role and publicity to actually make things work. Some people will be very dubious, but time is a good healer.
# July 24, 2004 4:19 AM

TrackBack said:

# July 24, 2004 4:28 AM

Bysza said:

Oracle article sucks...

Since I can't say more than all my predecessors already said, I may pinpoint this: section "Database Coding Examples", "ASP.NET Connecting to Oracle" is... wrong.
It's not ASP.NET connecting to Oracle, but a *console application* connecting to oracle and printing two column contents to the console... :D
# July 24, 2004 8:55 AM

TrackBack said:

ASP.NET vs PHP - Counterclaim to Oracle's FUD
# July 24, 2004 8:58 AM

Bertrand Le Roy said:

Jouni: I won't pretend I'm not biased. I work for Microsoft. I just hope that I'm less biased than the Oracle article author.
But what I mean by accountability (at least for ASP.NET as that's my team) is that if you have any trouble with our software, you know exactly who to turn to, and you can be sure that support or direct contact with one of us through mail, newsgroups or the ASP.NET forums will very quickly find a solution.
I know that when I was a Microsoft customer, every time I had to use the support, I got commitment and I got a solution.
I also know that the last time there was a widespread virus/worm for Windows, there was a company-wide effort from many non-support employees to provide free support to the general public to help get rid of the vermin.
We still have some progress to make, in particular for community support, but I think we're getting there fast, as you seem to have noticed.
# July 24, 2004 10:04 AM

Larry Osterman said:

It's off topic, but, I've got to ask: Bertrand, how did you get real links to show up in your comments section? Every time I've tried to do that, the HTML gets quoted...
# July 24, 2004 12:18 PM

TrackBack said:

Well, I don't agree that PHP is any simpler for beginners, especially with Whidbey. Our usability studies show quite a different situation. It certainly looks more familiar to people who have done some classic ASP or JSP development, but a complete beginner will start faster with VS.NET + ASP.NET than with PHP...
# July 24, 2004 2:36 PM

Jouni Heikniemi said:

All right Bertrand,

Since you almost asked for it ;-), I'll use this opportunity to ask you for an answer to one of my news group postings quite some time ago. Any chance you could tell me what's going on in the following:

http://groups.google.fi/groups?selm=Xns949197CADD5E4jouninews2heikniemin%40194.100.2.89

Unanswered mysteries are the things that make me yearn for a totally open bug reporting system. Let's see if this one actually becomes a non-mystery :-)
# July 25, 2004 1:11 AM

Bertrand Le Roy said:

Jouni: First check this: http://support.microsoft.com/default.aspx?scid=kb;en-us;833268. I don't think this is your problem, though, but it's worth checking.
Your problem is probably a conflict that happens when you hit the second control. Naming conflicts can appear as all pages and controls are automatically compiled into the same _ASP or ASP namespace. In Whidbey, this problem was solved, but in the meantime, the recommended fix is to specify the ClassName explicitly in the @Control directive so that even though the file name is the same, the controls will have different class names.
# July 25, 2004 3:00 PM

Jouni Heikniemi said:

Yep, that much I figured and we've been using ClassName already. It's a bit problematic at times, but it does fix the immediate problem. Looking forward to Whidbey, then. Thanks for confirming my thoughts on the issue. Another score for Microsoft's developer support - keep it up :-)
# July 25, 2004 3:49 PM

DevNull said:


PHP runs on almost every platform ASP.NET does not.
PHP runs on over 60% of the webserver today ASP.NET does not.
PHP is free/open ASP.NET is maintained by one company.

the above things a for me way more important that if its takes 5 or 7 seconds to get a result. ASP.NET may be faster but i guess its a lot more restrictbie and un-flexiable than PHP.

# July 26, 2004 6:43 AM

Toast said:

Personally, I prefer PHP as I'm not restricted to any platform. I've got Apache, PHP and MySQL running on MS and OSX and Linux and for the hobbyist developers without a corporate budget or enough cash around, going for a LAMP setup is a lot more realistic.

Another thing I like about PHP is the extensions that can be got for it. From different databases to graphical libraries to PDF generation to SWF generation, there's a lot that can be done and even though PHP mightn't be as english-like in its syntax, once it's practised, it's no problem to read and write.

That's my two cents anyway.
# July 26, 2004 7:12 AM

Richard Moore said:

The file open example is still wrong in your corrected version - it ignores the possibility that the file exists but is not readable by the user the script is running as. A better solution would be to try to open the file and either handle the resulting exception or rethrow it.
# July 26, 2004 8:14 AM

TrackBack said:

I read this in the comments to a reply to the PHP vs ASP.NET crap Oracle posted. Mike Kozlowski wrote: That Oracle article was one of the lamest, most preposterous pieces of cheerleading I've seen since Dave Massy said that...
# July 26, 2004 9:04 AM

Caruccio said:

"Memory that's not used is useless."

today, 1GB RAM is not enough for a web server... if all your process become memory-eaters, your server will get down soon... at this point, I think ASP.NET fails (like almost Microsoft solution).
# July 26, 2004 10:25 AM

abc said:

hey,

why all think that ASP.NET runs only on MS Windows?
look at http://www.mono-project.com/about/index.html


some fixes for:
1. PHP runs on almost every platform ASP.NET does not.
2. PHP runs on over 60% of the webserver today ASP.NET does not.
3. PHP is free/open ASP.NET is maintained by one company.

solutions:
1. use mono
2. apache + ASP.NET mono module
3. 1, 2 -> ASP.NET is !!!NOT!!! maintained by one company.

# July 26, 2004 10:32 AM

Shike Maffer said:

abc's comments mirror mine...if multiple OS's is the acid test in the argument, why not consider mono?

There is nothing in PHP that you couldn't do in traditional ASP. With ASP.NET, Microsoft addressed many things and turned it into a real web development architecture. If you don't like it because it's Microsoft, that's fine. But as Bertrand points out in his response, the real agenda here is Oracle. You remember Oracle, the company that is in bed with Java? So why pimp PHP? Simple, because Oracle dependence is OK, Microsoft dependence is not. Dead on Bertrand, dead on. Oracle has been whining about Microsoft's dominance for years...they aren't arguing against market dominance/reliance...they're arguing about it not being to their benefit. Oracle and Sun (to throw them in here too..) have always shown that when they are the vendor that you must rely on, that they are as ruthless, gouging and uncaring as they claim Microsoft is.

And lastly the chart in the article is lame, but I've figured out the scale: $$ is better than $$$, but worse than $. So there you have it.

Shaffer
# July 26, 2004 10:53 AM

dick tang said:

>Then, let's look for vulnerabilities: choose Microsoft / IIS / 6.0. >Results:
>1 (One!) x-site scripting vulnerability in a web administration >tool that's not even installed by default
>And three for ASP.NET

>OK, let's do the same for Apache 2. Results:
>25 (Twenty-five!) vulnerabilities, including DOS and Buffer >Overflows
>Wow, that's a lot! Let's look for PHP 4 now... Results:
>19 (Nineteen!) vulnerabilities, including integer overflows, >arbitrary file disclosures, cross-site scripting, etc.

that's not fair,how long did apache and php releaese?
I agree that IIS 6 is securer than before,but you should not list
ps. 25 vulnerabilities is not usually affect all of the platform
# July 26, 2004 11:01 AM

General Protection Fault said:

For Shike Maffer:
"There is nothing in PHP that you couldn't do in traditional ASP. "

That's B.S. In old-school ASP, to rotate an image, you had to buy a third-party COM library like LEADTools. PHP handles this natively with the image* functions. Likewise, for creating PDFs, PHP has built-in support but ASP does not. Add all those COM libraries on your TCO!
# July 26, 2004 11:06 AM

Oscar Leeper said:

So if following the link off VA Systems owned propaganda mouthpiece Slashdot wasn't enough of a clue, I just watched the page load on the Oracle article:

1)Click on link
2)Oracle banner appears at top of page

And there I sit thinking to myself, "Yup, another piece of Oracle FUD. This should be funny."

Thanks Bertrant, for putting into words what every *level-headed adult* programmer was thinking upon reading the article(or the banner at the top of the article).
# July 26, 2004 11:38 AM

Yeehaw said:

"the author tries to convince us that PHP and ASP.NET fall into the same category of web platforms that '[embed] code into HTML pages with special tags that signal to a preprocessor that they contain code, and that it should do something with it'. This is true of PHP, but not of ASP.NET, where the code can, but should not be in the HTML markup."

Code and HTML should be separated (most of the time) in both languages, and it's just as possible to do this in PHP as in ASP.NET. I stopped reading your rant seriously at this point, because it showed that you are at least as dishonest as the Oracle writer.

I also love how you defend that ASP.NET is tied to IIS by defending the *security* of IIS. That's really rich. I stopped reading altogether at that point. Your are obviously on the far-away planet Microsoft at this point.

A bunch of developers are building large, fast, powerful, scalable programs quickly and maintainably using completely free and open tools. They don't need you, and ASP.NET would have to be *far* superior to warrant marrying your company and shelling out a bunch of cash. But I'm sure you'll find a way to shrug this off and still be 'right'.
# July 26, 2004 11:56 AM

Jason Lotito said:

some fixes for:
1. PHP runs on almost every platform ASP.NET does not.
2. PHP runs on over 60% of the webserver today ASP.NET does not.
3. PHP is free/open ASP.NET is maintained by one company.

solutions:
1. use mono
2. apache + ASP.NET mono module
3. 1, 2 -> ASP.NET is !!!NOT!!! maintained by one company.

Unless I am mistaken, ASP.NET is NOT covered by any open standards, therefore making it's legal standing unsure. Indeed, from the MONO page:

"The controversial elements are the ASP.NET, ADO.NET and Windows.Forms subsets. Those are convenient for people who need full compatibility with the Windows platform, but are not required for the open source Mono platform, nor integration with today's Mono's rich support of Linux.
...
The Mono strategy for dealing with these technologies is as follows: (1) work around the patent by using a different implementation technique that retains the API, but changes the mechanism; if that is not possible, we would (2) remove the pieces of code that were covered by those patents, and also (3) find prior art that would render the patent useless."

So in reality, a business decision to use ASP.NET means a business decision to run on Windows.

As far as scaling and all that fun stuff, I just have to point to Yahoo!.

I don't necessarily agree with the Oracle article; after all, it's Oracle trying to make non-Microsoft products sound better.

And finally, as far as the "benchmark test" is concerned: Yes, I too can make PHP code slower than ASP code if I choose to do certain things that any professional PHP coder would know not to do. In posting a benchmark, make sure your code is correct.
# July 26, 2004 12:00 PM

kmcafee said:

I just wanted to say that I work in a development house where there are 3 programmers in one division doing PHP web development, and 5 programmers in my team doing ASP.NET web application (sold to customers to provide business functionality, not hosting web sites) devleopment. We are very happy with the ASP.NET development experience for our needs. But PHP is also working out well for the other teams needs.

And the one MS point I totally and completely disagree with is the Accountability issue. Microsoft has 0 accountability, period. They have never stood up and taken responsibility for a problem, and they have never provided solutions at the same speed as any other business organization I have done business with. There are numerous bugs in Visual Studio 2003, and a handfull we found in the .NET library itself - all of which we discovered in our first 6 months of working with the technology, and reported to our MS Partner contact. Nothing has or will be done about any of them, period. Until they are fixed in whichever future release Microsoft feels like fixing them in.

How bout this one, use "devenv" to build a solution, and then open the solution with devenv visually (visual studio), and you cannot open ANY of the visual designers, you must "touch" these files first, or delete your web cache and or object files.

And if a SQL Server or .NET update ever looses my customers data, Microsoft will not offer me one bit of accountability, nor money to make reparations - they are as accountable to me as my congressman - which is to say, not at all.
# July 26, 2004 2:29 PM

Luis Alberto said:

I work for a small company. We have two servers running, one for ASP.NET (Win2003 and so) devel and the other is a LAMP machine (Debian Woody). Both servers work just fine, have almost the same hardware and run many apps, apart from devel ones.

The win2k+3 machine is maintained by an outsourcing company, that is an official partner of MS (cannot say names, we still work with them and I know that MS boys are going to throw shit on them) and, among other things, did Exchange, firewall and A/V thingies. It was a busy server, running also file and printing jobs for the whole domain on wich we operate, and a powerful one (like the other one): 2xXeon 2 GHz, 1 GB of RAM, some scsi raid storing.

I know that all that tasks are excessive for such a server, having in mind that we do ASP on it. So we purchased another server, a clone of this (they're IBM beasts) and installed Linux Debian on it, to use it as a PHP devel platform. As we work with Exchange, we moved the routing, firewalling, A/V and antispam to the debian machine, so the win server didn't have to maintain the load our internet use demand. This solution worked beautifully, but it was not sufficient. File and printing serving is a heavy task on our office, so we moved to Samba and Cups with excellent results. We noticed also that we could move the two scanners and share them with SANE on the debian machine.

Now, we can develop comfortably on the windows machine but look at this:
-Win2003 services:
-Exchange (~1000 processed emails per day), managing connections only from the debian machine.
-ASP.NET (two simultaneous users testing code, an occasional customer trying its work in progress web).
-DAT nightly backup, so it does not interfere with our normal ASP work). We are going to move this service to the debian server on september, as soon as I end trying a new backup system on an old PC running also debian.
-Domain controller, 16 users and 19 computers.

-Debian:
-Spamassassin + ClamAV + Postfix (as gateway for exchange, processing ~2000 emails a day, half of them are SPAM or virii from the outside and do not pass to Exchange).
-Apache 1.3.x, PHP 4.1.x, Turck MMCache
-MySQL 3.x
-Samba, 9 users doing some heavy tasks as editing large graphics files directly from the server. Four PHP developers, although their disk usage would be like 0.001% of the total being the rest used by designers.
-CUPS, serving a parallel kyocera laser printer and two USB hp deskjet printers.
-SANE, serving one HP flat scanner and a nikon diapo scanner (both USB).

Cannot give you any numbers, since these are production servers and cannot run any tests on them. But I can assure you that we are very surprised with the perfomance of the linux server, but also with the lack of perfomance of the windows server. The Linux server is bigger, so the comparison is not clear (2xXeon 2.2 GHz, the memory is also a bit faster but they have the same amount), but it runs many services on it and it's very secure. Usualy we have Exchange and IIS fighting for RAM, so the system gets very swappy, and I cannot imagine why IIS wants so many memory... it's not our app, we make some finetunning on it from time to time, and before doing anything we make some diagnostics on it, including the measuring of its memory footprint, which usually is what we expect (ok, we have some memory leaks from time to time which are resolved when detected).

I am really curious on a real benchmark, not MS/Oracle FUD or some user doing silly tests. First, because curiosity, and on a more professional side I want to know if the behaviour of the windows server is normal. An mostly idle webserver and a not very busy mail exchanger is not what I would expect to get a good server on its knees.

Anyway, we are moving all services to debian (converting the windows server) slowly, the current debian server is beggining to have too much responsibilities and I want to be able to transfer quickly and efficiently tasks from one server to another in case of hardware failure.
# July 26, 2004 3:51 PM

Bertrand Le Roy said:

DevNull: ASP.NET being maintained by one company is seen by some companies as an advantage in terms of consistency and accountability. If for you, "openness" is more important than anything else, sure, go ahead and use PHP, or... Mono.
As for "i guess its a lot more restrictbie and un-flexiable than PHP", well, guess again, this is just a gratuitous affirmation that would need a little more argumentation...

Toast: do some research. Here's what I could find in two minutes:
http://sourceforge.net/projects/nfop/ one of the open-source PDF libraries for .NET
http://sourceforge.net/projects/ming-sharp/ a .NET wrapper around the Ming SWF library.
And of course, as I was saying in the article, image creation libraries are built-in the .NET class library, as well as database access, etc. The main difference with PHP being that it's consistent, well-organized and object-oriented.

Richard: I'm well aware that other error treatment is necessary in the code you will substitute for "#work with the file". The problem here with the original code was that it throws and catches untyped exceptions, and it throws unecessarily, which is very bad practice.
Another problem that I did not underline in the article is that existing PHP libraries having been written before the support for exceptions appeared in PHP5, chances are that these libraries will not throw exceptions anytime soon and you will have to use different techniques for error treatment whether you use older or newer libraries. More inconsistency...

Nofool: you'll need a little more argumentation than that not to be taken for a common troll.

"Doesn't matter", whatever your name is: you're so clever, but you could also have read the article where I make it very clear that I work for Microsoft.

Caruccio: ASP.NET only takes the /proportion/ of memory that you configure in machine.config. It does not "eat up" memory, it uses what you configure there. There's nothing shocking there: the machine is supposed to be a web server, right? So the web process takes /available/ memory and uses it. So what?
1GB is more than enough, I've run dozens of web sites on 512MB machines without a glitch. Did you see the price of memory chips by the way?
The bottom line is does your web site run smoothly or not? The proportion of memory the web process uses is just irrelevant as long as it does not get in the way of other necessary processes.

Dick: you're right, I should perhaps have compared on the same time frame instead of just on the last version of each product. But you can do so yourself and you will see that it doesn't change much: over the time IIS6 has been on the market, there have been many more security issues with LAMP than with IIS+ASP.NET.

GPF: I did not quote the facts page as "proof", and if you have a better study of TCO for Windows and Linux, let me know.
As for your answer to Shaffer, well, I was personnally not talking about classic ASP. Actually, even I, despite all my pro-MS bias and my general dislike of the PHP syntax, would probably choose PHP over classic ASP. But fortunately, classic ASP has been replaced by ASP.NET. So this is just irrelevant to the current discussion.

Yeehaw: yes, it is perfectly possible to write more or less clean code in PHP (or classic ASP). I've written such code myself. But you really have to get out of your way to do so: linear models such as PHP promote spaghetti intertwined HTML and code, whereas ASP.NET promotes a clean separation from the start as the default model.
I'm glad you continued to read the article despite the fact that you stopped reading it (?!).
You know, your comment about IIS security is just disarming. You're accepting the common preconceived idea that IIS is unsecure despite all evidence to the contrary even when faced with this evidence. All you have to do is follow a single link or do your own research, but I guess you don't want to do even that simple thing because that would endanger your whole system of belief that MS is inherently bad.
And I guess that no, we don't live on the same planet.
Sure, many companies build great and clean things with open-source tools, I've never said or written anything that would indicate otherwise. I sincerely think that ASP.NET IS far superior to PHP, though, and I'm willing to show how.
Who said that you had to "marry" MS, though? Not me, just you. And what "bunch of cash" are you talking about?
You guys are way too irrational and should think more about productivity, maintainability, interoperability, you name it, stuff that really matters, not whether or not the producer of this or that technology is ideologically acceptable.

Jason: I never said that PHP could not scale. You're right in saying that Yahoo did this successfully. ASP.NET scales out of the box. The gratuitous affirmations to the contrary in the Oracle paper would have to be backed by some kind of study. Saying something does not make it true. Proving it does.
I agree that the "benchmark" Pzykoman posted in his comment do not mean much. I'm still waiting for a serious, real-world application based performance study.

Kmcafee: I'm very surprised by what you're saying about support. The experience I've had with them before I joined MS is completely different. Did you go through support for these? How did they close the events? Won't fix??
What are these "numerous bugs"? Were they aknowledged as real bugs?
The repro for the bug you cite is incomplete: I've been doing this kind of very simple manipulation every day for years and never encoutered or heard about having to touch the file. What did support say about this one?
About SQL or ".NET update" (what's that?), /did it/ lose some of your customers data?

Luis: you should contact support: I think there may have been some memory issues with the interaction of Exchange and ASP.NET. It should work, though, even though it's generally not a good idea to put both on the same servers (I can hear the zealots already. Well, in my former company, we had Linux machines and we did not put mail servers and web servers on the same machines on Linux either)
# July 26, 2004 4:20 PM

TrackBack said:

The article on ActiveWin
# July 26, 2004 4:22 PM

TrackBack said:

This promises to bring more comments than I can reasonably handle. Oh well!
# July 26, 2004 4:26 PM

Bruce said:

Nice article, rebutting a laughable original. However I couldn't help noticing that every mention of ASP.NET etc points to the relevant Microsoft sites, but you didn't put a similar link even on the first mention of PHP or Oracle. A nit that spoilt my impression of the article!
# July 26, 2004 4:53 PM

Oscar Leeper said:

Bruce:

Take a look at the comment you just posted. Did you add links to Microsoft and ASP.NET? I sure didn't add them to mine.
# July 26, 2004 5:45 PM

Bertrand Le Roy said:

Bruce: the ASP.NET and Microsoft links are automatically added by the .text engine. I could add the same kind of automatic links for PHP and Oracle, but then I would also have to do it for every other company out there I may mention the name of. I won't as the blog's focus is ASP.NET...
But here are the addresses of PHP and Oracle anyway:
PHP: http://www.php.net/
Oracle: http://www.oracle.com/
# July 26, 2004 5:52 PM

Jason Lotito said:

Bertrand: My comment regarding scalability was in response to another comment I read on here (I believe). As a PHP programmer, obviously my opinions should be taken with a grain of salt.

However, what I have found is that professional PHP programmers are more than willing to admire .NET for it's strengths. ASP.NET unforunately has the tradition of ASP via VB (which, frankly, sucked). ASP.NET is an improvement, and there are efforts in the PHP Community to take what we find nice about ASP.NET and implement it for PHP.

For example, the "Widge Control" functionality of ASP.NET has been done in PHP with different libraries. WACT is a fine example of this. On a side note: PHP has a fine history of taking what is nice in other languages and using it. PHP's support for external libraries is amazing (and frankly, that's it's purpose, to be a glue language). Anyways, off topic...

As far as Oracle's paper: Yeah, for those that know better, it's Oracle's way of biting at MS's ASP.NET. ASP.NET and PHP are competing technologies despite the underlying architecture, as is Java and C#. So if you are Oracle, and you want to diss ASP.NET, which technology are you going to talk up, will it be Java or PHP?

PHP, of course!

Frankly, articles like these serve the readers little, as you have to question the reason for putting out an article like this. Granted, MS's own ASP v.s. PHP article wasn't any better, but any developer worth his salt could see that a mile away.

Frankly, I am happy and successful with what I do, and as long as ASP.NET continues to move forward, it will only force us PHP guys to make sure we compete. Competition is good, after all. It will only make PHP and ASP.NET better in the long haul.
# July 26, 2004 6:36 PM

Bertrand Le Roy said:

Jason: Thanks for the message. Yes, competition is good, and the PHP market shares are a strong motivation for us. I'll have a look at WACT, which I don't know.
# July 26, 2004 6:40 PM

Another matthew said:

Hi from OSNews.com :)

"[embeding code in html] This is true of PHP, but not of ASP.NET, where the code can, but /should/ not be in the HTML markup"

In practice, this means that ASP.NET has a built in templating language whereas PHP doesn't -- and that's all. It's not about which of the many abstraction and templating layers in both languages are best -- an XML/XSLT approach or an OO controls model for example -- it's just defaults. ASP.NET's default templating language has code at the top as a reference to the code behind (and you can't have two of these, I think) so one could argue the binding in ASP.NET is similar too. Similar, unless you choose otherwise and use a templating language that outputs your markup. The supposed mixing of code and content exists in both languages.

The biggest mark against ASP.NET is that it's not cross-platform (Mono doesn't count yet ;), and that for any web standards nazi the HTML it produces favours MSIE over others.

Sure, you can choose controls that produce good html, but ASP.NET doesn't by default ;)

Good response though. I generally agree with you, but just because the Oracle guy isn't a good programmer doesn't mean a thing to PHP itself.

Thanks!
# July 26, 2004 7:10 PM

Bertrand Le Roy said:

Other Matt: It's not just templating. What about the rich page lifecycle? What about events? What about WebControls?
By the way, ASP.NET 2.0 will produce standard XHTML out-of-the box by default.
# July 26, 2004 7:14 PM

TrackBack said:

Nexen reprend la news d'OsNews
# July 26, 2004 7:57 PM

TrackBack said:

Some commentaries on Channel9
# July 26, 2004 8:00 PM

Another matthew said:

"It's not just templating. What about the rich page lifecycle? What about events? What about WebControls?"

Bertrand Le Roy: I've been writing C#/ASP.NET for 2 years now, but I'm coming to prefer a hybrid ASP.NET/placeholder/XML/XSLT approach to page generation. The page lifecycle is... well, it's actually got in my way a lot of the time. It's useful for application start and stop, and I guess it's breaks up the code into their order.

I would have loved for ASP.NET to have a placeholder control that maintains state for it's added controls. There's a 3rd party control that does this, but last time I checked (6 months ago) it was buggy as hell.

As I was kinda hinting, my main complaint with ASP.NET is that it's an abstraction away from http, html, and the vagaries of web browser bugs. The problem is that the browser bugs exist, so you can either ignore them (ASP.NET style) or deal with the underlying tech. When you've got two search forms on a page ASP.NET puts them as a single form tag, so pressing enter submits both. There are hacks that use javascript to hit the right button based on which field you're in but it's a workaround, and it doesn't degrade gracefully for older browsers. I develop government websites so there are requirements around this kind of thing -- we can't rely on Javascript. JoelOnSoftware called this a leaky abstraction or something like that -- when it'd be nice to tell programmers that you can deal with onClick and onChange events on a per field/button basis, but that the nature of the web means otherwise.

PHP has a library called PHP Web Controls (a ripoff of ASP.NET's model).

ASP.NET is pretty good, but I prefer the XML/XSLT approach and capturing the actual form elements as POST/GET rather than an abstraction. Now that I've got my abstraction library (a week to write) ontop of ASP.NET it doesn't take longer than the buggy event model.

XHTML in ASP.NET 2.0 will be great.
# July 26, 2004 11:42 PM

TrackBack said:

It&#39;s been a while since I have looked at any PHP so I am unable to offer any lucid commentary regarding the ASP.NET vs. PHP debate (originally sponsored by Oracle and Sean Hull) currently taking place on Bertrand Le Roy&#39;s blog (&quot;Some co
# July 27, 2004 12:21 AM

TrackBack said:

iamwill &raquo; Oracle&#8217;s comparison of PHP and ASP.NET; The comments keep rolling in.
# July 27, 2004 2:44 AM

Warren said:

The author is wrong with his outdated knowledge of PHP.

PHP is still the better tool. It's more flexiable and has more functions.

The author is wrong to assume that PHP ALSO is best used seperated from the HTML, it has a include_once (as well as an include) function, which is usually used to bring in the PHP library code.

PHP is also more portable and follows a C++ style (less typing) format, not some beginners style of basic that ASP follows. every time I use ASP I have to drop my intelligence to MS level.

I too have used both ASP and PHP, on windows and Linux. Overall PHP is better by far!

# July 27, 2004 9:00 AM

Bertrand Le Roy said:

Another Matt: It's true that you need to know the page lifecycle to do things in the right order, otherwise it can get in the way. But when you come to think about it, that's what makes all the magic stuff in ASP.NET possible (automatic state management, events, etc.). I think we've simplified the writing of ASP.NET pages in Whidbey a lot, even though the lifecycle is now even richer.
I assume you mean to maintain the state of dynamically added controls. The WebParts and their zones do that in Whidbey, but a more general purpose control could be interesting. I'll look into it.
We've also made things better in v2 for multiple form problems. You can now have default buttons, and have a button post to a different page, while retaining the strongly typed experience of ASP.NET.
I think the web is getting more mature now, and ASP.NET, especially with the new Adapter infrastructure, is the only web platform that is able to automatically adapt to the peculiarities and bugs of each browser or device. After all, hardware abstraction has been working pretty well in OSs, so why would browser abstraction and HTML abstraction be a bad idea? It certainly works in ASP.NET. There are some cases where you can feel that using the old Request.Form may be easier, but that can be a slippery slope, and you may end up rewriting a part of the framework where you could probably have done the same while maintaining the ASP.NET model intact. I don't know about your special case, it would have to be looked into in details. I know that I've made this mistake in the very beginning of ASP.NET (classic ASP methods were hard to loose) and discovered later that my problem had a much simpler and cleaner solution.
But you know, we shouldn't impose our own idea of how you should develop, and I'm very glad that you found your own method and that it works for you. I even think that PHP is what works for some people just because they like this style of free-form, I control exactly everything, style of programming. I even know some people who love to develop in assembly language (I used to be one of them).
So we have to allow for different styles.
By the way, can you be a little more explicit about the "buggy event model"? What's buggy about it? If you found bugs, I'd like to know about them so that we can correct them. By the way, we opened this site to submit bugs and suggestions for Whidbey:
http://lab.msdn.microsoft.com/productfeedback/

Mattia, Warren, etc.: if you have nothing more constructive to say than "your article suckz, php rulez, MS suckz", please go away.

In particular, Warren, it's amusing that you should tell me my knowledge of PHP is outdated as you yourself are talking about classic ASP, not ASP.NET. Come on, PHP follows a C++ style?? Are you kidding me? A Perl style, ok, but not C++. C# follows a C++ style (C#, you know, one of the languages you can CHOOSE in ASP.NET)
And separation through include_once? Wow, take a look at ASP.NET's Register directive. It's just light years ahead.

Bob: of course, you dropped the main part of the citation, which was that individual cases should not be taken for generalities. I'm only talking about verifiable things, you guys are talking about purely emotional things. I also said that we still had a lot of work to do, but of course, you didn't want to hear that, you only hear what conforts your system of beliefs.
Just compare the number of security issues in IIS 5 and IIS6 and see how much progress we've made in just a few years on this huge code base. We're doing the same kind of work on Windows itself, and this will give XP SP2 and Longhorn.

Anona: please do your homework before you post such preposterous nonsense. Open a web browser, go to Google, type "mac worm", click on the search button with your single-button mouse and click on the first thing that shows in the many answers:
http://securityresponse.symantec.com/avcenter/venc/data/mac.simpsons@mm.html
Oh, it's a worm, and it's for the Mac.
Of course, a worm for MacOS won't get very far as there are so few macs. Like a virus that would target people with Vayron eyes.
Why are there anti-viruses for the Mac by the way?
I also did a search on Apple Mac OSX Server on http://www.securityfocus.com/bid/vendor/ and there are just too many vulnerabilities for me to bother counting. Do the same search on Windows Server 2003: there are 2.
Of course I'm not denying that there have been a lot of problems, but like Bob, you don't want to listen to what I'm saying.
Get me right this time: I'm not denying. What I'm saying is that we've already made a lot of progress (see the numbers for yourself: the record speaks for itself indeed) and that we're still working.
You're saying that we haven't done "much" to solve security problems? How do you explain the numbers on security focus then?
Get real. Get the facts.
And go away.
# July 27, 2004 2:19 PM

TrackBack said:

# July 27, 2004 2:56 PM

Bertrand Le Roy said:

Dear trolls,

This is not your private chat room. This is my blog.
With your uninteresting, unoriginal rants, you're making this page heavier than it needs to be and wasting legitimate reader's bandwidth.

So here's what we're going to do. You're going to open your own blog, and rant all you want there. I'll even trackback to it if it's funny enough.

In the meantime, I'm moving all trollesque comments to this page from now on:
http://weblogs.asp.net/bleroy/articles/199077.aspx
# July 27, 2004 5:51 PM

Bysza said:

Anona: I understand you're a Mac power-user, right?
That is great. :)

How much did you pay for your Mac?
I'm not claiming to be a Mac expert, but I took a time to lookup a Mac like this:
Bundle Power Mac G5 2.0GHz DP 512 160 4x SuperDrive 56K NIC w 1GB Upgrade - lowest price: $2339.00 (without monitor)

Opposed to: Dell Dimension 8400
Pentium® 4 Processor 530 with HT Technology (3GHz, 800 FSB)
Microsoft® Windows® XP Home Edition
512MB Dual Channel DDR2 SDRAM at 400MHz (2x256M) at $989.00 (with monitor).
Correct me if I'm wrong, but AFIK these are at least comparable machines, right?
Unfortunately with uncomparable prices. :(

We have lots of PCs in our company (1000+) and several Macs. Well, I bothered to ask my collegues working on them about problem they had.
Mac is and was advertised as a problem-free computer, which is not entirely true.We had problems with several hardware items, including SCSI drives, scanners, etc.
MacOS has its faults, bugs and also security problems.
Every part is 2 or 3 times more expensive than PC hardware, but at least Mac box looks great. ;)

How many directly Internet connected Macs are there?
Do you have any idea?

First of all, during early stages of Internet era, say late 80' and early 90', how many network connected hosts there were?
Did everyone was thinking about security as much as today?
Look on TCP/IP. It has no security features and ability to easly spoof addresses is causing lots of problems. Same with SMTP, etc.
And of course the idea to build IE as an integral part of the OS... ;)

It is a big problem (or impossible ;) to upgrade every internet connected windows boxes to the newest os or at least install patches on each, especially when there are no features build in the older windows versions that could allow that.
And people are not keen on upgrading, since lots of them doesn't know what is going on with their machines.
They just want to play games, browse internet and read mail. That's where the biggest problem lays.

It is a challenge to change thousands of employees mindset and correct so huge codebase as MS has, especially when you think of the compatibility with vast amounts of applications already written for this platform.
I'm really satisfied with progress MS has done so far in terms of security out of the box and I'm looking forward to WinXP SP2.
But I'm not saying that it shouldn't be done earlier ;)

My point is:
If you are satisfied with your Mac - use it and be happy. :)
Security is a big concern for a few years now, and MS has invested in security a lot of efford and money.
Implicity and explicity admitting security is a major concern.

Please let go the holly war, and give peace a chance... :D
# July 27, 2004 6:57 PM

Another matthew said:

Bertrand, yes I was talking about maintaining the state of added controls. Steping back though, the only reason to add controls to a page and register events with addHandler() -- all that hassle -- is because that's the way the ASP.NET event/page lifecycle/OO model works. Other models wouldn't require this, so I think I'm being fair when I say that ASP.NET still has a way to go (it's good, but it could be a lot better).

Many platforms adapt to the device they're on, so I think it's overstating it to say that ASP.NET is unique in this regard (hundreds of CMSs do browser detection and produce different output based on this; whether it's a simple template change or by using high-level objects that adapt their HTML to the browser).

I agree that a high-level object model expressing abstracts like "treeview" and "tabs" that is then turned into device-specific html is the best -- that's a good approach, however ASP.NET turns asp:panels into div tags for IE and table tags for Moz! Their radiobuttonlists are produced with label tags surrounding the text and not the radio button, which would be better for Konq and NN4 (with no downside). The abstraction that ASP.NET provides is used to produce HTML that works better in IE. This is just talking about defaults again, but it's a little annoying to have to write repeater controls to get the appropriate HTML. Even required fields (as in, the required field validator in ASP.NET) is poorly implemented in non-IE browsers, and it allows non-IE browsers to bypass this step.

I assume you've read the JoelOnSoftware article about leaky abstractions -- my point is that ASP.NET is a leaky abstraction. HTML and HTTP don't have the concept of required form fields, and they don't have a way of distinguishing between hitting enter in a form and which button is affected (if any). ASP.NET and many platforms build ontop of HTML higher concepts such as treeviews and tabs and buttons -- they build abstraction, but if abstraction is done poorly it can be confusing to programmers.

Now, I don't want to end this post on such high concepts, because they tend to blur the different possible approaches within each concept. ASP.NET could have done required form fields transparently for all browsers but it didn't. This isn't a general statement saying that abstractions mean losing control (because of course it means that) but the abstraction must be well done or else it leaks, and ASP.NET (and others) leak.
Thanks :)
# July 27, 2004 10:26 PM

Julien Ellie said:

Haha :) Bertrand you're crazy to have taken down this ridicule article from Oracle and you're now fighting hordes of troll. Luckilly there're still a few interesting comments in there from people who have a little respect for people trying to do their job.
# July 28, 2004 3:08 AM

Bertrand Le Roy said:

A.Matt: I don't really understand what you're saying about dynamic controls. Actually, there are very few good reasons to add controls to a page dynamically, I'd need to know your precise use case to give any advice.
But I'd be curious to see how other models solve this problem. I don't know any other framework that do. But perhaps I didn't understand exactly what you were referring to.
I take your points on non-IE browsers, this is something we should do better, even though we always have a fallback. For example, validators are always enforced server-side (as they should be even for IE to prevent elementary forged posts), so you just get an additional postback on these browsers. But agreed, there is no good reason (except the limited time we have) to not implement client-side validators for DOM-compliant browsers.
On the other hand, there are some third party validators that solve this problem. After all, our job is not to give every possible control out of the box, but to provide a web development framework on which you can build your applications. We try to solve the most common scenarios out of the box, but we can't do everything at once. That's why there is a v2, and that's why there will be a v3. There's always room for improvement and your feedback is valuable.
And if I'm not mistaken, you don't have this issue with validators on PHP because there are no validators, so you actually have to build them from scratch.
I've read the JoelOnSoftware article, and his main point seems to be "the abstractions save us time working, but they don't save us time learning". Fair enough, but you still save time working. And granted, to do ASP.NET well, you probably need to learn a few things like the page lifecycle.
But one of the things he does not mention, though (or perhaps I missed it), is that the learning can be very progressive. I think ASP.NET is good for beginners because you don't have to learn HTML and the other underlying concepts first (like in PHP), you can start with the high-level concepts. In my own experience, it is very common with what Joel calls "leaky abstractions" to only have to learn the underlying complexity along the way (the later the better). For example, after all these years writing C# code intensively, I still know very little IL (and only because I was curious about it, not because I really nedded it).
Thanks for the feedback anyway, it's refreshing after all this reckless trolling.
# July 28, 2004 1:51 PM

PLeX said:

Thought this was quite funny...

Poll results from bottom of Oracle article:

Created :Wed Jul 28 15:56:29 PDT 2004 Please rate this document:
Excellent 1541 Votes 18.8%
Good 1085 Votes 13.2%
Average 292 Votes 3.6%
Below Average 2563 Votes 31.2%
Poor 2721 Votes 33.2%
Total: 8202 votes
# July 28, 2004 6:57 PM

TrackBack said:

Yexley
# July 28, 2004 8:58 PM

TrackBack said:

# July 30, 2004 1:23 PM

TrackBack said:

# August 5, 2004 5:13 PM

Greg Holmes said:

MS seems to have a problem with this "hey, we're hip, we're listening; we have blogs!" thing. The individual developers seem to have pretty thin skin ;)

If you have a blog, a real blog, then discussion is going to ensue. In public. Much of it rough and tumble. That's kind of the point of tech blogs.

# August 17, 2004 2:41 PM

Bertrand Le Roy said:

Greg: not at all, the troll comments are very public, and I did not delete a single message. You just have to follow the link if you really want to read all that nonsense.
I just think that the immense majority of readers has other things to do than read troll posts. The trolling on this article was drowning the few relevant comments, and making the page unnecessarily heavy. I just took the irrelevant comments out of the page, but did NOT delete them. So it's still public, and you can very well post your comments there.
# August 17, 2004 2:46 PM

John D said:

Wow, some of us don't have the luxury of arguing all day long about an internet article. I will take whatever someone gives me in the way of business. I do PHP at work, I do ASP.NET at home, the new job I'm applying for *might* go to JSP, and I use Classic ASP for the Portland Access User's Group (www.PAUG.com). Am I going to convince someone to change? I doubt it. I'm a lowsy salesman. And I can't hold my own when it comes to was/wasnot rattatattat. What I got out of this whole blog (and it is a lot, mind you) was the need to go back and study typing so I too can type fast.
# August 20, 2004 12:58 PM

this is very good said:

this is related article
# June 3, 2006 8:31 AM

Masoud Shokri said:

I like to mention these(Though I am not sure if people read these at the bottom of the list) 1 - ASP.net 2.0 comes with the GREATE PROVIDER MODEL 2 - You can deploy your dlls without registering them , this is a very great leap! 3 - You can use the same library for Console app, Windows App and Web App 4 - Masterpage, Themes and skins (More comment needed?) 5 - the View State stuff! All of you forgot it. 6 - The very great language (mr C#) 7 - The portal framework 8 - You can use Enterprise Library Anything else? Yes, I see the day that PHP dies, sorry for saying that. But I see that day. Like java appletes. Who uses them now? Flash is out there, and it kills java applets, and If you want to use something but ASP.NET why do not you try Cold Fusion or JSP? And about the price, it is not really different on a shared hosting is it?
# July 19, 2006 7:32 PM

Masoud Shokri said:

Ahh, how many people use MAC? a few. How many people use Linux? a little more. So why hackers attach MS? Have you ever know the rich guy hasn't so many friends?
# July 19, 2006 8:01 PM

Masoud Shokri said:

http://www.zend.com/news/zendpr.php?id=108 take a look here, does it work for you?
# July 19, 2006 9:00 PM

Bertrand Le Roy said:

Masoud: what is supposed to be on this page? It comes out empty for me.

# July 20, 2006 1:52 PM

Masoud Shokri said:

It is supposed to be one of the zend's website's pages, talking about relationships between zend and oracle, but it doesn't work for me, like many pages in zend.com I had this experience with so many php sites, Why?
# July 20, 2006 2:58 PM

Masoud Shokri said:

And something else, where can I ask some questions about Atlas? I am new to Atlas.
# July 20, 2006 2:59 PM

Bertrand Le Roy said:

Masoud: you'd have to ask them why their pages don't work ;)

About Atlas, I encourage you to visit http://atlas.asp.net. The site has lots of information and forums where you can get assistance.

# July 20, 2006 3:06 PM

Masoud Shokri said:

Thanks, I have seen it, Its cool though it was much better if they had this documents in pdf format!
# July 20, 2006 6:30 PM

vikram said:

I love asp.net and one thing that is not talked about here is the httphandler and http modules provided to us by ASP.NET. How can you not take that into account while talking about this
# August 25, 2006 2:22 AM

Josh said:

Well... after finally making it to the bottom, I wanted to thank Bertrand for trying to stay as rational as possible here.  I think that ASP.NET provides for a more structured development environment to build more complicated and robust applications (of which I have built many), but this is simply my opinion.  PHP I can't really speak on as I am not a PHP programmer.  

I am in the process of helping a client decide on what platform and development language to use moving forward (currently using PHP and linux) and reading both sides (after weeding through some nonsense) has helped me gain a better understanding of both languages (pros and cons).

In the end your client's requirements really are the primary deciding factor. If the client has a small budget, no preference on OS and webserver and PHP trained personnel are more available and afordable, I would say PHP.  If you were building a multi-tier web application with complex processes, and many database driven components.  Leverage the .Net Framework classes and reduce coding time by as much as 65% ($$$ savings for your client = happy client) and time to market is faster.  It is a win-win situation, and you as the developer are the hero and get a ton of referals and work as a result (actually occurred)!

# November 22, 2006 3:46 AM

Thomas said:

I personally think that its pointless bickering over "what's better" because the answer is simple: It doesn't matter whats better, it matters what YOUR CLIENT WANTS. If they want asp, you use it. If they want PHP, you use it.

Each scripting languages has advantages and disadvantages.  If you don't like a language - good for you, you're putting yourself out of business.

I go for more open-mindedness - I will use what is needed or requested - you have more opportunity that way.

# December 31, 2006 5:51 PM

Bertrand Le Roy said:

Thomas: Sure, except that you can't master all technologies around. And what if *you* are the client?

# January 1, 2007 4:23 PM

Johhny D said:

LOL! I quit reading as soon as the Microsoft goon said "code behind" was good "separation" ... that the code should not be mixed in with the markup.

What a dumbass. XAML sucks, code behind sucks, everything MS invents sucks. I would much rather see the code thats generating my HTML right next to the other HTML - not in some other file.

These stupid idiots from Microsoft don't even realize everything they do is generating HTML and Javascript. All of .net are code generators. Put an <ASP:button on your page - and you get <input type="button spit out of the web server. Uh, thats MORE work the web server is doing, Duh. but guess what? When you use ASP:button you are typing more *** to do the same thing. And if you are going to wind up with w3c html and javascript by the time the page gets rendered, wouldn't you rather just type html and javascript in the first place? Dumb. Pure stupid dumb *** Microsoft crap.

Drag yer little gridviews on your stupid ide and see the CRAP html that comes out. 50 times more html than a php or asp page would have made.

# January 31, 2007 5:14 PM

Bertrand Le Roy said:

Right. I stopped reading as soon as the troll said "LOL".

# January 31, 2007 5:18 PM

Johnny D said:

Here, let me use Microsoft tools, and see if my site runs on apache. No? Hmmm. Now, let me use PHP and see if my site runs on Apache AND IIS - Hmmmm,

What is all this "framework" crap. Learn html, css and javascript or go home. And when you need to hit a database for content, use php because then your stuff can move to mysql, apache, mssql, oracle, websphere, IIS , whatever.

Oh, yes Mr. Microsoft. It Is SOOOOOO much better when software WON'T work anywhere.

stupid. pure stupid Microsoft baloney.  

# January 31, 2007 5:20 PM

Johnny D said:

ATLAS is idiotic too. Invented by Microsoft, of course.

XMLHttpRequest(); and "Microsoft.XMLHTTP" take 4 lines of code to use.

Who wants a freaking framework that takes and generates 100 lines of code for that?

Write your ajax with ATLAS and see if it works on apache. Better yet, try to "Use" Atlas web services from your site on Apache. But guess what? You can hit any web page on any server invented by anyone anywhere if you DON'T use ATLAS.

# January 31, 2007 5:30 PM

Bertrand Le Roy said:

Can you please go away? Atlas *does* run on apache and on PHP.

# January 31, 2007 5:32 PM

JOhnny D said:

Address the point about using a framework that requires 100 lines of code to do what you can do in javascript with 4 lines of code. ok.

# January 31, 2007 5:44 PM

Bertrand Le Roy said:

No, you explain how you can do in 4 lines of code everything that Atlas can do.

Anyway, if you don't like it, just don't use it. Lots like it and use it. Simple as that.

# January 31, 2007 5:49 PM

Ollie said:

I have programmed in PHP and currently program in ASP.NET.  The way I see it is that if you are using SQL Server as your database then ASP is the way to go and if you are using MySQL or Oracle then PHP is a better solution.  I have found that using ASP.NET was designed with SQL Server in mind and often I will run into problems using Oracle with ASP.NET.  ASP has lots of pre-made objects that are quick to implement as long as you want exactly what is on the one example on Microsoft's website. With PHP you are writing all the objects yourself from scratch and can take more time to write, but you are in total control of the outcome.  PHP does not change radically every year so your code has a longer lifecycle.  My pereference is PHP, but it is not up to me so I program in ASP.NET.

# April 30, 2007 5:36 PM

Bertrand Le Roy said:

Well, not really, Oracle should work just fine. There are also providers for MySQL. You can also be in totoal control of the rendering in ASP.NET if that's what you want (the PHP model can more or less be compared to the Render phase of ASP.NET).

I also think that your final statement is unfair as ASP.NET has not changed radically since its inception and has always been backwards compatible (it's even compatible with classic ASP). On the other hand, PHP5 has never been widely adopted because it's considered too big of a change from PHP4, leading its creators to continue to evolve both versions, and even worse, component and application vendors to maintain versions for both engines.

# April 30, 2007 6:18 PM

GoonDocks said:

I have over 10 years of web programming experience and have built nearly 100 web sites on multiple platforms. I started with shell CGI scripts, then went to Perl, then to ASP, then to PHP, then back to Perl, then to Java, and now to C#/ASP.NET. I learned "the hard way" and I'm glad I did. I handled my own HTML, form validation, user state saving, template systems, code separation, etc, etc. I also had to manage some of these projects as they grew from something small to something really big. I have also inherited many projects. ASP.NET was hard for me to learn because I was used to doing everything manually. Concepts like events, application life cycles, or server-side form objects were foreign to me. However, I now have 3 years of solid ASP.NET experience under my belt and have launched and maintained some huge projects. Once upon a time I loved PHP. I honestly cannot imagine going back though. It looks terribly hacky by comparison. I cannot imagine anyone using PHP for a "new" large scale web application. Period. For small web sites or for learning the ropes PHP has something to offer. PHP is great for writing little "web scripts". When you are ready to develop web applications however, there are better solutions, methods and concepts available. I truly enjoyed the article and also appreciate the debate on the subject.
# May 24, 2007 3:54 PM

Mike said:

I get on the web to search out ASP versus PHP. I am a small business owner and need to ensure a new contracted developer is not going to sail me down a golden fleece job highway to hell. I developed my own site using FrontPage as a handy tool. I knew nothing about development save my experiences as a browser. I don't like flash, I hate being told to upload crap to view a website, and I know many of my clients can't do so, because some guy in IT limits their ability to download any programs. - Sorry, I ranted a bit... I started with a 20 page site - no school, no training, just a XP with FrontPage and a desire to update a dinosaur launch years ago by a sloppy but expensive and slow developer. I then spun out a new division website with 40 pages, better graphics, more java script and more savvy. Now I'm redeveloping the original site and expanding to over 250 pages of content, I work almost exclusively in HTML Code and use free Java Scripts to emulate Flash crap, and have learned optimal optimization tricks by paying my dues, paying attention to those more learned, and in my free time I run a 8M Industrial Manufacturing Corporation. Now, I'm sick of the bugs in FrontPage forms. I can't keep them on-line (they just go south now and then for no reason) (save MS profit margins and apathy?) and as a business owner I need results, not problems. So a seemingly qualified developer I've screened says "lets move your forms over to ASP (yes, I'm hoping from what I've read so far, he means ASP.NET). But then, my ISP guy says "oh no, you'd be better off to use PHP". So here I am, trying to find out the key differences between the two. The advantages and disadvantages, nothing more or less. "Just the facts madam" as the guy on Dragnet used to say. But what can I say, all I get is a bunch of politically motivated, selfish and trivial crap, very little serious knowledge, and while it's 10:53 PM, I've got to be up at 5:00 AM to run my business. No wonder I don't usually take bogs seriously. They are full of comments from lonely desperate people with no real life, sense of duty or purpose, who just like to rant on and on and on and on, like the bunny on TV. Frustrated…
# June 8, 2007 12:16 AM

Bertrand Le Roy said:

Mike: I understand your frustration. Here's what I would advise. If you're not the one who's going to develop and maintain the scripts, try to choose people over technology. Find people you trust and let them use whatever they prefer. On the other hand if you're the one doing the work, you should make your own opinion by installing the technologies you're considering and try them out on simple things. The quality of the documentation and support should be one of your top criteria.

# June 8, 2007 12:37 AM

sebax said:

man, you really do not belive yourself, pls stop wasting your time...

# October 10, 2007 7:31 AM

A Real Beginner said:

I am a newbie at this stuff, trying to learn along the way, and struggling. I run Windows XP SP-2 and have set up IIS for my testing server. I have installed PHP5 and MySQL, which was a nightmare to get working because of poor documentation. Want help? You have to register on some forum, submit your problem and sift through the scanty replies from people who don't bother to read your questions properly. So, after three weeks of struggle I finally get IIS/PHP/MySql running properly. Two weeks further on I can actually get some data from a database onto the webpage, but it looks awful and I am struggling to learn how to format it.

At the suggestion of a colleague I get myself Visual Studio 2005 and install it, with no problems, in a few minutes. It comes with the MSDN library, so I also have excellent local, step-by-step, help.

In about 15 minutes I create a MS Access database with a table containing the data I need.

In Visual Studio I create an ASPX webpage which reads the data I want from the Access database, nicely formatted just as I want it. This takes me about 45 minutes because I have to consult the help files a few times.

So, PHP = 5 weeks to get nothing, while

ASP.NET = less than 2 hours to get what I want.

For newbies, its a no-brainer.

# October 27, 2007 5:22 PM

kxs said:

I have to say that this blog has quite a history.  

I have a few questions:

Now in 2007, where can I find performace statistics for PHP in comparisson to ASP.NET?  

Do you have any new information on the pros and cons of ASP.NET and PHP 5?

Thanks

# November 4, 2007 12:50 AM

Parag said:

I am a Mechanical Engineer. I required to develop a small intranet site for departmental procurement monitoring system. I used MySQL, PHP5 on XP SP2. It did not take me weeks, as "A Real Beginner" says, but just a few days time, in addition to my routine work, to get the site up and running. I am happy, my boss is happy.

I used PHP because I have found MS applications to be like fast food - good to look at & taste, but lacking value.

I know Roy will tell me to go away. Roy, I don't like your attitude, and am not returning to this site... don't bother asking me to go away.

But, before I leave, I must say that everything has its pluses and minuses.... you should be discussing that, rather than ranting against PHP. We see large websites running successfully on PHP. Learn to accomodate others' views.

# February 5, 2008 11:29 PM

Bertrand Le Roy said:

Good for you, Parag, but the name's Bertrand, not Roy.

# February 6, 2008 12:35 PM

Kungen said:

This battle is really entertaining to read. But not as informative...

Bertrand Le Roy: It would bee much easier to beleive what you are saying if you had a less aggressive and insulting attitude. (Like just saying to "Parag" that he's got your name wrong...)

Anyone who's looking for information on ASP.NET or PHP or both (like me) will, after reading this, conclude that the Hull article is probably very biased and that the Bertrand Le Roy one probably is too. Nothing more than that, unfortunately...

# December 26, 2009 10:49 AM

Binod NP said:

I have been using many different programming languages and PHP was the one I was consistent with for several years. Since I learned CSharp, I fell in love with it. I am very excited to learn many new things in ASP.NET platform.

ASP.NET introduces excellent project development lifecycle and everything is well-managed and more disciplined than PHP. ASP.NET also provides a better mechanism to handle database applications with connection pooling.

ASP.NET has a powerful backend of IIS, Sharepoint, and Team Foundation Server. With these, your team will be concentrate more on business logic.

PHP really needs many many vital improvements in order to get compared to ASP.NET.

# January 1, 2010 2:39 PM

nulty said:

Couldn't read every word but I'm currently learning PHP as my first programming language. I got the impression from a few comments that its a good way to introduce yourself to scripting. I've finished a web design course and figure I'd be better suited to developing. Any pointers on entering the industry?

# February 1, 2010 9:47 PM

Ben said:

Nulty, unfortunately it is extremely hard to enter the industry as someone who only knows PHP.  For some time now, PHP programmers have been a dime a dozen.  The only work you will find for "PHP only" these days are low-paying two-week hack jobs on Craig's List.

You'd be better off learning ASP.NET and VB.NET (or C#) with Visual Studio and then entering the industry that way.  Instead of $12 an hour with PHP, you'd be making at least $25 an hour with the .NET Framework (or Java for that matter).

PHP is going to ingrain a lot of bad habits as a programmer... I'd recommend starting with VB.NET and ASP.NET instead.  The route is more rewarding to learn as a beginner, and easier to monetize as a real career than PHP.

# March 26, 2010 2:24 PM

Ted R. Smith said:

Hmm, funny.  I have always found ample PHP work.  it just depends on where you live.  Houston, TX (aka ASP.NET Land), good luck!  300 miles north in Dallas, TX? Hell, there's more PHP out here than .NET.

If you're prepared to move you can always find 6-figure php jobs if you're a good coder and the mid-60s is easy to find if you're not.

# August 23, 2010 10:40 AM

Hari said:

Bertrand, your post is one of the best I have read regarding php vs asp.net.

We (me and my team) moved to PHP (we were using classic ASP) 2 years back because of clients insisting on using it.

After reading your post, we want to try out ASP.NET.

Thanks.

# September 15, 2010 3:38 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)