Php performance vs ASP.Net Performance

I'm trying to convince some people that asp.net is a better way to go. Is there any documentation around that compares the performance of the two? I've searched quite a bit and can't seam to find any.

Thanks for any responses.
Nate
-Nate

0
pr0c
6/17/2002 11:49:39 AM
asp.net.migrating-from-php 286 articles. 0 followers. Follow

157 Replies
2206 Views

Similar Articles

[PageSpeed] 33

actually to tell you the truth, PHP is much faster than ASP.NET, the reason being that PHP interprets all of its code inside of the PHP program itself, and since it is not accessing any other outside sources like COM objects, etc. It can produce a page in about 1/8 the time as a ASP.NET page can. Also the Database communication between MySQL is much faster in PHP, overall PHP has way better performance than any language, however, it all depends on your preference in language and the efficiency of your code.

-Geoff
0
crazy_web_developer
9/6/2002 4:01:09 AM
PHP is still a script language, and ASP.NET is an object-oriented, compiled language. You can't make PHP work in a windows app, but you can take ASP.NET code and drop it into a WinForms program without a whole lot of modification. If you want to talk all time performance, then maybe PHP is better, but I'll take OOP for the web over step-thru scripting any day of the week.
0
interscape
9/6/2002 10:58:31 AM
I may be wrong, but I don't know of any credible organizations that have done performance testing of the two platforms.  I would be wary of posts that say PHP "can produce a page in about 1/8 the time as a ASP.NET page can".  Where does this information come from?  

I think a little more research is in order given this explaination:
"PHP interprets all of its code inside of the PHP program itself, and since it is not accessing any other outside sources like COM objects."
ASP.NET does have the backward-compatibility to use COM, but does not use it in normal page processing. That statement may have been true for ASP 3.0, but it is not applicable to ASP.NET.
I'm not going to make any outrageous claims, but lets look at a few facts:
--PHP has been shown to be slightly faster than ASP 3.0.
--ASP.NET is 3 to 5 times faster than ASP 3.0 (an interpreted script like PHP).
--ASP.NET can use built-in "Output Caching". After the page is first accessed and compiled, it can be served from cache. No page processor is faster than cache.
--In default installations, ASP.NET is compiled, PHP and ASP 3.0 are interpreted.
Now knowing that, take your best guess at which platform is faster....
0
ttuttle
9/12/2002 2:37:58 PM
Hi, can you tell me where is this data from?

--ASP.NET is 3 to 5 times faster than ASP 3.0 (an interpreted script like PHP).
If possible, can you provide me some URL for this resource?
http://hardywang.spaces.live.com/
Hardy
0
hardywang
9/13/2002 3:05:13 PM
Sure, it is right here at www.asp.net (http://www.asp.net/whitepaper/whyaspnet.aspx).

0
ttuttle
9/13/2002 4:09:28 PM
You may want to take a look at this little bit of anecdotal evidence relating to HTTP communications and Web Services.

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=49575

Regards,

Fred Chateau
0
fchateau
9/14/2002 8:12:57 AM
Note that ASP.NET is compiled rather than interpretted (which both PHP and classic ASP are).  This can translate into much faster performance execution times -- since ultimately native instruction code ends up executing on each request.  

Someone earlier made some statement about interpreting being faster -- that is definitely not the case. Zend sells a PHP compiler add-on -- although it costs money (they definitely wouldn't be selling such a thing if compilation was slower <g>).
In general performance can be a hard thing to measure -- because it often differs dramatically depending on what scenario, code and data access you do, so I always recomend taking perf benchmark claims with a grain of salt.
However, we have seen with the Nile benchmark that ASP.NET with SQL is 2-3 times faster than PHP with MySql and almost 5 times faster than PHP with Oracle (even when the commercial Zend accelerator/cacher is installed).
As with all performance tests, your experience with other scenarios could of course vary (on some ASP.NET might be even faster -- others the difference might not be as big).
Hope this helps,
Scott
0
ScottGu
9/14/2002 3:59:46 PM
>However, we have seen with the Nile benchmark that ASP.NET with SQL is 2-3 times faster >than PHP with MySql and almost 5 times faster than PHP with Oracle (even when the >commercial Zend accelerator/cacher is installed). 

Thanks for the clarification Scott. Can you reference this Nile benchmark for the forum readers? Is there a website with these results and explainations of the testing? And who is Nile? Thanks.
Troy
0
ttuttle
9/15/2002 4:52:33 PM
I know the topic is Php and Asp.net, but I cant help writing the following in response to some comments about asp.net faster than asp.

I havent read many articles about speed comparison between classic asp and asp.net. All I am comparing is my classic asp and asp.net pages that do exactly the same thing. Classic asp is faster, MUCH faster.
I really wish i can say the opposite. I cross my fingers, pray to god hoping this new page will be faster.... hasnt happened.
I am new to .net so I could be doing my coding the ineffective way. Just need to figure out how to learn the proper way. In conclusion, I havent been able to prove to myself asp.net is the solution for slow performance.
0
wysiwyg
9/18/2002 1:50:37 AM
>Classic asp is faster, MUCH faster. 


I'd like to see the test results that show that, and the procedures that you used to test. I'm willing to bet that if you run a decent stress test, you find that you're inital reaction may not be spot on the mark.
0
Xanderno
9/20/2002 12:39:00 AM
The procedure is pretty simple.  I load the classic asp page, I load the asp.net page, classic asp finished loading in 5 second.  asp.net finished in more than 20.  They both display the same data however, as you can guess, the way to achieve that same result is different.   

Just as an example, this is not the actual code but similar to one of the pages I am working on. The goal is to join 2 recordsets/datatable.
In asp, this block of code takes 2 seconds:
...................
.....store order info in myRS.....
.....store customer info in myTable.....
....................
Do while not myRS.eof
myTable.open "select customername from tblCustomer where customerID=" & myRS.fields("CustomerID"), myConnection
myArray(0,ubound(myArray,2))=myRS.fields("Ordernumber")
myArray(1,Ubound(myArray,2))=myRS.fields("OrderDate")
myArray(2,Ubound(myArray,2))=myTable.fields("CustomerName")
myTable.close
myRS.movenext
loop
In asp.net, this block of code takes over 40 seconds:
trace.warn("open conn: " & now)
...................
.....store order info in datatable myDataTable.....
.....store customer info in datatable myCustomer.....
....................
myDataView=new DataView(myCustomer)
for each myRow in myDataTable.rows
myDataview.rowFilter="CustomerID=" & myRow("CustomerID")
myRow("CustomerName")=myDataview(0).row("Customername")
next
trace.warn("finish looping: " & now)
FYI, heres the trace info:
open conn: 9/19/2002 4:24:02 PM 0.145755 0.113731
finish looping: 9/19/2002 4:24:45 PM 42.584835 33.638436
So why? My statement about their performance is solely based on comparing pages I have written in asp and asp.net. Again I am new to .net, possibly I am not coding it the right way but I assure you I have tried looking for other ways. If I use a datareader instead of dataview, request timed out. I tried using command.executescalar but the customername always comes out null. If you do see what I am doing wrong, please tell me what it is. =)
0
wysiwyg
9/20/2002 1:43:39 AM
In my improptu tests, using ACT as the measure, on a slow machine, I can get 10-15 pages (hitting a SQL Server DB, and displaying a record) served per second using classic ASP.  The same function, using ASP.Net, and I jump to 30-40 pages served per second.  Using ASP.Net and output caching, it increases yet again to 80-120 pages served per second, when cached.  

Again....Forget what you see when you load the page into the browser. Run a good stress test on it. That will tell you what the real preformance difference looks like.
0
Xanderno
9/20/2002 2:17:26 AM
I am not saying I dont believe you.  And as a matter of fact your figures are very impressive and make me really wonder what it is that i am missing.... =(

Can you suggest what exactly to do to run a good stress test? Not that I understand how its gonna make a difference. To me, what I want to test is what our customers are going to see. Thats why my performance test is that simple, just compare the loading time between what they are using now and what i plan to have them used later.
Thanks for the post, I hope I can get somewhere with .net.......
0
wysiwyg
9/20/2002 4:15:32 AM
MS provides a couple of stress tools.  ACT comes with the VS Enterprise versions...If you don't have one of those, WAST is still available as well.  WAST website

Really, I want to assure you, loading a page on a development box into your browser for a look is not going to be very indicative of what your users are going to see.
Next...Remember to use output caching! When you can and do use it, it'll make your pages perform ridiculously well. More on the order of HTML pages. It's a brilliant tool that ASP.Net provides for us...But that you wouldn't see by loading the page into your browser once. Try loading it five times. Or stress testing it, as I have suggested. You'll see the difference then. It's well worth it.
0
Xanderno
9/20/2002 9:38:15 AM
I'm still considering moving from PHP to ASP.NET as well, and as it stands now I think I will try to make my next page with ASP.NET.

I am curious if maybe your two speed variances occur because one is using C# and the other is using VB.NET?
Is C# faster than VB.NET, or does it make no difference?
Picky
0
pickyh3d
9/20/2002 2:58:49 PM
I will try the tools at WAST but before I do that, I dont think I understand why loading a page on my development box into the browser is not a good indicator of what my users are going to see.  The 40 seconds is the number I see no matter how many times I run the page.  I understand the first load is normally slower than those after, but I have yet to see that.  The development box has the same, well, almost the same configuration as the live server.  I dont have debug nor trace set to true and basically the pages I have deployed on the live server pretty much takes the same time to load as the ones on the development box.   I am sorry but at this point I just dont agree with that statement.... But I'd love to hear more from you.

Output caching, correct me if I am wrong, I am accessing this data that changes every second. Dont think I can do caching, can i??
Thanks for the post, I really need someone to point me the right way..=)
0
wysiwyg
9/20/2002 3:23:10 PM
Hi pr0c!

I found this articles about ASP.NET vs PHP performance.
------------------------------------------------------------------------
Debate - .NET V. PHP: Top 6 Reasons to Use .NET
PHP guy :) talking about .NET with great enthusiasm !
------------------------------------------------------------------------
Debate - .NET V. PHP: Top 10 .NET Myths Exposed
http://www.webmasterbase.com/article/870
Php guy talking about .NET without anthusiasm ;)...
------------------------------------------------------------------------
"A Comparative Look at ASP, ASP.NET VB and ASP.NET C#" http://www.owendo.com/technocorner/resources/rd/rd_9.html
This reports are realy cool and short - You should look at them.
------------------------------------------------------------------------
"Web Application Server Review
What features and functions should a Web application server offer? In the research publication "Web Application Server Panorama," IT consulting firm Owendo Technology explains the key requirements and reviews 12 leading application server products. Here, ebizQ presents the entire 279-page report."
This paper is produced by Owendo Technology but published on e-servQ web site (I don't read it - sorry 279 pages)
http://e-serv.ebizq.net/shared/goldclub.jsp?owendo_1b.html
------------------------------------------------------------------------
.....
look at google You find more!

ps. I'm writing sites on both ASP.NET (asp also) and PHP. I know Perl (poor - only 2 simply project I made in this language ;) ), Java (one "big" applet). I write many simply sites in PHP and I'm using many GPL projects (NX CMS, TEP, Post Nuke etc.). But still my favorite language is VB.NET and ASP.NET - it's simply and fast. Now I'm writing 3 projects in ASP.NET and I'm realy happy - and my clients too :).
regards
M.Kierepka
0
mk_prog
9/21/2002 12:40:27 PM
Here's the link to the first debate (mk_prog just forgot to paste this),

Debate - .NET V. PHP: Top 6 Reasons to Use .NET
PHP guy talking about .NET with great enthusiasm !
0
gbrown
9/21/2002 2:49:34 PM
Top 10 .NET Myths Exposed

http://www.webmasterbase.com/article/870
This is a PHP fanboy article. If you want to hear pure love for PHP and pure hate for the .NET framework then see this.
Picky
0
pickyh3d
9/22/2002 2:59:36 AM
Posted By:  pickyh3d on 09-20-2002 10:58 AM 

"I'm still considering moving from PHP to ASP.NET as well, and as it stands now I think I will try to make my next page with ASP.NET.
I am curious if maybe your two speed variances occur because one is using C# and the other is using VB.NET?
Is C# faster than VB.NET, or does it make no difference?"

It does not make any difference. Both the VB.NET and C# code are translated into IL-Code, which is used to compile the main application.
Regards,

Daniel P.
0
Daniel
9/30/2002 2:55:00 PM
Thanks for the response.  I'd been curious about that (even though I already am starting to learn C#) .

I've been watching "the MSDN show"/"the .NET show" and was beginning to think this was the case and am glad that you confirmed it.
Picky
0
pickyh3d
10/1/2002 11:32:54 PM
Top 10 .NET Myths Exposed 

http://www.webmasterbase.com/article/870
That article isn't just a "PHP fanboy" / "Pure hate for .NET FW", it's 97% BS!
It seems to be basen on a fairly extensive knowledge of PHP and mostly linux-hear-say about the .NET FW and ASP.NET, prejudged by the fact that it's a Ms product.
After having read the "debate" I found Harry's short-bio pretty amusing, though...

Christian Nordbakk

http://www.anothereon.net
0
Christian
10/2/2002 8:31:05 AM
Read the Comments for that article...even more amusing.

0
gbrown
10/2/2002 1:39:05 PM
"Read the Comments for that article...even more amusing."

I can't stand it when people say "You suck Bill [Gates]" without a partially valid reason. Windows crashes on your computer every 5 minutes, then you have a partially valid reason (I say partially because 99% chance that it's crashing because of how you set it up).
People hate him because he's obviously a genius and made more money that most of the people posting on this forum ever will combined; is he supposed to stop and say, "Oops, I'm sorry, I was smart (and admittedly lucky--who knew how well Windows would take off?) and so I got a lot of money for my family (and their families, and their families (and so on)); here take the money back!"
Heck no, and he shouldn't. Those MS (I also hate people that put M$--wow, a company tries to make $? Insane) haters out there are all morons. If you use Netscape because you hate MS, and thus believe IE is inferior, then have fun with a horrible web browser full of bugs (and that installs annoying little ads for AOL all over ... yes, I need AOL after DLing Netscape ...).
If you hate MS because you're that dumb, then go to Mac (ha, have fun there), Linux, or Unix, but don't sit around and type away on a Windows machine about how horrible MS and Bill Gates are because it just shows you how stupid you are.
Also, I recognize that Linux and Unix have great benefits over Windows (and vice versa, but not Mac's :) ) and that there are obvious, as well as extremely valid reasons to not use Windows for some cases. However, to say Linux or Unix are better than Windows without specifying areas in which it is, is just pathetic. To say a Mac is better than Windows is also just pathetic :) (to mention Mac this many times in one rant is pathetic too...you might note I don't care for Apple, but it is not because of GOOD business decisions or GOOD business practices on their part. No, it's because they lie in their ads and because I don't like how anything is done on a Mac).
I could rant more and more (and I probably should because I bet I left parts of this hanging), but I'm going to stop.
STOP HATING MS BECAUSE THEY'RE SMARTER THAN YOU (and me)!
Picky
0
pickyh3d
10/2/2002 9:36:10 PM
On a 400 Mhz webserver with 384 mega byte ram I have run a little test.

I show only Hello world.
The aspx page takes about 8 second to display.
The php page takes less then 1 second to display.
Has somebody an expenation?
0
Bert
10/5/2002 2:17:16 PM
Well, for one thing, you're probably not caching the ASPX page. For another, whenever you call any page the first time, it has to be built and executed by the server, so yes the first page is going to take longer. But if you have output caching enabled, your subsequent page loads will be nearly instantaneous. And seeing as how you can cache pages by parameters, you could conceivably cache any database output you could possibly imagine.

For about the 5 millionth time, ASPX is faster than PHP. ASP.NET is compiled, PHP is interpreted. If you can't understand what that means, you really need to do some research about scripting vs. programming.
Some of you PHP people are trying to defend an indefensible position. When done properly, ASPX is faster. Sorry, get over it. It's not opinion, it's fact. Now, if you want to talk about why you like PHP more than ASPX, then cool. But don't go mixing opinion with fact.
FACT: ASP.NET is compiled.
FACT: PHP is interpreted.
FACT: Compiled, native code execution is faster that interpreted code execution.
OPINION: "PHP is better because I say so, so nya nya nya."
Lets grow up a little bit on this one, ok guys?
0
interscape
10/5/2002 3:11:22 PM
First of all why should I cash a page with only Hello world on it.

There is nothing to do only display Hello world.
The first page load in aspx takes about 13 seconds.
If I toggle between a few simple aspx pages for each page it takes about
8 seconds to load.
I was suprised by that because the first time an aspx page is loaded it is compiled
and the next call for that page should be mutch faster.
The only thing what I want to know if sombody has an explanation.
Is a 400 Mhz webserver not fast enough for asp.net?
I'am not interested in statements that asp.net is compiled and that php is interpreted
and for that reason it must be faster.
I want only solve this problem because we plan to build or webpages with asp.net.
0
Bert
10/5/2002 5:05:28 PM
you cache the page so that the request is not recompiled every time. If you add an output cache header to the page it loads almost instantaneously. I don't care what you have on the page.... cache it. That way you bypass the execution engine.

You really ought to get a much faster web server. 400MHz doesn't cut the mustard. Your pages would render tons faster on a faster server.
You really need to look into ASP.NET's features are before deciding if you want to develop towards it or not. There is really no point unless you understand the features and architecture.
0
interscape
10/5/2002 6:22:57 PM
i would reccommend going to www.gotdotnet.com and looking at the ASP.NET quickstarts. Then grab the IBuySpy store in the language of choice and start taking it apart and understanding the code. The store is a great example of all the things that ASP.NET has to offer, including output caching. Practically every page on there is cached, even database driven ones.
0
interscape
10/5/2002 6:34:10 PM
OK, I'm an ASP.NET guy, but . . .

ASP 3.0 is NOT compiled, neither is PHP 3.0.
ASP.NET is compiled, and SO IS PHP 4.0 guys.
Some implementations of JSP are also compiled.

Thanks, Paul Wilson, ASPInsider, MC**

For the best .NET code, examples, and tools, visit:
WilsonDotNet.com, WilsonWebPortal.com, ORMapper.net
0
PaulWilson
10/5/2002 10:36:23 PM
This is getting a little rediculous.  If your 400 Mhz "webserver" takes 8 seconds to load a hello world test page, then there is something drastically wrong with your configuration.  I'm not going to take the time to troubleshoot your machine here, but I have a PII 333 256 mb machine that runs a Hello World page in 1 second (with no caching).  But what everyone seems to miss in this thread, is that multiple, repeated requests measure performance--not the first request made after a webserver restart!

Robert makes a good point about the initial request. ASP.NET compiles the code to two different levels on the initial request. The first (given you aren't using code-behind pages) is compiled to CLR "byte code" similar to how Java works. The second compilation produces "machine code". That machine code is executed on all subsequent requests. Now, I would like someone to explain how any script in the world is going to be faster than machine code.
The bottom line is that you can't trust your 400 Mhz machine or my 333 Mhz machine. There are so many ways to misconfigure you system, especially if you aren't familiar with the technology. We've already had someone earlier in this thread cite the "Nile" benchmark which reports ASP.NET and PHP speed. Use something like that to gauge the performance (tests running on professionally prepared machines)--not a couple of misleading anecdotal examples.
Troy
0
ttuttle
10/5/2002 10:39:32 PM
> ASP 3.0 is NOT compiled, neither is PHP 3.0. 

> ASP.NET is compiled, and SO IS PHP 4.0 guys.
> Some implementations of JSP are also compiled.
PHP 4.0 is not compiled unless you buy the Zend add-on.
0
ttuttle
10/5/2002 10:43:23 PM
> you cache the page so that the request is not recompiled every time. If you add an output 

> cache header to the page it loads almost instantaneously. I don't care what you have on
> the page.... cache it. That way you bypass the execution engine.
Caching is not always the answer. What if it is an extranet application that needs to show the newest data on every request?
ASP.NET is still going to outperform PHP and ASP without caching. The problem with the 400 Mhz is not caching or lack of power. There must be a configuration problem if a Hello World test page takes 8 to 13 seconds. (see my previous post) I don't care if it's running on a pentium 200 Mhz, it shouldn't take that long. Heck, ASP 3.0 runs 5 times that fast!
Troy
0
ttuttle
10/5/2002 10:50:43 PM

> Read the Comments for that article...even more amusing.
How did you add the hyperlink to this page?

Regards,

Fred Chateau
0
fchateau
10/6/2002 12:24:30 AM
> Robert makes a good point about the initial request. ASP.NET compiles the code to two different levels on the initial request. The first (given you aren't using code-behind pages) is compiled to CLR "byte code" similar to how Java works. The second compilation produces "machine code". That machine code is executed on all subsequent requests. Now, I would like someone to explain how any script in the world is going to be faster than machine code. 

I'm not quite sure that is correct. The .NET runtime compiles and executes almost exactly like Java, in that the MSIL code is what is stored and loaded when a program is called. The conversion of MSIL to machine code is done each time MSIL code is run by a JIT (Just-In-Time) compiler.
This is still multiple times faster than interpreted script, but not as fast as executing machine code directly, however .NET employs another mechanism for improving performance that makes up for the necessity to perform a second compliation on-the-fly while executing. The JIT compiler only compiles intermediate code that actually needs to run, so code branches that are not active and unused classes are left alone and do not occupy compiliation time.
So if you were to compare C# or VB.NET to any other high level language in terms of performance, in my opinion the closest one would be Java, and .NET even improves upon that, simply because it was written afterward and thus is able to incorporate the better technology in Java while eliminating the design deficiencies.
Someone please correct me if I'm wrong about the .NET compliation and execution process.

Regards,

Fred Chateau
0
fchateau
10/6/2002 12:50:03 AM
The pages on the webserver have only 20 hits a day. So output cashing wil not help mutch.

Also if the pages are compiled the generation of a Hello world page sould only take a few milli seconds. We have notised that each time a page request is made a proces is started which takes 100% of the recourses of the computer. Maybe there is a configuration problem. Somebody has an idea?
0
Bert
10/6/2002 1:16:15 PM
There's probably something quite wrong with your installation of IIS or Apache 2.0.

If you're using IIS6 (the alpha/beta), then I suggest you try IIS5.
Picky
0
pickyh3d
10/7/2002 1:10:52 AM
> ASP 3.0 is NOT compiled, neither is PHP 3.0. 

> ASP.NET is compiled, and SO IS PHP 4.0 guys.
> Some implementations of JSP are also compiled.
PHP 4.0 is not compiled unless you buy the Zend add-on.

Correct. That is the way it is.
Moreover, almost no one uses the Zend add-on - most webhosters do not have it either.
Regards,

Daniel P.
0
Daniel
10/7/2002 10:42:57 PM
As the "PHP fanboy" himself thought I'd drop by and say hello ;)

So as to this: "That article isn't just a "PHP fanboy" / "Pure hate for .NET FW", it's 97% BS!"
Would you care to be more specific? There are one or two minor mistakes (e.g. calling ASP a language becuase I'm so used grouping VBScript under the name ASP) which if I could, I'd correct. But in general, I don't make many claims about either PHP or .NET. So where is the BS?
If you liked the comments for that article, it gets even better here: http://www.sitepointforums.com/showthread.php?threadid=75170
The one big thing I failed to emphasise is, although PHP itself lacks a solid class library, thanks to both Microsoft and Sun, it doesn't need one because you can use both (plus some real C/C++ just for fun) within a single PHP script. Find out more here: http://www.sitepointforums.com/showthread.php?s=&threadid=79713
Otherwise, I'm fascinated to hear that ASP.NET may actually be slower than classic ASP. Reckon it's time to do some research.
0
HarryF
10/12/2002 1:02:04 PM
Nice troll, Harry.  I didn't think I'd waste an hour of my time this Saturday afternoon watching a sinking ship of misinformation (some would say disinformation, but I'll leave that for the Jim McDermott's and Harry Belafonte's of the world to imply).

Please send over some links to some commercial sites you've done using ASP.NET.
0
gbrown
10/12/2002 4:38:24 PM
I have the feeling that by "BS," he meant to emphasize how you only showed a one-sided examination.

Also, through out the 10 points, you gave TWO .NET links. One link was actually a good one (the list of currently .NET supported languages). Of course, you had no problem throwing php.net and zend.com links out everywhere possible.
------------------------------------------------------------------------------------------------
"But in general, I don't make many claims about either PHP or .NET. So where is the BS?"
And here's you again:
"Obviously this isn't quite the same as C# or J# but the point needs to be made -- PHP is very flexible, and offers useful solutions for the Internet. Don't expect to find yourself to be writing a successful Website in Cobol.NET -- it's likely each .NET language will eventually "tune in" to a particular type of application development."
Or, just for kicks, you again:
"In fact with PHP 4.3 in the wings, it may be that PHP can claim superior OO support, when you consider that FAQ."
I guess you never saw COBOL.NET from Fujitsu? How is PHP going to claim superior OO support, when ASP.NET has true OO support (not to say PHP can't come out on the same level though)? Oh well, there goes those claims...
No matter what you said about ASP.NET, you went further to say that PHP could do it either just as well, or even better. This, as everyone knows is not the case. ASP.NET does not beat PHP in every area possible, but PHP does not add up to equal ASP.NET. Actually no, I take that back. You can program with PERL.NET, COBOL.NET, C++.NET (Managed C++), PASCAL.NET, DELPHI.NET, C#, VB.NET, and tons of others to make an ASP.NET page. If you can do it in PHP, you can find one of these languages to do it better (even if it's not the same language on each page), which makes ASP.NET better.
---------------------------------------------------------------------------------------------
"The one big thing I failed to emphasise is, although PHP itself lacks a solid class library, thanks to both Microsoft and Sun, it doesn't need one because you can use both (plus some real C/C++ just for fun) within a single PHP script. Find out more here: http://www.sitepointforums.com/showthread.php?s=&threadid=79713"
There you go again! You're forgetting you can just plain use [Managed] C++ in ASP.NET, as well as the amply powered C# in a single script and guess what, these come with a solid class library that is huge.
You're fascinated to hear that ASP.NET may be slower based on one persons analysis that probably completely misconfigured his web server (I guess that's ASP.NET's fault). I'm guessing he did things out of order, which broke the .NET Framework.
With your comments about C++ and Java coders loving PHP: That is so general it hurts. I could say pigeons love PHP, but what does that tell you, a few pigeons, half pigeons, most pigeons? Anyone that is truely experienced with C++ and/or Java would love C#'s development scheme (especially Java people--if they didn't just go with J#). If they're Java people, then they can simply develop with J#. There's no way that a non-MS hating C++/Java coder would take the time to learn both ASP.NET (in any language they choose) and PHP, then turn back and tell me they like PHP more simply because it's easier. There are reasons some C++/Java people like PHP more than ASP.NET (other than MS being involved), but being easier is not one of them (at least it shouldn't be). A true Java developer has no reason to like PHP more than ASP.NET; C++ is another story.
-----------------------------------------------------------------------------------------------
With all of this said, PHP is a great scripting language. It does what it needs to do VERY well. It's quick, easy to learn and just as easy to use. The solid function libraries are pretty robust in PHP too, so they're worth mentioning for PHP. I still use PHP myself on personal sites that don't need extensive compilation and/or are small projects that don't get anything from the often repetitive object orientation of everything when dealing with smaller projects (of course this doesn't matter when dealing with bigger projects as it makes MUCH more sense to have this). If you want to see one site I recently made in PHP for the military recruiters (for free--and for myself) that uses XML databases then go to my main page : http://www.chrissharp.net. I realize the site rather sucks, but it does exactly what I wanted it too and it is really quick.
On a side note about your comments on C++ not being touted as the language of the future (your first comments) ... because many people believe Java is. Me? I don't think Java is going to servive in a few long years (because of Sun). I love programming with C++ and I don't have any problems with the language. Obviously, it would be nice if it came with a string type and things built into the language, but I don't have problems with that not existing either (and there are of course string classes made for it). After all, C++ didn't start off with the goal of being "easy" and because of that, you can do a lot more.
The OO support in PHP is not as good as C++'s, in any way. It does what it has to do, in a quick and dirty way, but C# (and the others) beat it face down.
For those of you looking at PHP and its non-binding variables (i.e., $NotBinded could be an integer, string, or double, all within the same function, with out redeclaring it) then you might want to look into JScript.NET. I don't use JScript because I prefer the binding data types.
Picky
0
pickyh3d
10/12/2002 5:57:43 PM
I thought I'd post about Generics here, since I asked about them earlier (on the C# forum).

Generic's are templates.
http://research.microsoft.com/~dsyme/papers/generics.pdf
In case anyone was really scared about the use of strict data typing in ASP.NET. Any C++ programmer will love this. Oh well, I guess PHP's jumping between data types is good (and safe)? It's nice being able to do the following:

$AnyVar = "string";
if ($AnyVar == "string")
$AnyVar = 1;
else
$AnyVar = 0;
if ($AnyVar) // C# would have if (AnyVar == 1) ... which is one thing I wish wasn't always there
$AnyVar = 1.23;
else
$AnyVar = 0.23;

But it's not exactly the safest thing to let variables jump between types like that (no matter how helpful it can be on small projects).
Picky
0
pickyh3d
10/12/2002 6:18:52 PM

> As the "PHP fanboy" himself thought I'd drop by and say hello ;)
>
>So as to this: "That article isn't just a "PHP fanboy" / "Pure hate for .NET FW", it's 97% BS!"
>
>Would you care to be more specific? There are one or two minor mistakes (e.g. calling ASP
>a language becuase I'm so used grouping VBScript under the name ASP) which if I could,
>I'd correct. But in general, I don't make many claims about either PHP or .NET. So where is
>the BS?
Well, I'll give it a try. You articulate the advantages of PHP quite well, but I guess my complaint with your article is with your 10 "NET Myths". Those arguments may be perpetrated on sitepoint regularly, but they are hardly good examples of .NET strengths. It’s easy to knock a straw man down.
It seems you know a bit about PHP, but your knowledge of .NET and specifically ASP.NET is severely lacking. It’s ok though, since it is very new, very few people really have a grasp of it’s capabilities. I don’t profess to know everything about .NET or PHP, but maybe I can help the debate a little. If my facts are not correct, please, by all means, correct me.
First, I’m going to limit my comments to issues of serious software development. If you want to hack out a form-to-email script for your Aunt Rosie in some procedural language, then go for it. I call that a function or a method, not a software application.
>^^^^ From SitePoint Forum (http://www.webmasterbase.com/article/870) ^^^^
>4. PHP is not compiled, other than when it's interpreted at runtime, whereas
>.NET enjoys all the benefits of being compiled.
>Here's news for the .NET crowd -- you've finally caught up! Microsoft's use of
>the word "compiled" in regard to .NET is not what a C++ coder would call
> "compiled". Zend, the corporate face of the PHP project, have been doing
>this for a while now
ASP.NET is compiled. It is very similar to Java in that it’s compiled to “byte code” first, then compiled again to machine code before execution. So is it compiled like C/C++, no, it is closer to the way Java is compiled.
As far as comparisons to Zend, what percent of PHP implementations (hosting companies included) use Zend? My guess the majority of PHP code running in the world is not compiled. I know it isn’t nearly as close to ASP.NET implementations that execute compiled code (100%). So in real-world usage, we are really comparing interpreted code (PHP) and compiled code (ASP.NET).
>^^^^ From SitePoint Forum (http://www.webmasterbase.com/article/870) ^^^^
>7. Language.NET has superior object orientation.
>
>For those who know PHP and its limitations, you may be amused by this .NET
>FAQ -- sound familiar? In fact with PHP 4.3 in the wings, it may be that PHP
>can claim superior OO support, when you consider that FAQ.
This FAQ doesn’t have anything to do object orientation! You are confusing completely separate issues here. The FAQ deals with the .NET Framework’s code and object management (very low level). These are very similar issues the Java Virtual Machine deals with. Automatic garbage collection is an interesting debate, but has nothing to do with OO. PHP is very, very, far removed from this platform architecture.
If you want to talk OO, then you must make comparisons to C#, VB.NET, Jscript.NET. I guess this is my biggest complaint with pro PHP posters, they usually have very poor understanding of true OO principles. A LANGUAGE IS NOT OBJECT ORIENTED UNLESS IT SUPPORTS THE FOLLOWING:
Abstraction
Inheritance (through unlimited multiple levels)
Polymorphism
Encapsulation
Then we can get into more granular OO details like member overloading (an extremely powerful feature in C#). PHP is so far removed from this level of sophistication, flexibility, and power, it is humorous to even make the comparison. And really, any serious developer says that they would rather have the choice of working in OO or procedural code, really doesn’t fully understand the advantages of OO programming in my opinion. I know there are some very capable PHP developers out there, but by judging the content of PHP posts I read, most do not really know what OO means. A PHP developer talking about OO principles is akin to a hockey player lecturing a football player on how to kick a football. They are often in two completely different worlds.
>^^^^ From SitePoint Forum (http://www.webmasterbase.com/article/870) ^^^^
>8. .NET offers superior templating and web development features.
>Microsoft has come up with some nice features with .NET that are certainly
>enticing, like the datagrid, and the templating mechanism. But you could easily
>reproduce these with a little PHP (try DaDaBIK, for example).
DaDaBiK (or any other template design) vs. ASP.NET programming model? Please. I challenge any PHP developer to actually examine ASP.NET in depth. It’s not a matter of just “templates”. ASP.NET has a full event model, automatic state management (view state), true programming control of html elements, built-in form validation controls, built-in application security classes, built-in page caching. Need I say more?
You also mentioned PHP’s popularity world-wide and with corporations. PHP is very popular, but I think some of the surveys are a little misleading. I understand that Netcraft shows PHP to be running on more websites than IIS/ASP. My guess is the average PHP server is much smaller than the average ASP machine. Netcraft counts Joe’s Home Page running PHP on a tiny Linux box the same as one of Monster.com’s web servers. Tell me how much web traffic goes to ASP sites compared to PHP sites. I will bet it is a whole different story.
And finally, for all you aspiring web developers out there, do some job searches at dice.com or monster.com to see which development platforms actually get paid jobs. Try searching for PHP, then ASP. Here are my results at dice.com for a nation-wide search:
PHP 57 jobs
MySQL 55 jobs
ASP 2231 jobs
ASP.NET 140 jobs
..NET 1717
SQL Server 1711
JSP 630 jobs
Java 3168 jobs
Now tell me how PHP fits into this mix? Looks like the real debate is between Java and .NET, and so do the people putting their money where their mouths are.
Troy T.
0
ttuttle
10/12/2002 7:52:45 PM
From the little code you've provided I would have to say that I believe any performance bottlenecks you are experiencing is likely coming from your use of ADO.NET, not any issue with the ASP.NET engine.
0
Halo_Four
10/12/2002 9:39:40 PM
It is very similar to Java in that it’s compiled to “byte code” first, then compiled again to machine code before execution. So is it compiled like C/C++, no, it is closer to the way Java is compiled. 

Not quite. ASP.NET (in fact, all .NET languages) is first compiled to IL (intermediate language), which is not quite the same as bytecode. This is what is produced, for example, when you "build" a project in Visual Studio .NET.
Unlike bytecode, the IL is then further just-in-time compiled to processor-specific (in most cases, x86) instructions (you can also pre-compile the IL to native code with a utility called ngen.exe, at the cost of some optimizations vs. JIT). So what ends up getting executed is, in fact, fully-compiled native code. It is certainly arguable that C/C++ code may be more fully optimizable, and so may have some marginal performance advantage over managed (.NET) code, but that doesn't mean that managed code isn't fully compiled.
In the case of ASP.NET, what typically happens is that on the first request to a page in a given directory, the ASP.NET runtime takes care of batch compiling all of the pages in that directory. Once compiled, the compiled versions are cached on disk and in memory until the Web application or the server is restarted. So you take a bit of a perf hit on the first request of the first page, but after that you are simply executing compiled code, which is likely to be far faster than interpreted code.
Sorry to jump in in the middle of this, but I thought it important to clarify that point.
Regards,
G. Andrew Duthie

My Blog

Code Camps in the Mid-Atlantic
0
G
10/12/2002 11:17:03 PM
I think he knew what you just said (although I read it the same way that you did).  I think what he meant to say "It is very similar to Java in the way that Java compiles..."

In a sense it's the same thing, because it merely translates into something that is readable by a single compiler opposed to having it jump from VB.NET, to C#, to Managed C++ (which the initial compilation to IL has to do).
I definitely see why you posted and I know that you're right, but I'm just mentioning for him, that he probably just meant what you said, in less words :).
Picky
0
pickyh3d
10/12/2002 11:36:46 PM
I think it's funny because I did the searches at the site he provided:

http://www.it.jobserve.com/jobserve/searchresults.asp?jobType=*&d=5&order=Rank&page=1&q=PHP
PHP: 56
ASP: 468
JSP: 194
..NET: 364
MySQL: 58
SQL Server: 864
Java: 1204
C: 939
C++: 1481
Interesting results, eh?
Picky
0
pickyh3d
10/13/2002 12:10:17 AM
You quoted:

Robert makes a good point about the initial request. ASP.NET compiles the code to two different levels on the initial request. The first (given you aren't using code-behind pages) is compiled to CLR "byte code" similar to how Java works. The second compilation produces "machine code". That machine code is executed on all subsequent requests. Now, I would like someone to explain how any script in the world is going to be faster than machine code.
To which you responded:
I'm not quite sure that is correct. The .NET runtime compiles and executes almost exactly like Java, in that the MSIL code is what is stored and loaded when a program is called. The conversion of MSIL to machine code is done each time MSIL code is run by a JIT (Just-In-Time) compiler.

Although I would quibble with the notion of "CLR 'byte code'", which I believe to be an inaccurate way of describing IL, the description of how compilation in .NET works is essentially correct.
The managed language (C#, VB.NET, etc.) is compiled by either Visual Studio .NET, a command-line compiler, or the ASP.NET runtime (in the case of code in a < script runat="server" > block in a .aspx or .ascx file, for example) into processor-independent IL code. This IL code is what is contained within a .NET assembly (DLL or "portable executable", as they're sometimes called). When the code is executed for the first time, it is JIT-compiled to processor-specific native code, and the native code is cached. This means that the code is not recompiled from IL to native code on each subsequent execution.
It is true that when an ASP.NET application is restarted, or the server is rebooted, the MSIL to native compilation step must be taken again, but that's not the same as it happening each time the code is executed.
Regards,
G. Andrew Duthie

My Blog

Code Camps in the Mid-Atlantic
0
G
10/13/2002 1:14:09 AM
-- ****************** --

Not quite. ASP.NET (in fact, all .NET languages) is first compiled to IL (intermediate language), which is not quite the same as bytecode. This is what is produced, for example, when you "build" a project in Visual Studio .NET.
Unlike bytecode, the IL is then further just-in-time compiled to processor-specific (in most cases, x86) instructions (you can also pre-compile the IL to native code with a utility called ngen.exe, at the cost of some optimizations vs. JIT). So what ends up getting executed is, in fact, fully-compiled native code. It is certainly arguable that C/C++ code may be more fully optimizable, and so may have some marginal performance advantage over managed (.NET) code, but that doesn't mean that managed code isn't fully compiled.
-- ****************** --

Thanks for the clarification and correction. I stand corrected, but I think my overall point is made about compiled vs. interpreted code.
Troy T.
0
ttuttle
10/13/2002 4:20:46 PM
Hi there, Harry.

I agree that the statement I made could need some specification. My earlier BS estimate may also be somewhat high. I can be willing to lower it to, let's say, 80%? Just kidding! I thought your article was more a slashdot.com attack on Microsoft rather than a comparison between PHP and ASP.NET, and that it lacked in facts about ASP.NET and the .NET FW.
Here is what I think:
1. PHP is like an open source .NET.
ASP+ (assuming you mean ASP.NET) isn't a language, it's a application layer sitting on top of the CLR and provides classes witch you can use in any of the .NET languages (C#, VB.NET, MC++ etc..)
In my opinion, php can at best be compared with aspx pages with inline code.

2. .NET is going to be the future of the Internet!
Not exactly sure what you mean here, but Microsoft will indeed center it's technologies around the .NET concept. As far as I have heard, they have no plans to port all their software to the .NET framework, but as the .NET concept is more a vision of what the future will be like, they will fit their technologies to that vision
3. .NET is the best technology for building a Website.
There are several low price .NET hosts around, and even free ones. Take a look at the host listed at ASP.NET
4. PHP is not compiled, other than when it's interpreted at runtime, whereas .NET enjoys all the benefits of being compiled.
As far as I have understood, the component you are referring to isn't very widely supported by the various web hosts. As for the compilation of .NET assemblies I choose to refer to other parts of this thread. http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=733#67255
5. ASP.NET has accountable support. PHP has none.
Pretty much the same applies to ASP.NET (this site f.ex), but you don't happen to mention that :)
6. .NET supports multiple languages. PHP doesn't.
Why wouldn't you write a web application in COBOL.NET?! I've even seen examples of applications made in Visual FoxPro.NET
7. Language.NET has superior object orientation.
Unfortunately I don't know enough about distributed development to make any claims to the faq link you provide. However, OO is the most logical way to go whatever you are developing. Providing you have the same knowledge of both technologies, I am certain you can develop almost any application faster in asp.net, even if it's a small non-commercial site.
8. .NET offers superior templating and web development features.
What on earth has made you think you are forced in to a single approach when it comes to template driven pages in .NET? Take a look at the Architecture forum here.
9. But corporations don't like PHP.
What pays the most? ;)
10. PHP is doomed!
I do not wish to argue with your preferences, as most of that point is reflecting. However, I can't see that ASP.NET lacks in any of your thoughts to why PHP won't be overrun by .NET, except maybe that PHP is less overwhelming to get started with
Please feel free to correct any misstatements I've made. I have tried to stay to the facts, but I'm no expert, and may have been somewhat emotionally involved ;)

Christian Nordbakk

http://www.anothereon.net
0
Christian
10/13/2002 8:13:40 PM

> When the code is executed for the first time, it is JIT-compiled to processor-specific native code, and the native code is cached. This means that the code is not recompiled from IL to native code on each subsequent execution.
I assume this means the native code is cached in memory and not stored back to file. If so, this may be highly relevant to portions of this discussion I have read previously.
Some users have complained here about the slow execution of .NET code on their Web servers, and in particular when using their development workstation Web servers. I have several ASP.NET Web applications configured on my Web server and I've noticed that while some are very fast, others appear slower. It occurred to me that the slower sites were those that were seldomly accessed by anyone, but it hadn't made sense to me until now because I knew that the code had already been compiled.
So, now I'm assuming that any slowness I see is occurring because the Web site has not been used since the last restart. Furthermore if I remember correctly .NET will reset itself whenever it runs out of memory, so a workstation running IIS without adequate memory would probably cause .NET to restart itself often, and there would be repeated waits for pages to re-compile. This could make .NET seem very slow compared to ASP and may account for some of the wild accusations that have appeared here from time to time.

Regards,

Fred Chateau
0
fchateau
10/14/2002 9:05:50 AM
So, now I'm assuming that any slowness I see is occurring because the Web site has not been used since the last restart.

It may also be that the cached compiled code is removed from memory after a certain amount of time with no activity. I'm not certain about that, as I'm not intimately familiar with the scavenging routines for that part of the framework. In any case, I believe you are correct in that a Web application that is infrequently used is apt to see more overhead due to compilation because it's more likely that the application will have been shut down or restarted since the last request.
Unfortunately, for this type of application, even output caching is not a helpful answer, because there are scavenging routines that will remove items from the cache after long periods of inactivity. For an application that receives little traffic, but for which you want to avoid users seeing compilation overhead, it might make sense to set up some kind of polling app (or service) to make a request to one page in each app folder every half hour or so. That would ensure that if there is compilation related overhead, it would not be a problem for users.
Of course, as others have observed, the easy way to tell if any performance complaints are compilation related is to run a load test using the Web Stress Tool or Application Center Test, rather than relying on manually browsing pages, which is simply not an accurate or meaningful way of testing performance. If the perceived performance problems disappear when using a load testing tool, it's highly likely that what was perceived as a performance problem was merely the startup compilation costs.
Regards,
G. Andrew Duthie


My Blog

Code Camps in the Mid-Atlantic
0
G
10/14/2002 11:31:18 AM
A further answer is on it's way to the many responses (short on time right now).

First of all, the article was intended to be biased and provoke discussion. It was specifically addressing a few remarks made in various PHP vs. .NET discussions on Sitepointforums (most fairly non technical) and the "10 Myths" were aimed to address woolly "facts" being made as to why .NET is better.
I still say ".NET is compiled" is a misleading statement. What .NET doesn't do is the "Link" operations that make a truly stand alone executable (i.e. seperated from the framework), as with traditional C++. For me it takes what the Java Runtime does a step further - and perhaps because MS have the advantage of only having to develop for their own platform.
What Microsoft has done with other languages is seductive but in some cases not entirely convincing. Perl.NET for example - OK it's possible to run Perl plus CPAN modules under .NET (although the Perl interpreter is still required) but Perl being loosely typed means to hacks to use existing modules under .NET. And Java.NET?
For me the PHP approach to the same problem is better - implement a language that will be instantly familiar to C++ and Java developers while concentrating on keeping it down to earth: easy to read and learn. Then provide interop with anything you care to name (Java, COM, .NET, C++, etc.) and the ability to run fast and reliably on any web platform.
Of course MS might wake up and introduce PHP.NET...
As to OO, please don't mistake young PHP developers writing procedural code with PHP's OO capabilities.

Abstraction
Inheritance (through unlimited multiple levels)
Polymorphism
Encapsulation

PHP already supports all of these, though some things require workarounds right now (e.g. multiple inheritance - something you're rarely likely to need online). All the essential OO ingredients are right here today. Please feel free to drop your questions in on the Advanced PHP Forum at Sitepoint (http://www.sitepointforums.com/forumdisplay.php?s=&forumid=147) - the Advanced PHP Resources (http://www.sitepointforums.com/showthread.php?s=&threadid=78687) may help...
With the arrival of the Zend 2 engine for PHP, it will only very fine detail that's missing. If you'd like to know more, try: http://www.zend.com/engine2/ZendEngine-2.0.pdf , http://www.php.net/ZEND_CHANGES.txt and http://www.php.net/source.php?url=/zend2_example.phps . In particular, like C++, PHP will be able to delete objects directly, rather than relying on only garbage collection (which PHP already has).
PHP will still lack a solid class library (though perhaps someone will decide to rip off Java's again **cough**) but with technologies like SOAP/WSDL and native interop, why both writing one in PHP in the first place? Just re-use...
Of course there are things that .NET does better than PHP (we're talking the worlds largest IT corporation vs. an open source project with a small core team of developers) - mainly in the area of development tools (if you like GUIs that is). Course Dreamweaver can support PHP and far more importantly, PHP support in Eclipse (http://www.eclipse.org/) is coming soon. Eclipse? http://www.internetwk.com/webDev/INW20020820S0009 (it's free :))
And also don't forget that PHP is a language geared specifically for the web. But, aside from it's amazing community and the fact it's the most popular server side language on the Internet, PHP's biggest strength is being able to run (reliably and cheaply) on any platform. That single fact is where it will continue to put .NET and Suns web offerings to shame.
Given that enterprise is beginning to realise the benefits of N-Tier and that mixed .NET and J2EE environments will be common, my recommendation for future enterprise web deployment is make your presentation tier PHP, allowing you to integrate your J2EE and .NET investments into a single interface. The two companies pushing the N-Tier concept hardest (Sun and MS) seem to have forgotten that N-Tier should mean platform independence (i.e. no framework lock in).
0
HarryF
10/15/2002 10:48:48 PM
>I still say ".NET is compiled" is a misleading statement. What 

>.NET doesn't do is the "Link" operations that make a truly
>stand alone executable (i.e. seperated from the framework), as
>with traditional C++. For me it takes what the Java Runtime
>does a step further - and perhaps because MS have the
>advantage of only having to develop for their own platform.
I guess I don’t want to argue semantics. As I mentioned before, .NET is not compiled in the way C++ is, but is still compiled. .NET isn’t interpreted from the source code at runtime. The original point is interpreted vs. compiled, with compiled executing much faster than interpreted server-side scripts.
>For me the PHP approach to the same problem is better -
>implement a language that will be instantly familiar to C++
>and Java developers while concentrating on keeping it down to
>earth: easy to read and learn.
So PHP more closely resembles Java than C#? Really, how often are C++ and Java developers looking to learn something easy to read? I would think that they would be looking for a robust and powerful web framework, not to regress to the simple.
>As to OO, please don't mistake young PHP developers writing
>procedural code with PHP's OO capabilities.
>
>

>Abstraction
>Inheritance (through unlimited multiple levels)
>Polymorphism
>Encapsulation
>

>
>PHP already supports all of these, though some things require
>workarounds right now (e.g. multiple inheritance - something
>you're rarely likely to need online). All the essential OO
>ingredients are right here today.
You mean there _are_ older PHP developers? ;)
I reviewed your PHP OO links for new information. I have noticed that there is a movement to push PHP toward OO (a good thing). However, PHP’s approach to OO principles is quite strained. It still doesn’t completely satisfy any of the major principles (i.e. encapsulation isn’t even satisfied if you don’t have private or hidden members). When people use words like “workaround” and “simulate”, it means the language doesn’t satisfy the need. And to say PHP is OO, you have to do a lot of workarounds and simulating. An OO language doesn’t require developers to workaround.
Regardless of the major OO principles, a language is not going to be considered OO if it is still a procedural language at heart. OO languages deal with objects only (everything is an object). If you can write code outside of a class (or struct) you are not working in an OO language.
When PHP makes the leap to true OO (if it ever does), there is going to be some painful side-effects like breaking all the proceedural code out there. VB is going through this now, and it isn't easy. Lots of complaining going on, but it is needed to progress to better technology.

0
ttuttle
10/16/2002 2:21:03 PM
First of all, the article was intended to be biased and provoke discussion. It was specifically addressing a few remarks made in various PHP vs. .NET discussions on Sitepointforums (most fairly non technical) and the "10 Myths" were aimed to address woolly "facts" being made as to why .NET is better.

Would you care to be more specific? There are one or two minor mistakes (e.g. calling ASP a language becuase I'm so used grouping VBScript under the name ASP) which if I could, I'd correct. But in general, I don't make many claims about either PHP or .NET. So where is the BS?
That seems like quite a change.
I still say ".NET is compiled" is a misleading statement.
It doesn't matter if what it does is misleading and that a separate EXE is not created, it makes a pass into IL and then machine code. Machine code == compiled.
but Perl being loosely typed means to hacks to use existing modules under .NET. And Java.NET
I'd comment on it, but I don't know what you meant to say. Anyway, the fact remains that you can make Perl.NET. Or for a real example, you can make COBOL.NET. There's probably other language examples, but that's the only one I know of (not to say they don't exist, but I don't look for them...).
For me the PHP approach to the same problem is better - implement a language that will be instantly familiar to C++ and Java developers while concentrating on keeping it down to earth: easy to read and learn. Then provide interop with anything you care to name (Java, COM, .NET, C++, etc.) and the ability to run fast and reliably on any web platform.
Familiar to C++/Java developers while keeping it down to earth... I believe that's the definition of Managed C++, C# and J#. Not only that, but there are added annoyances familiar to JavaScript and VB people with "function..." that may or may not be a good thing depending on your point of view (I realize why it's like that though -- return anytype;). .NET runs fast and reliably for me. I guess you haven't chosen to look into the fact that there are ports for the .NET Framework for other OS'? Microsoft would be nice to do it for the Open Source community, but they'd be hurting their own products (i.e., Windows .NET Server--why pay for that when you can just get their Linux version of .NET Framework) by doing so.
Of course MS might wake up and introduce PHP.NET...
I'm surprised, considering your hate of MS, that you'd consider letting them make a PHP.NET. Aside from that, they'd be rewriting PHP and that's for the PHP developers to do, not MS.
PHP already supports all of these, though some things require workarounds right now (e.g. multiple inheritance - something you're rarely likely to need online).
The definition of those terms is not "Find a work-around that imitates the results of this." .NET has true OO, while PHP has a nice OO model that fits its needs (and which I actually like) that cannot be considered true OO. PHP supports Abstraction and Inheritance and work arounds to get the rest.
In particular, like C++, PHP will be able to delete objects directly, rather than relying on only garbage collection (which PHP already has).
I was under the assumption that PHP already could do this with "unset()". Also, in .NET you can explicitly Dispose of objects as you please, but just like PHP, you don't have to (which is considered a perk of both Java, PHP and .NET, as well as the rest with gc's).
Of course there are things that .NET does better than PHP (we're talking the worlds largest IT corporation vs. an open source project with a small core team of developers) - mainly in the area of development tools (if you like GUIs that is). Course Dreamweaver can support PHP and far more importantly, PHP support in Eclipse (http://www.eclipse.org/) is coming soon.
Web Matrix -- free. Dreamweaver -- support for ASP.NET. Ecplise -- if it doesn't already, I'm sure it will support C# and others (which is also unneeded because of Web Matrix). I don't feel this is a place where PHP loses to ASP.NET or ASP for that matter. ASP had InterDev, but big deal, there's TONs of free and not free tools that do the exact same thing for all languages. Obviously VS.NET has a leg up, but it had better for the price you pay.
And also don't forget that PHP is a language geared specifically for the web. But, aside from it's amazing community and the fact it's the most popular server side language on the Internet, PHP's biggest strength is being able to run (reliably and cheaply) on any platform. That single fact is where it will continue to put .NET and Suns web offerings to shame.
ASP.NET is specifically geared toward the web. Who cares if one statistic says it's the most popular server side language, does that mean it's the best? I don't use MS SQL, so I'm not afraid of the cost of ASP.NET. Also, .NET will be making a footing in the OS' soon, but for the mean time, I have no problem running my IIS5 server with BOTH PHP and ASP.NET, which is what I was originally doing anyway. The idea that the OS or webserver makes the languages is crazy.
Given that enterprise is beginning to realise the benefits of N-Tier and that mixed .NET and J2EE environments will be common, my recommendation for future enterprise web deployment is make your presentation tier PHP, allowing you to integrate your J2EE and .NET investments into a single interface. The two companies pushing the N-Tier concept hardest (Sun and MS) seem to have forgotten that N-Tier should mean platform independence (i.e. no framework lock in).
I'm sure this is your well thought out and unbiased opinion, right? MS has released a weaker [in-development] version of .NET for BeOS (or maybe it was another UNIX OS... oh well, it was one of them) and there's plenty of Open Source .NET under way. So, Sun is a joke (this is biased on my part), but MS has actually thought this thing through.
Picky
0
pickyh3d
10/16/2002 3:49:36 PM
It doesn't matter if what it does is misleading and that a separate EXE is not created, it makes a pass into IL and then machine code. Machine code == compiled.

Which goes back to my origional point that PHP's Zend Accelerator or the free alternative PHP Accelerator do the same thing and have been doing so for a while now. In their product literature they call "compiling" things like "advanced caching". So when an .NET coder tells me ".NET = compiled therefore faster than everything" I point out that it's been possible with PHP for a while now. No BS.
I'm surprised, considering your hate of MS
Who said I hate MS? As a workstation, I prefer MS's operating systems. My main interests, in regard to what motivates me to write, is how it's possible for small companies the thrive on a tight budget and at the same time how real understanding of IT in general does nothing but benefit everyone, enabling developers rather than creating dependencies. Under those conditions MS doesn't rate highly. In the case of the article in question, the aim was to provoke questions rather than "hate" of MS.
The definition of those terms is not "Find a work-around that imitates the results of this." .NET has true OO, while PHP has a nice OO model that fits its needs (and which I actually like) that cannot be considered true OO. PHP supports Abstraction and Inheritance and work arounds to get the rest.
Polymorphism is there too right now (no workarounds). 95% of the things you need workarounds for at the moment are not things you'll ever need for typical web applications. In other words, you can write a application in PHP right now which benefits fully from object oriented design. What PHP won't do at the moment is protect you from your worst mistakes or protect your classes users from doing things you don't want them to. But if everyone is careful, no problem.
And "true" object orientation is just a release away (although by definition PHP is already there). The "but PHP isn't OO" argument has actually been dead since 4.0 and in my opinion the statement now always used to sweep PHP under the carpet by those fundamentally biased against it.
ASP.NET is specifically geared towards the web
True but as MS announced themselves, it's the future development platform for all their products. As a result, it has to be alot richer than PHP. PHP, it's not intended to run on a desktop. Having said that, it looks like when .NET really takes off on the client side, PHP will be there too (see PHP Activescript ).
Who cares if one statistic says it's the most popular server side language, does that mean it's the best?
No not necessarily. But cars that burn hydrogen and oxygen have been around for a while now but who drives one?
So I assume you're saying ASP.NET is best? When I look at things utterly objectively, all .NET really has to offer over PHP is a solid class library. You'll find all the functionality of that library available in PHP, but not unified under a convienient namespace. But PHP has access to that library, as well as Java's and in the mean time, there's one or two serious projects in progress which will deliver a PHP equivalent.
You tell me ".NET" is cross platform. If you and I are both honest, I think we'd agree (bearing things like Chillisoft in mind) that .NET will only be cross platform when there is only one platform, or Microsoft realises that Open Source is not the enemy. I personally don't want to buy into a technology which ties me to other products which cost alot, which I don't trust to be secure, and which I can't scrutinize the source code should I need to. From a business point of view, I think Microsoft are insane to continue clinging to the their proprietary, one platform for all approach. Over 60% of the Internet runs Apache - that's a massive market which MS isn't selling anything to.
Why not realise people actually like Windows, because it's the worlds friendliest OS, and stop the Open Source paranoia?
But anyway back to mud slinging... PHP runs on anything and offers the best solution for the worlds favorite web platform. It's already hit critical mass, from the point of view of installed base, developer community and the sheer number of applications written in it, some of which are practically the default web solution these days (e.g. VBulletin) and others which you can hardly believe are free (e.g. the ezPublish CMS / Framework ). And everything says PHP is going to do nothing but grow further. As long as there's no alternative on Apache, PHP has all the time it needs to perfect itself.
So how about upgrading these forums to VBulletin? Let's face it - there's alot to be desired...
0
HarryF
10/17/2002 6:21:21 PM

Harry, you are quite skilled at obfuscation and diversion in your arguments. I mean that as a compliment, especially if you are a politician. Take this example:
>Polymorphism is there too right now (no workarounds). 95% of the things
>you need workarounds for at the moment are not things you'll ever need
>for typical web applications. In other words, you can write a
>application in PHP right now which benefits fully from object oriented
>design. What PHP won't do at the moment is protect you from your worst
>mistakes or protect your classes users from doing things you don't want
>them to. But if everyone is careful, no problem.
You seem to be admitting that PHP needs workarounds on one hand. And on the other hand, you are saying "you can write a application in PHP right now which benefits fully from object oriented design". Which one is it? Towards the end of your paragraph, you state that everyone "must be careful" (another workaround). If an application can fully benefit from PHP's "OO design" then why do people need to be careful with your classes? Is it because maybe PHP doesn't implement abstraction?
>And "true" object orientation is just a release away (although by
>definition PHP is already there). The "but PHP isn't OO" argument has
>actually been dead since 4.0 and in my opinion the statement now always
>used to sweep PHP under the carpet by those fundamentally biased
>against it.
Ok, I'm really confused now. If "95% of the things you need workarounds for at the moment are not things you'll ever need for typical web applications", then why is "true object orientation just a release away"? Why work so hard to implement OO if it isn't really needed in web development?
Really, you don't win any converts in a forum like this espousing evangelical, over-generalized, assertions. I'm still waiting for the "PHP is the best thing since sliced bread" statement. Is that next?
You haven't offered serious rebuttals to most the questions raised in this thread (other than a couple of links to lame OO workarounds).
If you want to insist in calling PHP OO, then go ahead. Programmers with Java, C#, or Python experience will probably get a snicker out of it. But for the undecided voters reading this thread, this is for your use.
OO is more than being able to create user-defined classes in your program. It is a completely different way of programming. For one thing, every object you work with is derived from class "object" in the class hierarchy. Even something as simple as a string is an object to be manipulated through a consistent interface. As an example, every string object you create in your programs inherits the attributes of the base class "String". After all, what good is inheritance, polymorphism, abstraction, and encapsulation if it only applies to your own user-defined classes? True OO languages like Java and C# operate in an object hierarchy for the language itself, not some loosely typed procedural pretzel.
Since this is basically about web dev, I have a food-for-thought list on some of ASP.NET's more powerful features. I mentioned a couple of these in previous posts (built in security and event model), but since PHP doesn't have a viable alternative, I guess those are to be ignored and not discussed?
built in security
full event model
datagrid control (or something like it)
databinding
custom user controls
object and output caching
code-behind pages
Correct me if I'm wrong, but I don't know of any other existing web dev platforms that supports anything close to this list. I know there are individual items implemented in other platforms. And I'm not talking about some lame user workarounds. These are existing, out-of-the-box tools that any ASP.NET developer will know, not some 3rd party "cool free script" to plug in and "simulate" the feature.
0
ttuttle
10/18/2002 4:20:59 AM
Which goes back to my origional point that PHP's Zend Accelerator or the free alternative PHP Accelerator do the same thing and have been doing so for a while now. In their product literature they call "compiling" things like "advanced caching". So when an .NET coder tells me ".NET = compiled therefore faster than everything" I point out that it's been possible with PHP for a while now. No BS.

You mean the not free Zend Accelerator and the non-Windows support from ionCube? Oh, or do you mean the "advanced caching" is just that, caching. ASP.NET on the other hand COMPILES the code and turns it into MACHINE CODE and then caches it. You cannot beat cached machine code with cached script. Oh well.
Who said I hate MS? As a workstation, I prefer MS's operating systems. My main interests, in regard to what motivates me to write, is how it's possible for small companies the thrive on a tight budget and at the same time how real (Nice shot.) understanding of IT in general does nothing but benefit everyone, enabling developers rather than creating dependencies. Under those conditions MS doesn't rate highly. In the case of the article in question, the aim was to provoke questions rather than "hate" of MS.
I think the hate my be unintentional, but it's there none the less. No matter what you say about them it has a hateful tone (even when you try to overcome their business savyness decision with platform). .NET sucks, PHP owns us all, that's your tone. Linux and other free environments can definitely help small businesses (I should know, I worked at one that had a few Linux servers), but the idea that you're suddenly owned by MS if you buy Window's is beyond me. Apache does come on Windows, as does PHP, as does MySQL and most every other free feature.
95% of the things you need workarounds for at the moment are not things you'll ever need for typical web applications. In other words, you can write a application in PHP right now which benefits fully from object oriented design. What PHP won't do at the moment is protect you from your worst mistakes or protect your classes users from doing things you don't want them to. But if everyone is careful, no problem. And "true" object orientation is just a release away (although by definition PHP is already there). The "but PHP isn't OO" argument has actually been dead since 4.0 and in my opinion the statement now always used to sweep PHP under the carpet by those fundamentally biased against it.
It isn't, it is, it isn't, it isn't, and finally it is. Wow, now who said roller coaster rides are bad for you? That was fun (and funny). At least stick with it is or isn't throughout the same two paragraphs when you try to tear me up. Oh no, my encapsulation in C# is terrible--guess I'll go find the by-definition true OO work-around in PHP to it. Oh wait...... so, which Senate seat are you running for?
No not necessarily. But cars that burn hydrogen and oxygen have been around for a while now but who drives one?
H and O<sub>2</sub> cars are supposed to be better than gasoline cars as far as efficiency and cleansliness goes, so what are you trying to say: The older PHP is dirtier, but the new cleaner, more efficient (and faster--don't give me that "You can buy an advanced cacher" that no one includes when they give PHP servers BS) ASP.NET is never going to be used?
You tell me ".NET" is cross platform. If you and I are both honest, I think we'd agree (bearing things like Chillisoft in mind) that .NET will only be cross platform when there is only one platform, or Microsoft realises that Open Source is not the enemy. I personally don't want to buy into a technology which ties me to other products which cost alot, which I don't trust to be secure, and which I can't scrutinize the source code should I need to. From a business point of view, I think Microsoft are insane to continue clinging to the their proprietary, one platform for all approach. Over 60% of the Internet runs Apache - that's a massive market which MS isn't selling anything to.
Luckily you included "you and I" because you certainly have trouble with being honest. Let's just walk through this paragraph. MS makes a BeOS (or whichever UNIX) port of .NET and another open source one is being made for Linux, which you, honestly and implicitly, deny in this. I run a Win2k server for my site, I use IIS5, ASP.NET, PHP, and MySQL (with PERL and other extensions/modules). Doesn't look like I'm stuck to MS, but wait, I don't have Apache?! I'm insane! Oh ya, I forgot, I can't because MS has me tied to them (or it could be that I wanted IIS and didn't download Apache). ALSO, I don't think the billionaires at MS are clueless as to what to do "from a business point of view". Apache 2 supports ASP.NET. Enough said, of course, that's if you and I are honest.
Why not realise people actually like Windows, because it's the worlds friendliest OS, and stop the Open Source paranoia?
Let's see, I believe I'm typing in a soon-to-be open source (and source downloadable) forum developed by, you guessed it (not Frank Stallone), MS, who is allowing the Linux port of .NET. Darn.
PHP runs on anything and offers the best solution for the worlds favorite web platform. It's already hit critical mass, from the point of view of installed base, developer community and the sheer number of applications written in it, some of which are practically the default web solution these days (e.g. VBulletin) and others which you can hardly believe are free (e.g. the ezPublish CMS / Framework ). And everything says PHP is going to do nothing but grow further. As long as there's no alternative on Apache, PHP has all the time it needs to perfect itself.
Back to completely biased points-of-view, the best solution is dependent on job at hand. I want to make a Web Service, well then, I don't think PHP is the best solution there (no matter what by-definition true work-arounds you can implement to fake a Web Service that is very easily made in ASP.NET). What do you mean by developer community? I guess we don't count, oh well.
Thought I'd quote this again:
As long as there's no alternative on Apache, PHP has all the time it needs to perfect itself.
Now go to this site:
https://www.covalent.net/
I guess that all the time it needs is kind of out of time?
Microsoft realises that Open Source is not the enemy
Then of course me:
These forums are open source.
Then there's this:
So how about upgrading these forums to VBulletin? Let's face it - there's alot to be desired...
Then of course above:

Picky
0
pickyh3d
10/18/2002 12:14:16 PM
First going back to an earlier point PHP coming ability to delete objects. The examples given by Chris assume you know the objects reference. With the new engine, my understanding is you'll be able to get an object to delete itself or in cases where you're using a factory method or an interface for example, and don't what objects have been created, you can still delete them. PHP will also have a destructor as well as the constructor is already has, so you can can be sure an object will die the moment it's finished with. Pedantic I know, but it's nice to quote features that other languages don't have.

Harry, you are quite skilled at obfuscation and diversion in your arguments. I mean that as a compliment, especially if you are a politician.
Thanks for the compliment :D But I'm not trying to pull the wool over anyone's eyes - simply trying to explain PHP without assuming a knowledge of it.
The way I see OO in PHP right now, is basically everything to need is already there. In many ways (others would disagree) the new OO features about to be added to PHP are more about silencing the critics rather than adding critical stuff PHP is lacking.
The ability of a programming language to be object oriented is defined as the language being able to provide three things: encapsulation, inheritance and polymorphism.
PHP provides these today, therefore is a true object oriented language.
Compared to Java or C#, sure PHP doesn't offer all the OO features they have (yet) but it's perfectly possible to write the entire .NET (Java) library in PHP and use it in exactly the same way. In fact many people have done just this. Have a look at the extremePHP API documentation for example.
An example of something PHP doesn't do right now is protected methods. The definition of OO doesn't state anywhere that methods must be protectable. What that means is, if you make a PHP class library, people using that library could decided to use methods you don't want them to. But as you've provided the API documentation, as long as they conform to it, no problem.
OO is more than being able to create user-defined classes in your program. It is a completely different way of programming.
Absolutely. The real power of OO takes place when objects "interact" in some way. PHP is perfectly capable of taking full advantage of this and there are PHP developers out there doing just that. Hence I say "you can write a application in PHP right now which benefits fully from object oriented design".
But the definition of object orientation does not say "and the language must only allow OO". PHP allows you to write procedural code as well and many PHP coders from an HTML / web design background who have no experience of OO write that way (and are very happy - this probably has alot to do with PHP's success). That doesn't mean PHP is not a true object oriented language.
And that your language of choice offers OO, still doesn't mean you're going to write good code.
As an example, every string object you create in your programs inherits the attributes of the base class "String". After all, what good is inheritance, polymorphism, abstraction, and encapsulation if it only applies to your own user-defined classes? True OO languages like Java and C# operate in an object hierarchy for the language itself, not some loosely typed procedural pretzel.
I think you need to replace "True OO languages" with "Fully OO languages". Taking your example, PHP dares to assume the developer doesn't care about primitive data types. What do you normally type: - "Int s = new Int;" or "int s;"?.
Strong vs. loose typing? That's a whole debate in itself, where there's a whole army of Perl coders would could attest to the fact that loose typing works very well, thank you.
As to the list;

built in security
full event model
datagrid control (or something like it)
databinding
custom user controls
object and output caching
code-behind pages

I think you've find Java does most of those although it requires an application server to deliver elements which are part of the .NET engine itself.
And as to PHP - well there's absolutely nothing there PHP can't do (it's engine is designed for the web). As I've said, you won't find those all within a single library, pushed on you with the language, so it's up to you to either write your own classes to wrap the core PHP functionality, or find open source libraries to do it for you (extremephp and PEAR being just two of many many to choose from). It may be it takes developers new to PHP a long time to come to the right decisions when building their own library and this does impact the ability of the current generation of PHP applications to seamlessly integrate.
Having said that I feel confident to predict, with added stimulation from the Zend 2.0 engine, that some very solid libraries will be making themselves known over the next year (I happen to know of one soon to be released, combined with an already successful PHP framework, which is going to rock). And there's plenty of time for PHP to come up with answers.
But here's the key thing. By tying yourself to a framework, you're pretty much tied to doing things the way the framework want's you to (of course reinventing the wheel is option). But what if your framework supplier lets you down? Taking output caching for example, we've already seen questions raised in this thread regarding how for low traffic sites may fail to benefit from .NET's caching, the cache being cleared too soon. There's no doubt a workaround. Or web services security - what if MS go with a security solution then no other vendors use it? The cheif vendors have converged on SOAP but seem to diverging again for web services security. Bang goes your interoperability.
And on a broader level, a framework ties you to a particular approach to application design. What if those that built the framework got it wrong? "Never. It's MS!", you cry. They've had alot of time and developers available to perfect .NET but the class library is basically a copy of Java's. Did Sun get it right? On a side note, The PHP group is working to take the best of Java's OO and the best of C++'s then combine them into a new object model. On possible benefit is perhaps they'll succeed in delivering something Sun has failed to - performance. And from an application design perspective, perhaps it will be easier to work with?
And is object orientation the final solution to programming? Taking a parallel of XML's two APIs SAX and DOM. You could regard SAX as a parallel to procedural code and DOM as a parallel to object oriented code. Neither of them are perfect. SAX suffers from many of the problems you have with procedural code. DOM will topple the mightiest of servers if the XML document is too big (and for simple documents, DOM is sometimes like taking a tank to crack a walnut). The search is still on for a better XML API...
Trends in IT change each year, often requiring old code to be re-written to survive in the current environments supported by the big vendors.
Remember when DCOM was hot?
0
HarryF
10/18/2002 1:14:15 PM
From my post above Harry's (which I apparently found a length limit for...)

"Then of course above: " should be followed by:
Why not realise people actually like Windows ... and stop the Open Source paranoia?
Then my reply:
These forums are open source and are being developed with different tools (i.e., ASP.NET). I get your point, but the fact that these forums exist negate half of your other points.
Picky
0
pickyh3d
10/18/2002 2:51:51 PM
Attention all ASP.NET developers, stop working in .NET and start using PHP!  I'm convinced the successor to sliced bread is here!  Let's all join and sing the praises of PHP.  Don't have specifics?  That's ok.  No specifics needed in evangelical propaganda!

Just having some fun here... No flames please.
>I think you need to replace "True OO languages" with "Fully OO
>languages".
I'm tiring of the semantical game here. Call it what you want. PHP as a language doesn't compare with "Fully OO languages". I rest my case.
>And as to PHP - well there's absolutely nothing there PHP
>can't do (it's engine is designed for the web). As I've said,
>you won't find those all within a single library, pushed on
>you with the language, so it's up to you to either write your
>own classes to wrap the core PHP functionality, or find open
>source libraries to do it for you (<a
>href="http://www.extremephp.org">extremephp</a> and <a
>href="http://pear.php.net">PEAR</a> being just two of many
>many to choose from). It may be it takes developers new to PHP
>a long time to come to the right decisions when building their
>own library and this does impact the ability of the current
>generation of PHP applications to seamlessly integrate.
So these are built with C (Pear) and/or depend on PHP's OO (Extreme)? Fantastic. I'll gladly take my consistant framework over this inconsistant hodge podge of libraries.
I still haven't seen an event model, maybe I missed something? What exact method is called in PHP when the user clicks on a submit button? Have you even looked at ASP.NET's event handling?
0
ttuttle
10/18/2002 4:50:06 PM
PHP does not support polymorphism 100%.  Search the sites for it (I searched php.net and zend.com).  Other than that, you're right, it is an OOPL, but not a true one (missing that simple thing).  I also think it's worth noting that PHP doesn't need that because of the way it works and I've never needed that feature in my sites before with PHP.  Maybe there will come a time that I will need it (say for using a class to access multiple databases).  Who knows, even then I'd probably just write a different function name for it.

Other than this, yes, PHP can do most OOP, especially that that you might need if you decided to make a web site, as you've said. However, calling it a true OOPL is still a distinct difference from what it really is, a very good scripting language with a lot (most) of OOP principles.
But the definition of object orientation does not say "and the language must only allow OO".
Actually, that goes hand and hand with being object oriented. If it's not object oriented, then how is it object oriented (it makes even less sense than the question itself)? I understand what you meant, and actually agree with the idea that PHP should not be limited to OOP; not now anyway. Not only would it break practically every PHP page, but it would require the same adjustment that most ASP to ASP.NET programmers are feeling right now. Although it's an annoyance, I do think the learning process is well worth it because of the feature base with ASP.NET compared to [Classic] ASP.
Procedural coding and other methods related to PHP are extremely nice features that shouldn't be removed. I alway love just putting <? blahblah ?> where ever I felt like doing it as long as it made some sense. The lack of restrictions is one of PHP's great points.
It's definitely accurate to say OO does not mean good code; just look at a lot of Java.
I think you need to replace "True OO languages" with "Fully OO languages". Taking your example, PHP dares to assume the developer doesn't care about primitive data types. What do you normally type: - "Int s = new Int;" or "int s;"?.
I think you're assuming we've never used PHP. I actually started coding with PHP as far as web scripts go and have ever since (I continue to even with ASP.NET because there are areas where I don't need ASP.NET). PHP was easy to pick up because I had been doing C++ the whole time before it, which is also the reason C# is easy to pick up.
Anyway, back to the quote, I'm actually not so sure if having the base data types (int, float, double, etc) have to be inheritable to be OOPL. After all, look at C++, you can't inherit char. Looking at this point also brings up another though, in PHP (which was made with C++) and C++ you don't have to inherit char and the others because their features basically come with the whole package. What good does inheriting an int do? Nothing. The example he gave could have good results with inheriting strings, but they're not really part of the language in C++ (I'm not referring to char * or char []). I believe that the reason these requirements are needed for C# to be OO is because they add things to those data types, such as "ToString()" and other features that would otherwise simply be classes with a string inside filled with functions doing the same exact things...
So here I agree with both of you. tuttle is right in the sense that C# needs those to be a OOPL because of the way those data types work, but PHP doesn't need it to be OOPL for its generic data types.
Strong vs. loose typing?
No comment.
As to the list:
His list represented 1st party features that came with ASP.NET. Your list represents 3rd party tools that could (obviously) be built with ASP.NET if they weren't included with it. Comparing your list to his, I prefer his. As you pointed out, the current standard library for ASP.NET helps immensely with integration. 3rd party libraries (by this I'm referring to those that are not included with a standard download to install PHP/ASP.NET) will always makes things a bit harder to integrate, than those that come with everything.
As to the library creation, I'm sure there will be, but why wait for them to be made? In either language you can probably make them yourselves, but in ASP.NET most of what you'd need is already there. Install and get to work, rather than install, dl, dl, dl, dl, dl, and more dl.
As far as the vendors changing things, this is also the exact same problem ANY language has. Programmers just have to go with the flow and try to make things backwards and forwards compatible.
The .NET Framework does not tie you to a specific application design. That's the beauty of it. You can design an application in any language that supports the Framework (which is a growing list) and then you're done. With PHP or any other single language, your tied to it's methods of doing things, which isn't always a bad thing. What if the PHP creators get it wrong? It's the exact same result/idea, but they don't have a couple hundred million dollars backing it.
And is object orientation the final solution to programming?
No. Object oriented designs with Databases are an example of this. If you recall, the whole reason we started this was because we said PHP was not truely OO, which is not to say it's a bad language. I have no problem with Procedural programming, but OO has it's advantages over it in some areas, just as Procedural code as it's advantages.
Picky
0
pickyh3d
10/18/2002 5:13:39 PM
Attention all ASP.NET developers, stop working in .NET and start using PHP! I'm convinced the successor to sliced bread is here! Let's all join and sing the praises of PHP. Don't have specifics? That's ok. No specifics needed in evangelical propaganda!

Come on. That's not what I'm saying at all. First I started posted here for the "phpfanboy BS" remark - to have some fun. Secondly I think I'm being pretty specific, without posting code. Most of what I've said is defence of PHP, i.e. the opposition to "Attention all PHP developers, stop working in PHP and start using ASP.NET!".
>I think you need to replace "True OO languages" with "Fully OO
>languages".
I'm tiring of the semantical game here. Call it what you want. PHP as a language doesn't compare with "Fully OO languages". I rest my case.

My point was PHP is able to be a true OO language. Java and .NET are fully OO languages. In PHP you have a choice. PHP is trying to walk a road which lies between procedural and OO coding. It remains to be seen whether this will result in something good or bad (I'd say wait to see what happens in the year following Zend 2). Like the SAX vs DOM argument, PHP is in search of a third way and perhaps it will deliver.
Events
Again it's another you can do yourself in PHP. Microsoft has taken that burden away from developers. That's not to say PHP can't do it.
I'd like to thank pickyh3d for a reasoned response - agree with most of what you're saying.
PHP does not support polymorphism 100%.
It does. There's a general (although a little old - some of the things discussed have been improved) article here: http://www.phpbuilder.com/columns/luis20000420.php3?print_mode=1. Here's a simple example;

<?php
/* A possible user interface library */
// Base class
class UserInterface {
// Displays a form - force it to be implemented in children
function displayForm() {
trigger_error('Method not implemented');
exit();
}
}
// Child class
class XHTML extends UserInterface {
// Method of same name overwrites parent method
function displayForm() {
echo ( 'A XHTML form' );
}
}
// Child class
class WML extends UserInterface {
// Method of same name overwrites parent method
function displayForm() {
echo ( 'A WML form' );
}
}
// Child class
class Flash extends UserInterface {
// Method of same name overwrites parent method
function displayForm() {
echo ( 'A Flash form' );
}
}
?>

A simple way to use this library might be;

<?php
// Include the library
include_once('UserInterface.class.php');
// Build an array which effectively acts like a SWITCH statment.
$mimeTypes= array ('XHTML'=>new XHTML, 'WML'=>new WML, 'Flash'=>new Flash);
// Instantiate object depending on a GET variable "mime"
$userInterface=$mimeTypes[$_GET['mime']];
// Call the polymorphic method
$userInterface->displayForm();
?>

PHP doesn't really support multiple inheritance - this is not possible ;

Child extends Parent1, Parent 2 {
}

This can only be done with workarounds right now but is coming to Zend 2. But hey - Java (a fully OO language as we all agree) doesn't support multiple inheritance either (need workarounds). And some would argue multiple inheritance is a bad thing (such as Java's designers).
1st Party vs. 3rd Party
That's a very good point you make. One open source language which has got this right, IMO, in Perl - CPAN is trully impressive and is a 3rd party collection which amounts to a 1st party "product".
PHP's equivalent to CPAN is PEAR, and the response to PEAR amongst many PHP developers is mixed. PEAR certainly doesn't match up with a library like Java's but given that may change (e.g. Zend 2 allows for a libary to be implemented via a namespace...). Lack of unified library may be PHP's biggest weakness. But it may be it's biggest strength as well, for the time being, while
The main reason I'd personally avoid .NET, for the forseeable future, is I know MS will use it purely as a means to get me to buy their (expensive) products and lock me in. I write my ASP.NET application and if I want to go productive with it, I have to buy a Windows Server with some incarnation of IIS.
And sorry but no matter how big the company, relying on them to deliver everything always results in heartache. IBM have learnt their lesson already and discovered you're better off selling consultancy and experience, not products.
I won't harp on about past records but taking one example - I trust the Apache Group to get their web server right - a small organisation focused on a specific goal. Not so Microsoft with IIS, who have a million and one other interests which may take precedence over my needs (let's face it - MS only took security seriously after 9/11!). And that magic word "Free" is very inticing...
0
HarryF
10/20/2002 1:29:15 PM
About the PHP polymorphism

I'm not sure that's really polymorphism. How do you call the base classes member that was over written (i.e., the function that would be labeled "virtual" in C++)? Generally it's unnecessary, but it's still part of being polymorphic (otherwise it's just morphism/morphic :))
PHP doesn't really support multiple inheritance
Multiple inheritance isn't a requirement (although I wish more languages supported this!).
I write my ASP.NET application and if I want to go productive with it, I have to buy a Windows Server with some incarnation of IIS.
You can use Apache 2. (Check my link in the above post or two)
And sorry but no matter how big the company, relying on them to deliver everything always results in heartache.
I totally agree, you should never get stuck depending on a company (or community) for results. Look at 3Dfx (the formers graphics chip makers--gone under/bought by nVidia). They got cocky about their lead and starting not caring about power management/size. Obviously this idea is a little different since that was hardware and this is software, but the concept is there.
The thing is, you're saying that by using ASP.NET, you MUST use IIS/MS SQL/any other MS product you could think of. That's not the case, Apache 2 supports ASP.NET and even if you use IIS, you can still use MySQL/any other open source or otherwise free product. (a more descriptive link of how one of Apache's co-founder is doing it: http://64.84.21.122/docs/Apache2supportsASP.NET.pdf).
I won't harp on about past records but taking one example - I trust the Apache Group to get their web server right - a small organisation focused on a specific goal. Not so Microsoft with IIS, who have a million and one other interests which may take precedence over my needs (let's face it - MS only took security seriously after 9/11!).
That makes sense to trust the organization with no other visions (just Apache--even though that sounds bad, that's not a shot). However, if you think about it, MS is that way (and many other companies made like MS). MS is really just a parent company with tons of little companies doing their specific tasks. MS has it's gaming department, which then splits into every company they own: Bungie, Ensemble Studio's, etc... which all develop their own games. The only difference between say, Bungie, and Apache (other than product focus) is Microsoft does the marketing for Bungie with it's own PR people.
Now if you think about it that way, you have the department over IIS and then the group making IIS. Their only focus is the continued development of IIS. They're not stopping to think about Microsoft Word's development, no, they're focused on IIS.
Sure, maybe some of the employees might move around between the sub-companies/groups, but those people just take on the focus of the product at hand. I doubt they have a group of programmers making 2 or more products at the same time.
So yes, it's fair to say Microsoft doesn't always care about your IIS needs, but it's not fair to say the IIS group doesn't care about your IIS needs. The IIS group (which I'm sure has a name...) focuses on it and you, which is exactly what Apache does.
As far as the security needs go ... I'm not so sure it was 9/11 that got them back into thinking about it, but I will simply note that they know there's problems and do fix them, some more slowly than others. There are just as many security fixes out there from the IIS team as there are from the Apache group (even if one or the other groups them together more). It's also worth noting that recently more Linux server machines have been getting hacked this year. That's the biggest downside to Open Source (which I see overall as a good thing), the bad people in the world get to see its weaknesses as well.
Picky
0
pickyh3d
10/20/2002 8:03:36 PM

>Come on. That's not what I'm saying at all. First I started
>posted here for the "phpfanboy BS" remark - to have some fun.
>Secondly I think I'm being pretty specific, without posting
>code. Most of what I've said is defence of PHP, i.e. the
>opposition to "Attention all PHP developers, stop working in
>PHP and start using ASP.NET!".
Well, my remarks weren't intended to be personal, so I want to make sure you know that I'm commenting on your argument's integrity only. I like to have fun without ad hominem.
But I did want to make serious point as well--that is your postings as a whole. You take an evangelical approach to this subject (which is completely ok). I am very evangelical about certain issues as well. But you also make a lot of generalized blanket claims, then support them with links that often only partially bolster your claims. The problem is when we get into some of the specifics of OO and the ASP.NET framework tools, you cursorily dismiss and deny some very valid points. I realize that you may not know everything about ASP.NET--I don't know everything about PHP! But to get you to concede some points, pickyh3d and I had to hammer some things into the ground, i.e., your PHP polymorphism example. Your base class does need to support virtual (sometimes called dynamic) methods by the way.
For your arguments to hold credibility, you have to concede the points you can't defend instead of just denying them and issuing more blank statements and bashing MS.
>namespace...). Lack of unified library may be PHP's biggest
>weakness. But it may be it's biggest strength as well, for the
>time being
Statements like the one above is exactly why I made the sliced bread reference. You insist on having the argument both ways. Either it is, or it isn't a strength. Otherwise it isn't worth mentioning the entire topic if your 2nd sentence contradicts your first sentence. When you contradict yourself in the same paragraph, your argument lacks logic and credibility. When an argument lacks logic and credibility, it regresses to the domain of propaganda.

On conceding points...
Earlier in this thread, we were arguing the position that PHP only lacks a class library, otherwise it is equal to ASP.NET or better. That is an indefensible position. Since then, your argument has regressed into "you can write it yourself if you need it". Well, that can be true for about anything. Hell, why don't we all just write our own web servers, our own class libraries, and our own web development frameworks? I could write my own event model, server controls, etc. in ASP 3.0, but what would be the point to that headache when the vendor has already done it for me?
The point is, which platform gives you the best tools or building blocks out of the box? And to include another topic into this argument, which platform offers these building blocks in a very tightly organized, object oriented framework? (i.e. integrated security, full event model, server controls, databinding, custom user controls, object and output caching, code-behind pages, validation controls). The .NET framework, because of its shear size, would have been nearly impossible to make without inheritance, abstraction, polymorphism, and encapsulation.
The System.Web.UI.WebControls namespace is a good example (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconwebcontrolshierarchy.asp). All server controls are derived from the base class web control. And if you want to customize anything, you just create your own derived class from any of the control classes. And there is no mistaking which members should not be publicly accessed--since .NET has true encapsulation through various levels of member protection. This is all done seamlessly in full OO. And guess what, the same framework is available to client-server software (windows forms) in .NET. A framework of this size and organization, written in C or any other procedural language, would be painful to create, maintain, and extend.
I guess my overall point in this is the way the thread has played out. It is frustrating to debate, when points are generalized and summarily dismissed without proper evidence. After a while it just regresses to "my platform can do that too" arguments. In many forums, that kind of argument may slide by. But in a message board where many users have seen first hand (because they are currently working in ASP.NET) the power of such a framework, that kind of rhetorical argument falls flat.
0
ttuttle
10/21/2002 1:57:50 PM
Response to wysiwyg on 09-19-2002 09:43 PM

Howdy,
I think I can help you on this one.
While I am not exactly sure why this is slower, I can tell you why your results don't match that of web efficiency tests. Web efficiency tests are designed around common scenarios of web usage. This usually means many people looking up records and changing some of them.
What you have here is a web page that is performing a database function. There is not quite enough information to see exactly why you are doing this, but it appears that the join should take place in the database itself. This could be done either through Stored Procedure or View in SQL or with a stored Query in Access. Other databases have similar structures.
If the two datasources are completely different (one table in Access and one in Excel for instance) you can still do this without iteration in .Net. Both tables can be loaded into a dataset object and then a join declared. In this case .Net will import both into XML in memory and then perform the join.
My bet is that if you are using SQL and do the join there and then display the joined structure, you will get well under a second with either ASP or .NET.
..Net can be extremely efficient at bringing in data and displaying it. You will not find any studies of using .Net to manipulate tables one record at a time as was common with ASP.
0
twoshu
10/22/2002 5:53:44 PM
Just sticking with PHP and OO;

About the PHP polymorphism
I'm not sure that's really polymorphism. How do you call the base classes member that was over written (i.e., the function that would be labeled "virtual" in C++)? Generally it's unnecessary, but it's still part of being polymorphic (otherwise it's just morphism/morphic :))

I was demonstrating the kind of workaround you need in PHP (right now) if you want protect a method - the abstract class UserInterface shouldn't be directly accessed. You can't protect class methods and variables right now (but coming in Zend 2 with multiple inheritance).
Another example, here's some Java, based on an example of Java's polymorphism, from Bruce Eccels "Thinking in Java";

// Shape.java
class Shape {
void draw() {}
void erase() {}
}
class Circle extends Shape {
void draw() {
System.out.println("Circle.draw()");
}
void erase() {
System.out.println("Circle.erase()");
}
}
class Square extends Shape {
void draw() {
System.out.println("Square.draw()");
}
void erase() {
System.out.println("Square.erase()");
}
}
class Triangle extends Shape {
void draw() {
System.out.println("Triangle.draw()");
}
void erase() {
System.out.println("Triangle.erase()");
}
}
// Shapes.java
public class Shapes {
public static Shape getShape(int i) {
switch(i) {
case 0: return new Circle();
case 1: return new Square();
case 2: return new Triangle();
default: return null;
}
}
public static void main(String[] args) {
Shape s[] = new Shape[3];
// Fill up the array with shapes:
for(int i = 0; i < 3; i++)
s[i] = getShape(i);
// Make polymorphic method calls:
for(int i = 0; i < 3; i++)
s[i].draw();
}
}

Here's the same code in PHP, demonstrating polymorphism;

<?php
class Shape {
function draw() {
}
function erase() {
}
}
class Circle extends Shape {
function draw() {
echo("Circle.draw()");
}
function erase() {
echo("Circle.erase()");
}
}
class Square extends Shape {
function draw() {
echo("Square.draw()");
}
function erase() {
echo("Square.erase()");
}
}
class Triangle extends Shape {
function draw() {
echo("Triangle.draw()");
}
function erase() {
echo("Triangle.erase()");
}
}

// Procedural code here - could be a class
// though but PHP doesn't require a main function
// like Java
function getShape($i) {
switch($i) {
case 0: return new Circle();
case 1: return new Square();
case 2: return new Triangle();
default: return null;
}
}
$s = array();
// Fill up the array with shapes:
for($i = 0; $i < 3; $i++)
$s[$i] = getShape($i);
// Make polymorphic method calls:
for($i = 0; $i < 3; $i++)
$s[$i]->draw();
?>

The code almost looks the same, minus the irritating type declarations ;)
Having said PHP has no solid class library, there are some awesome 3rd party libraries and one in particular that is built into a PHP framework / application server. Imagine a framework which came not only with a solid library and application deployment environment, but also a "ready to roll" electronic document system, an ecommerce portral, a forum, a filemanager, a complete user / groups system and loads more... PHP has one: ezPublish. Total cost to use $0. Just another open source project? IBM and Siemens seem to think not... Sorry - getting evangelical again ;)
0
HarryF
10/22/2002 7:34:20 PM
That still doesn't show how you'd call the base classes "draw" function.  Obviously, it does nothing in this case, but there are times it is necessary to call a base function.  Here's how you could do it in C++, how can you do it in PHP?
class Base

{
protected:
int a;
public:
Base(int b = 3) { a = b; }
virtual void Say() { cout << "The value of a from Base is: " << a << endl; }
};
class Derived : public Base
{
public:
Derived(int b = 4) { a = b; }
void Say() { cout << "The value of a from Derived is: " << a << endl; }
};
int main()
{
Base A(4);
Derived B(5);
A.Say();
B.Say();
B.Base::Say();
return 0;
}

Ew, a PHP Framework? Don't want to get stuck to those apparently...
Are you a web bot spitting out advertisements? I don't care if something is open source or not; I care if it works (and works well).
Picky
0
pickyh3d
10/23/2002 4:26:53 PM
Can anyone tell me how to set your code so that the user can not right click to "view source"?
Christopher

Hey, I work in Finance - at least I am trying to learn this stuff - it is hard! I do not know how you do all of this.

0
ctfennell
10/26/2002 12:05:22 AM
Here's an example:


<html>
<head>
<title></title>
</head>
<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
</body>
</html>

This is more effective than a no-right-click JavaScript, in my opinion.
Regards,

Daniel P.
0
Daniel
10/26/2002 10:40:49 PM

Thank you very much, that is pretty cool. Do you recommend a specific source to learn this type of stuff?
Christopher

Hey, I work in Finance - at least I am trying to learn this stuff - it is hard! I do not know how you do all of this.

0
ctfennell
10/26/2002 10:57:23 PM
If you learn JavaScript, you will learn that kind of stuff. I learned a bit by reading several books, viewing source code (therefore I really do not recommend to use this little script :)) and going through several online tutorials.

Search the Google search engine for "JavaScript tutorial" or "JavaScript tutorial" and you should receive some nice results.
Regards,

Daniel P.
0
Daniel
10/27/2002 11:41:12 AM
Search the Google search engine for "JavaScript tutorial" or "JavaScript tutorial" and you should receive some nice results.

Sorry, this was meant to be "JavaScript tutorial" and "JavaScript tutorials", with an S at the end (will return different results).
Regards,

Daniel P.
0
Daniel
10/27/2002 3:27:02 PM
Hi, Just a thought.

Remember that when the ASP.Net page is first run (after a IIS restart or a recompile), the dlls or server script is compiled from intermediate language to the native code of the processor on which it recides.
I believe you will have better results for ASP.Net pages if you go through the whole test scenario first, and then run the comparison without restarting the web application or recompiling the dlls.

Morten

http://www.kiss.no
We care for your customers...
0
KISS
10/29/2002 9:53:14 AM
pickyh3d,

Why don't you e-mail your response to Mr. Gates, may be he will use it in his commercials...oh, wait, may be he is the one who gave you this to post here in the first place?
thanks,

webtekie
0
webtekie
11/20/2002 7:40:21 PM
webtekie,

The only reason I'm approving your otherwise worthless post is to demonstrate that even anti-MS views are accepted on these forums. However, it would be appreciated by all if you could actually find something worthwhile and on-topic to post about in the future.
Thanks,
Steve

Steven A Smith
AspAlliance.com - The #1 ASP.NET Community
DevAdvice.com - Answers to Questions
0
ASPSmith
11/20/2002 8:12:48 PM
Dear ASPSmith,

I see, so my comments are worthless while pickyh3d's are not. Interesting...he transhes everybody else but Microsoft and that's ok, but if someone tells him off in two sentences that's a no-no? Excellent, a pure Microsoft point of view -- shut anyone who has a different point of view. Oh, and if you want to hear something meaningful -- how about the fact that my Red Hat Linux 8.0 running on the same machine as W2K never crashed in the past month and works better, while W2K went down 2 times. And my brother's Applet iMac did even crash once in 2 years he has it? Please respond, I am curious now.
thanks,

webtekie
0
webtekie
11/20/2002 8:34:42 PM
Definitely better than the two line post you made before.  And I didn't see any posts from pickyh3d's that comprised nothing but flaming another individual poster, as yours was, but if I'm in error, just let me know which post ID of his you're referring to.

I'll happily agree that MS windows is *not* the most stable OS out there. I've worked as a consultant and currently work as a trainer, and my first option for fixing problems on MS platforms remains "try restarting". That said, I think that Microsoft's development tools blow away anything available for other technologies, their ASP.NET team is by far more supportive of developers than any other commercial vendor I know of (and probably more than many open source projects), and ASP.NET is leagues ahead of ASP+COM and significantly ahead of Java/J2EE. I honestly haven't used PHP, so I can't comment there.
Thanks for posting something technical that we can discuss, rather than just flaming me or someone else.
Steve

Steven A Smith
AspAlliance.com - The #1 ASP.NET Community
DevAdvice.com - Answers to Questions
0
ASPSmith
11/21/2002 2:42:18 AM
"so my comments are worthless while pickyh3d's are not. Interesting...he transhes everybody else but Microsoft and that's ok, but if someone tells him off in two sentences that's a no-no?"

I did not transh anyone else, although I did try to show that PHP was and is inferior in the points that he tried to dish out. Point out somewhere that I'm wrong (and don't point to somewhere that I say MS is a good company or something similar).
"shut anyone who has a different point of view."
I think the fact that you have posted two factless posts shows the opposite.
"Oh, and if you want to hear something meaningful -- how about the fact that my Red Hat Linux 8.0 running on the same machine as W2K never crashed in the past month and works better, while W2K went down 2 times. And my brother's Applet iMac did even crash once in 2 years he has it? Please respond, I am curious now."
Completely off the topic, but oh well. I agree that a Linux server is more stable than a Windows machine, but I don't believe it's more secure. As far as the Mac goes, I don't know or care. One possible reason for a crash could be a misconfiguration, or it could be because of a lousy bug in IIS ...
So anyway, post where I'm wrong about the PHP posts in question.
Picky
0
pickyh3d
11/21/2002 6:32:43 PM
Well,

Web services work are much, much better in .NET than in PHP, its
like from day to night.
But it is not just about performance, I myself do ASP.NET for clients,
rich clients, and I love to use it,...
But in my company for ourselfs and clients that use our own server we use
Apache with PHP and PostGreSQL, sometimes we use JSP...
The reason for not using Microsoft in my company servers?
LESS 80.000 US$/Euros per year in software expenses
As we are a small company I can say that this amount is not much
less than our yearly net profit.
We only have 200 webpages in our own server, 120 them use databases,
and some others need some small aplications done in C... Imagine if I
had to have SQL Server license for each of them, and that the applications done in
Visual Studio with everything payed and legal, we couldnt do good and
fair prices for clients.
ASP.NET calls the use of windows, of IIs, so Windows Servers,
then it calls for better performance with expensive databases,
everything is too expensive around Microsoft, maintenance, licenses, etc.
I think every company that want to pass throught this drop down
of economy, must be serious with expenses, and using Microsoft
products is not serious, Microsoft is for rich companies, so I love
when I have to use .NET in rich companies...
We must remember medium and small companies have 80% of all the employees/jobs
here in Europe, and all of them need to lower expenses.

cheers,
José Vieira

0
jvieira
1/8/2003 11:49:19 PM
Don't sugar coat it...how do you really feel!
0
boblame
1/9/2003 8:37:36 PM
Back again ;)

Just picking up a couple of points;
"ASP.NET is ... significantly ahead of Java/J2EE"
Think you'll have to justify that. RMI/EJB (compared to SOAP web services) is a significantly more mature (albeit J2EE only) mechanism for communication between application tiers. Java also has a range of supporting projects which dwarfs .NET, such as the ground breaking and highly respected struts framework. IDE-wise, if you know Java you might be pleasantly surpised by Eclipse (free!) - a project IBM donated to the open source movement. Eclipse also supports PHP (and loads more) - have a browse: http://eclipse-plugins.2y.net/eclipse/plugins.jsp
"Web services work are much, much better in .NET than in PHP, its
like from day to night. "
Sorry but I have to completely disagree here.
Have a look at the Simple Web Services API - PHP tutorial - I quote;
"Because PHP is a dynamically typed programming language, there is no need to compile the WSDL into PHP code in advance or do any other setup."
If you want to see how easy PHP can make web services you'll have to buy the book - coming very soon.
0
HarryF
1/9/2003 10:59:51 PM

Note to future posters to this thread:
Don't bother asking about ASP.NET here—it’s dead. As you can see from this and other posts in this thread ASP.NET is out-classed in every imaginable category by PHP. Language specifics, web services, security, IDE, performance, it doesn’t matter. PHP is just plain better.
Don’t believe me? Just read the previous posts. There is all kinds of evidence.
I’m planning to cut all my ASP.NET contracts and start looking for PHP work. Monster.com shows there are 178 PHP jobs waiting for me in the U.S. This shows me that the people (employers), who put their money where their mouths are, agree with those who say PHP is the best development platform. I can’t imagine there would be that many .NET / ASP.NET jobs out there (I haven’t done a search and I don’t plan to)--especially since it has only been released for about one year now. .NET is going to die a quick death, mark my words.
PHP is a powerful and mature technology. It’s been around since approximately 1996 (about the same time as ASP). Heck, I bet there are 5 times as many PHP jobs as even regular ASP. I haven’t done a search yet, but PHP has to be dominating a grossly inadequate web technology like ASP 3.0 in the job market. And since ASP.NET is less than a year old, PHP jobs probably outnumber ASP.NET jobs by 10 to 1. After all, it has had 7 years to gain market share. No companies in their right minds, especially during slow economic times, would choose to use these expensive, bloated MS products, would they? They (ASP and ASP.NET) are out-classed in every imaginable way.
I encourage readers of this thread to make the change to PHP. And when you are preparing your resumes for the bounty of available PHP jobs, maybe you could spend some time visiting various web boards (like this one) around the web and help propagate the truth about PHP. It won’t happen by itself. We need to get out there and tell other developers that they really are using inferior technologies like ASP.NET. And if people question your statements, just use more broad, sweeping claims. Don’t forget to use good marketing buzzwords like “ground breaking” and “open source”. And if all else fails, include some random quotes and links to other websites—even if they don’t bolster your argument all that well. Few people actually take the time to do the research, so it will make our arguments even stronger looking.
They don’t know it yet, but they will be grateful to you for enlightening their software perspective.
PHP. Use it. Love it. Live it.
Drink the cool aid and be happy.

0
ttuttle
1/10/2003 7:00:10 PM
RMI/EJB (compared to SOAP web services) is a significantly more mature (albeit J2EE only) mechanism

So, because it's more mature, it's the most efficient and otherwise the best way to go? I certainly don't think so. Windows 95 is way more mature than XP, but XP is faster, more stable, and more feature rich. SOAP is a standardized, highly multi-platform way to communicate with just about anything and it DOES NOT require you to have .NET on your machine (obviously the server would need .NET, but that's obvious).
IDE-wise, if you know Java you might be pleasantly surpised by Eclipse (free!)
You mean the IDE that created its own classes that wrapped Win32 and thus made it not multi-platform? Well I'll be, so when do we get to jump on Java for being for "Windows only" (after all, unless you're running a super computer, you can't run anything Java at a reasonable speed).
Sorry but I have to completely disagree here.
Whew, I was holding my breath; I thought you might complement .NET.
"Because PHP is a dynamically typed programming language, there is no need to compile the WSDL into PHP code in advance or do any other setup."
Have you ever used an ASP.NET Web Service? You don't have to compile them either. Nor do you need a book to make them; they're as simple as PHP's and faster because they're always compiled after the first run. Just prepend whatever function you want to be a web service with "[Web Method]" and you're done.

Picky
0
pickyh3d
1/10/2003 7:08:25 PM
(raises his hand)

I develop in ASP.NET. I develop in PHP. I like both of them. You can develop web applications with them. If one of them goes away, you can learn the other one very quickly.
They're both really fast.
If you code them wrong, they will slow down.
If you code them right, they will speed up.
If your web page calls a sloppy 10-table outer join, don't expect either language to save you.
If you parse 15 XML cunningly over-engineered config files for each request, don't expect either platform to lift a finger in your defense.
If you try to run PHP code on ASP.NET, it will crash. If you try to run ASP.NET code on PHP, it will crash.
Try mixing Coke and Pepsi (just make sure I'm not in the neighborhood).
Right now I'm working with ASP.NET, and I love it! But I don't forget my excitement when I was learning PHP. Or Java, for that matter. With Java I loved the OO thing. With PHP I love the Slap-Together-A-Database-App-With-Two-Function-Calls simplicity. With C# I love the meta-OO aspect--custom attributes are so useful. But then... guess what? PHP has meta-OO aspects simply because you're working with crazy loosely typed late bound objects that can stand on their head if you tell them to. So the circle spirals inward....
Really, I think it pays to keep an open mind here. These languages are not so different. (Yes, they are majorly different architecturally, but from the principals of how you approach them...). I just get this sense from people that they are vaguely threatened by the "other side".
This is an ancient debate. Yes, the C programmer's code is executing faster, but the VB6 guy's pointer-less app was developed in half the time and isn't leaking memory like an incontinent's bladder. Yes, the Java guy built a beautiful class library to tackle the web app, but the PHP guy realized all you need to do is call a few functions and the job is done in half the time. Or vice versa.

Chris
Christopher Bissell
0
Lemmsjid
1/13/2003 11:07:18 AM
I work for a web developement company and I routinely code sites in both PHP and Classic ASP and my company is (Finally) moving into ASP.NET.

I have to say this. From my experience, on a Standard PHP page with 1 dataquery from a mySQL database, it can load much faster than a classic asp or asp.net page doing 1 query against MS SQL and displaying the data. Sorry microsoft, but thats my experience.
That said, one a page that requires, updates, calculations, or multple queries, I find that even classic ASP with MS SQL tends to kick php's but. mySQL is very quick with select statements but not so good with updates, its tablelocking is very inhibitive on large traffic sites, and its lack of reasonable support for stored procedures (unless you want to write a query filter in c to go through your results on the server) tends to slow it down. Its able to write to the HTML stream faster than either ASP but its performs its calcuations and logic slower than ASP.NET (but still quicker in my experience than classic ASP.)
Given a choice, I prefer ASP.NET over PHP for a programming platform, though I think that obviously if you are gong for the low buck and you don't want to run a system that has quite so high a hardware requirement, PHP is still a very good platform to program in (not saying I enjoy it. I presonally hate PHP but I have to admit that its not bad for what it does. Its just very limited in what it does.)
0
goblyn27
1/13/2003 9:56:57 PM
To be honest, I've never found an instance where Classic ASP beat PHP (when they're doing the same things).  ASP.NET, on the other hand, beats PHP even when it's doing more than the PHP.
Picky
0
pickyh3d
1/16/2003 1:56:33 AM
quote by interscape  "PHP is still a script language, and ASP.NET is an object-oriented, compiled language. You can't make PHP work in a windows app, but you can take ASP.NET code and drop it into a WinForms program without a whole lot of modification. If you want to talk all time performance, then maybe PHP is better, but I'll take OOP for the web over step-thru scripting any day of the week. "


php-GTK is used for creating programs with php, and php supports OOP and has done for ages
0
lifeisadesign
1/22/2003 10:03:04 AM
The .NET code is still then native code in the Windows app.  Admittedly, and obviously, it was stupid for them to say you can't make one at all in PHP, but the fact of the matter is that PHP is still a script, which I think was their unstated point.

I also don't know why they gave up the "all time performance" for PHP ... as I've never seen this being true and would have been the main point that I would have brought up.
Was their quote right? In some regards. Was it stupid? Definitely.
Picky
0
pickyh3d
1/22/2003 6:12:09 PM
You'll find a lot of conflicting personal stories here.  The main reason is that the language often isn't the bottleneck when it comes to development.  The largest factor in the performance and scalability of a solution is the capabilities that the developer(s) has with the tools involved.  Obviously there are some PHP slingers out there that know PHP better than ASP.NET so their experience has been that PHP is faster.  If they continue to research ASP.NET and learn it's tricks and nuances then they'll likely close that gap if not reverse their results completely.  I can admit quite readily that I understand little about PHP so that if I wrote a solution with it the performance would probably be very lackluster.
0
Halo_Four
2/19/2003 10:51:33 AM
Too start I should probably say that some of the information in the previous posts is wrong.  For instance saying that C# and VB.NET are the same in terms of performance.  This isn't so.  Just because they are both compiled into IL and use the same libraries, which are written in C#, doesn't mean their performance is the same.  I read in a Wrox Press book on ASP.NET that C# is faster.  If you think about it though you shouldn't even have to read that anywhere to know that there are differences.  If you compile the same set of code with two compilers you will get some differences in terms of performance.  Why, because different compilers compile code differently.  If you compile C++ code using two different compilers on the same Linux box you will notice differences.  In my opinion this argument is something that could go on and on and on but with today's technology this really doesn't matter!  The performance differences are minimal and if you really run into performance issues you can buy a faster server with more RAM and more CPUs or cluster your application across multiple servers.

When it comes down to choosing a development platform you have to think of what problems the IT industry faces as a whole. The issue that should be in the forefront of your mind is maintenance. The next is delivering on time and under budget. Another issue is actually delivering the product your customers want. The only performance problem that I have run into with recent projects is scalability. Like is said you can just distribute the load across multiple servers however I have yet to run into a scalability issue that I couldn't address in code. For instance I've talked to a lot of people how have had scalability issues with their .Net software. This problem is almost ALWAYS caused by doing a postback for EVERY LITTLE THING. Of course you're going to have scalability issues when you have a large number of concurrent users!!! There, as of my knowledge, no development platform that allows you to ignore the basic issues we as software developers must address in our projects. The solution to this problem is to go by yourself a book on JavaScript and handle as much as you can on the server. If you have to change data in the fields on your form when a selection is made in a dropdown DON'T GO BACK TO THE SERVER UNLESS THE DATA NEEDS TO BE PROCESSED!! Another solution for this if you're client is always IE is to make web service calls from within JavaScript. When an ASP.NET page is loaded it goes through a lot of work to put the state out of the page and update all of the controls, etc. and this is done on each postback. If you invoke a web service you don't have to go through all of that, just the marshaling and unmarshaling of request parameters.
Ok, I didn't want to get into all of that. The bottom line is that too address the issues of maintenance cost, on-time/under-budget delivery and delivering the right product, what is going to get you there the fastest. Well, number for me is to use a platform that provides me all of the advantages of OOP when developing web pages, so we've narrowed it down to JSP and .NET. From this point my question is what is the deployment platform. Don't know, then go Java, Windows then go .NET. Microsoft technologies will always be faster to develop because, besides Microsoft's huge budget, they are tailored to the Windows platform. Yes, I'm talking about the tools such as the IDE. With Java you have to remember that you're using a technology that is designed to run on multiple platforms so the tools have to do this too. I don't use Windows for my everyday use so if I'm doing Java the development then I don't want to be on a Windows box. What do I use? Netbeans. Is it as good as Visual Studio.NET? Nope. Then why do I use it? Because it's my favorite Java IDE out there and it allows members of my team to develop on multiple platforms and right here we get some valuable cross platform testing done. Why use Java? Because you might need your application deployed onto a Unix box.
So when it comes to performance if you're using an industry proven technology like PHP, ASP.NET or JSP/J2EE and you're having performance issues you need to look into what you're doing wrong, don't look for problems in the technology because they are there but part of your job as a developer is to get around them. As far as having an OOP language to work with I do think is beneficial, to me on large projects. I have implemented a site or too with PHP because it was small, simple, wasn't going to grow so it was faster to develop using a scripting language and easier to maintain. The reason for this is that you can throw your scripting code into your PHP files and if there isn't a lot of it you can keep it manageable and you don't have to worry about your solution file, your project file, your object hierarchies, your APIs, etc. On larger projects though these issues because your best friend.
As far as benchmarks posted on the Internet take those with a grain of salt. For instance the multiple benchmarks done comparing the J2EE and .NET platforms. The .NET platform comes out faster but if you caught that article detailing the differences in implementation you’d know that the Microsoft team implemented caching mechanisms that the J2EE team seemed to have missed. If you also consider the myth that 95% of users are running windows you’d also be wrong. If you look at those statistics you would see that it’s really saying 90-some% of users that own x86 computers are running Windows and then you might look at some of the statistics for Macintosh computers that state that around 20% of home users are on Macs. You might also say that MS puts out IE for the Mac but if you’ve ever run IE on a Mac you’d know that it doesn’t support a lot of things the IE for Windows version does. So do you’re homework, research your technologies and you’ll find your answers. You aren’t going to find any answers looking at performance benchmarks because a few lines of code can make all the difference between what they were benchmarking and what you’re actually writing!
So to sum it up, try out a couple of different development platforms giving yourself enough time to see what the ins and outs of them are. Then when you get a new project you'll be able to better decide what platform will give you the most of what you need. Remember, performance isn't everything, especially now. If performance was the most important thing then we'd all still be using command line based operating systems and writing assembly code. I mean think about how fast DOS would run on a P4 3GHz!!!! I'm not going to switch though, I like my pretty GUI, and it helps me get my job done better.
0
michaeljbergin
2/24/2003 5:27:33 PM
hello 

i have read all these articles about php and asp and what is better, and for me its alittle bit sad to see how people work against each other.
i still work with both (PHP & ASP.NET) and there is no reason for me to figger out
witch tool is the better.
one sthing about the performance.
who the hell cares about 3 or 5 seconds more or less to wait?
(possibly not me ;-)
a serious aspect is that PHP is open source, and you can, if you are thought enough,
edit the sourcecode and makes it the way you need. (like i try sometimes..)
one word about cahcing.
there is the zend-accelerator from www.zend.com witch is not for free.
otherwise there is the zend-optimizer, whitch is free and uses the cachetechnology for written php-code. (available for WIN32, UNIX ...)
an other aspect is, that you can include php on (most) every web-server on most plattforms. so this is a limitiation when you work with asp.
the feel of the comfortability wit the ASP.NET Framework is a thing you wont find in any other language. so for me the first time i was writing ASP.NET Code, it was a bit amazing, that i dont have to wirte my selft the loops for databaserecords, formularelements and so on.
so my wish...use every language to write good tools, and dont be afraid to use those of the oter side, because we all still have a lot to learn about , and teh real , from microsoft or unix, still did it this way, otherwise they where still here with us and messing sround about whitchone is the better footballteam ;-)
greets paper
0
paper
3/3/2003 8:20:33 AM
oops
0
honestjrabbit
3/14/2003 9:05:10 PM
nothing beats writing in Assembly ! ;-)
You tried your best and you failed miserably. The lesson is 'never try'.


Homer Simpson !
0
harmohanb
3/17/2003 12:12:59 AM
my good god almight, let me in this!

I have used ASP.NET, J2EE, Classic ASP, PHP (and herion once - kidding!)
I have to put my 2 cents in.
When I owned my own company, at the start everything was classic ASP that we developed both for in-house and external.
Because Microsoft smokes more meat than pepridge farms, we began using PHP with Apache and Linux.
At the time PHP was myrids(?) ahead of MS and it was catchin on like the herpes from my neighbor (oops did i say that)!
I was mind bogled by the elegancy of the PHP language and it was my first experience with OO. Unfortunately I hired a beginner PHP'er and he was not able to teach - so I had to go to the books!
Anyway, Let me cut to the chase, here it is 2003 and I have to tell you - I use .NET 95% cause its nice to program in whatever the hell language you feel like and make it all work. If you work at a company, how many client pc's are Linux? -- how about Sun (lol) -- Mac? Windows for Workgroups!!!, probably Windows 2000/XP huh?
How many people would like to quit developing (or re-developing) for Netscape?
Fact:
PHP = .NET = J2EE -- they can ALL accomplish the same tasks. Each has thier strong points and thier weaknesses as many of you have pointed out. I would be more impressed with one company standardizing the browser so that no matter which one you program with, it all looks and works the same to the end user - thats whats really important isnt it? Of course you have to be able to do it efficiently, costly and with performance in mind (didnt someone mentioned compiled - huh, there's a plus)
So what am I saying? Hell if I know, i've been up ALL NIGHT working on a .NET e-commerce site (guess I could've slept if I used Java!) so there...
Forget the languages, **** about the browsers!!!
Please reply :-)
-aiKeith
* Never trust a circle *
0
aiKeith
5/23/2003 12:09:02 PM
I'll just mention that I think it says something when a developer of Netscape drops support for it.

You cannot beat the speed of compiled code, not even when simply cached [or "simply cached in an advanced manner"].
Picky
0
pickyh3d
5/23/2003 9:02:58 PM
I think PHP is better and faster than ASP but I'm not that sure about ASP.net, both ASP and .net are much more complex than PHP, I guess overall ASP.net might be the best option and PHP the second best. And someone said ASP in an OOP, I don't see how, it looks alot like JavaScript.
0
black_death
6/27/2003 1:31:40 AM
Javascript is oop - but that doesnt matter since you can use a variety of languages for the .net system.  Wouldnt be surprised if they added php.net

:-)

* Never trust a circle *
0
aiKeith
7/2/2003 2:30:28 PM
black_death,

congratulations for thinking.
I wrote a project management system in PHP. The system was optimised for speed. I had complex project report pages being generated in around 150ms (These were makling maybe 7 calls to the DB, formatting results etc)
Addmitedly, the way I developed the application it wasn't designed to take full advantage of PHP speed. I used classes instead of procedural code. PHP OO support is second rate at best. The only OO implementation that beats it for horror VBScript 5.0+.
The PHP project had a set of Data Access classes.. It made developing the system a little cleaner, but it also made it a little slower. Object creation in PHP and then passing objects around is a performance hit. Not to mention all the kludge code to ensure your objects are being passed by reference.
Anyway.. I built the same system in ASP.NET. It took a little longer than the PHP version (OMG You have to compile!). The PHP Version was developed in Context (Text editor) using mysql command line. ASP.NET Version was developed in VS.NET.
My conclusions:
The IDE for ASP.NET is far more productive than anything PHP has.
PHP _IS_ slower than ASP.NET. I come to this conclusion because;
The ASP.NET Project management System, with the exact same functionality, was generated pages in about 15 - 30ms (Thats 5 times faster). That was without page caching turned on. I never tested it with page caching.
For many pieces of code, I wrote 3 or 4 versions in each language, and profiled execution speed of each (PHP profiling leaves a little to be desired)... Some of the time PHP was as fast as the CLR (For loops etc), however, PHP came crashing to its knees when you started throwing classes/objects into the mix.

The thought of going back to PHP while it still passes objects by reference, or even ASP, scares me and gives me a chill.
PHP development may be more interesting when objects finally get passed by ref without explicitly being told to do so (v5.0)... Also, there ain't no true way tp create static object references in PHP, ie: A Singleton. Each page request would cause the singleton to be recreated in PHP. Not so in asp.net..
anyways, thats just my two cents.
0
Malby
7/14/2003 1:08:25 AM
Time these separately (4 tests):
// [ C# ]

for ( int i = 0; i < 10000000; ++i );
for ( int i = 0; i < 10000000; i++ );
// [ PHP ]
for ( $i = 0; $i < 10000000; ++$i );
for ( $i = 0; $i < 10000000; $i++ );

Picky
0
pickyh3d
7/14/2003 1:17:56 AM
Wow. I never actually bothered to test large loops like that.

For anyone who can't be bothered doing this for themselves...
I did tests in C#/ASP.NET. C# Tests were conducted within the Page_Load event of the asp.net pages...
First test I did was to create as many objects as possible in 1 second (or roundabouts).
Heres PHP Code:
include("./StopWatch.php");
$sw = new StopWatch();
$sw->Reset();
for ($i = 0; $i < 10000000; ++$i)
{
$object = new TestClass();
}
echo $sw->ElapsedMilliseconds() . '<br />';
output:
54409.922 ms

Heres C# Code:
StopWatch sw = new StopWatch();
sw.Reset();
for( int i = 0; i < 10000000; ++i)
{
TestClass cls = new TestClass();
}
Response.Write(sw.ElapsedMilliseconds() + "<br />");
output:

1011.454 ms

Just incase you can't read it... The C# version took 1 second to create 10 million objects. The PHP version took almost a minute to create the same number of objects.

But I said that already... However, I said PHP could match ASP.NET in loops... How wrong was I;
PHP Version:
include("./StopWatch.php");
$sw = new StopWatch();
$sw->Reset();
for ($i = 0; $i < 10000000; ++$i);
echo $sw->ElapsedMilliseconds() . '<br />';
$sw->Reset();
for ($i = 0; $i < 10000000; $i++);
echo $sw->ElapsedMilliseconds() . '<br />';
output:
7501.411 ms
8056.802 ms
C# Code:
StopWatch sw = new StopWatch();
sw.Reset();
for( int i = 0; i < 10000000; ++i);
Response.Write(sw.ElapsedMilliseconds() + "<br />");
sw.Reset();
for( int i = 0; i < 10000000; i++);
Response.Write(sw.ElapsedMilliseconds() + "<br />");
output:
70.1008 ms
80.1152 ms
what is that, 2 orders of magnitude faster? 2 orders of magnitude is not "Keeping up with .NET" as I put it in the last post.

Finally, a decrementing while loop (Faster than a for loop!)

PHP Code:
$sw = new StopWatch();
$sw->Reset();
$i = 10000000;
while ($i--);
echo $sw->ElapsedMilliseconds() . '<br />';
output:
3671.856 ms

and the C# code;
StopWatch sw = new StopWatch();
sw.Reset();
int i = 10000000;
while ((i-- > 0));
Response.Write(sw.ElapsedMilliseconds() + "<br />");
output:
40.0576 ms


anyways, I was going to bother with database benchmarks too, because of all those people who say "Yeah?! Well MySQL is faster than SQL Server".
I could do some benchmarks there as well, but I am 100% positive I will see the same results.
Those of you who don't believe the numbers, I'll be happy to email you the code I used to do the benchmarking with. You can even try and optimize the PHP code.
0
Malby
7/14/2003 2:01:37 PM
Too start I should probably say that some of the information in the previous posts is wrong. For instance saying that C# and VB.NET are the same in terms of performance. This isn't so. Just because they are both compiled into IL and use the same libraries, which are written in C#, doesn't mean their performance is the same. I read in a Wrox Press book on ASP.NET that C# is faster.

Performance differences between C# and VB.NET are minimal, except in a handful of cases. C# doesn't do bounds-checking by default, which means that if you do some operations in a tight loop, C# will give better numbers in benchmarks (especially naive do-nothing loop style benchmarks), but the VB.NET code is safer. VB.NET functions create an aditional temporary to support VB6-style return values (FunctionName = ReturnValue). Sometimes bit shifting is helpful (though if you're using VB.NET 1.1, it's got bit shifting operators). And there are cases where "usafe" code can help performance a lot.
In real sites, the latencies of database access are going to overwhelm language differences on the same platform pretty quickly.
0
drothgery
7/28/2003 9:11:42 PM
You can shave even more off of the difference if you specify Option Strict for all of your VB code. 

As to performance tests based on iterative operation in a tight loop, prime number generation, etc. I have never considered these to be all that valid except as another data point if included in a much larger suite of tests.
For example, create a realistic page of some sort--maybe a page to display the contents of a particular row of a table in a database on a form, or a table of 50 rows from the database. Now set up a load tester to get 100 concurrent users hitting this page, and see what the average response time is under this condition. While you're running this test, also track cpu utilization on the server.
Now take some relatively common benchmark app--maybe the now infamous Oracle Pet Shop and see how long it takes an experienced asp.net developer to create such an app from the specification compared to an experienced PHP developer. The benchmark the resulting apps.

Jim


MS MVP ASP.NET [VC++/MFC emeritus]


Old Dog Learns New Tricks

Preferred programming language: cuneiform on clay tablets
0
JimRoss
7/28/2003 9:38:32 PM
I'll have the results for you on the weekend.
0
Malby
7/29/2003 12:09:47 AM
I'm an asp.net fan, and ive seen little bits of php

i would like to know how long it takes to develop in php with all those silly little $ signs and ->
asp.net has the auto complete (which is very good) which i like
KitkatRobins.
0
kitkatrobins
8/13/2003 3:41:28 PM
Just form what you've written there are a couple things wrong with your tests, firstly asp.net is much better with objects than PHP (and so it should be given it is OO based) so why use a timer class for PHP? (or wait until PHP5 is finished and then compare with objects) Secondly did you test PHP on a apache / linux or on windows / iis / apache?

As for mysql, from every test I have ever seen for simplish selects it is quickr than anything including MsSql, shame other than that mysql is pretty poor.
0
bagpuss
8/17/2003 10:05:40 PM
could you post the php StopWatch class please ? microsecond/millisecond 's are giving me the vapours !
0
firepages
8/18/2003 4:26:58 AM
I assume (I just wrote this... so it isn't probably exactly like his):
class StopWatch

{
var $time;
function StopWatch()
{
Reset();
}
function Reset()
{
$this->time = getmicrotime();
}
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function EllapsedMicroseconds()
{
return getmicrotime() - $this->time;
}
function EllapsedMilliseconds()
{
return (getmicrotime() - $this->time) / 1000;
}
function EllapsedSeconds()
{
return (getmicrotime() - $this->time) / 1000000;
}
};
The comments of the page I got getmicrotime from were a little frisky: http://www.php.net/manual/en/function.microtime.php
Picky
0
pickyh3d
8/18/2003 5:27:14 AM
Hi 

i am the editor in chief of asp.net professional a german ASP.net magazine. We have done several tests for our magazine and have also written a long article.
PHP never wins. ASP.NET was always much better ( x-times). We have useed diffrent common scenarios eg Database access and have not used any optimization.
You can order the german magazine on www.aspnet-professional.de. Take the "performance" Magazin

-Hannes

http://www.preishuber.net http://weblogs.asp.net/hpreishuber
0
preishuber
8/18/2003 6:31:39 AM
What's going on here?

What difference does it make? I have written several LARGE SCALE enterprise apps in PHP and ASP.NEt (and Hannes, I have even visited 2 of your MSDN techtalks - very good) but I have never ever needed to instantiate 1,000,000 objects at a time. So why bother benchmarking? And who cares if MS SQL is slower then MySQL? Why don't we benchmark $Dollars vs. Computing Time and see who wins, you know that any MS solution would loose out to GPL. (But I don't advocate it, it would be an equally pointless exercise).
Of course as a kid I also had Top Trumps cards, and thought it was really cool to have the fastest car. But as an adult I realise that they cost too much. And you can't do the monthly food shopping in one. And the kids don't fit in. If I want to drive around Scotland in the winter, I'd choose a Land Rover. If I want to drive from Hamburg to Zürich, well I'd prefer a Porsche. Doesn't mean that Land Rover's are rubbish, does it? So speed IS NOT THE ISSUE. I assume you realize this, and are looking for some lame reasons to throw stones at PHP?
For the German readers out there, there is a very good set of articles in i'X (9/2003) about ASP.NET vs. PHP 5, which is somewhat less biased than those produced by ppedv. And PHP does not come off lightly, ASP.NET sort of comes out a nose ahead.
PHP is great, but it has weaknesses. ASP.NET is great too, but also has weaknesses (and if you don't believe me then you probably don't understand what deterministic finalization means). Benchmarking the 2 is a waste of effort unless you are actually responsible for the performance of the languages' / compilers / interpreters and need to know how you're doing.
So my advice: please grow up and do a meaningful comparison between ASP.NET and PHP 5. As a hint, you could start with security issues.
- Richard
0
spf_asterix
8/22/2003 1:10:27 AM
You can't compare PHP 5 as it's in early beta (it wouldn't be fair to PHP 5).  Maybe when they near the final beta of PHP 5 ... but definitely not now.
Picky
0
pickyh3d
8/22/2003 1:47:02 AM
I really like some of their hardware, but I agree with you in that they lie in their advertisements. I really dislike it when companies do that. And Apple is the KING of it.
0
russnem
8/23/2003 7:45:59 PM


What's going on here?
What difference does it make? I have written several LARGE SCALE enterprise apps in PHP and ASP.NEt (and Hannes, I have even visited 2 of your MSDN techtalks - very good) but I have never ever needed to instantiate 1,000,000 objects at a time. So why bother benchmarking? And who cares if MS SQL is slower then MySQL? Why don't we benchmark $Dollars vs. Computing Time and see who wins, you know that any MS solution would loose out to GPL. (But I don't advocate it, it would be an equally pointless exercise).
Of course as a kid I also had Top Trumps cards, and thought it was really cool to have the fastest car. But as an adult I realise that they cost too much. And you can't do the monthly food shopping in one. And the kids don't fit in. If I want to drive around Scotland in the winter, I'd choose a Land Rover. If I want to drive from Hamburg to Zürich, well I'd prefer a Porsche. Doesn't mean that Land Rover's are rubbish, does it? So speed IS NOT THE ISSUE. I assume you realize this, and are looking for some lame reasons to throw stones at PHP?
For the German readers out there, there is a very good set of articles in i'X (9/2003) about ASP.NET vs. PHP 5, which is somewhat less biased than those produced by ppedv. And PHP does not come off lightly, ASP.NET sort of comes out a nose ahead.
PHP is great, but it has weaknesses. ASP.NET is great too, but also has weaknesses (and if you don't believe me then you probably don't understand what deterministic finalization means). Benchmarking the 2 is a waste of effort unless you are actually responsible for the performance of the languages' / compilers / interpreters and need to know how you're doing.
So my advice: please grow up and do a meaningful comparison between ASP.NET and PHP 5. As a hint, you could start with security issues.
- Richard

What difference does it make? Plain and simple answer is resources == money, if it takes less resources to run asp.net than it does to run php then asp is more efficient and less costly. In the real business world doing something that may cost your customers more with no other benifit will cost you customers.
When you write applications not expecting too much of a load which lets face it 99% of applications are like that, you dont' need to worry BUT when you deal 5000 concurrent users then php vs asp.net is a huge topic.
And i'm not trying to sound all cocky but your advice is not at all well thought out... "please grow up and do a meaningful comparison between ASP.NET and PHP 5. As a hint, you could start with security issues." Security is a minor issue, security is mostly based on the environment and php runs in both windows and linux and so does ASP.NET actually (see dotgnu and mono), php and asp.net itself has little to do with it. And futher more along that topic, because linux servers are more common at this point than windows servers the linux servers are breached more often and attacked much more even if windows MIGHT have more vulnerabilities simply because the bigger target is what is aimed for.
-Nate

0
pr0c
9/25/2003 10:34:24 AM
Quite a lengthy conversation...

Security does matter if you consider how flexible the language/environment is in regards to security and how much easier the language/environment makes dealing with security.
0
Stephen
9/26/2003 1:54:09 PM
Open Source is open source,  it has it's own advantage such as Multiplatform Support. better performance, (via tightly integrated with OS, comparing with Java)


Today both ASP.Net and PHP make their progress very quickly. fix their bugs quickly. and They learn from each other quickly...
I still remember 8 years ago (1995- 1996), I could not choose pure Miscrosoft product as an Enerprise Solution.(Unix dominated).
Today Microsoft is a real Giant... (From High level backend Server solution to very Front End productivity suite)
But that does not mean there is no Giant except Microsoft, or tomorrow, Microsoft is still a Software Giant.
It is still a long way for Mcrosoft to port .NET to Linux and Unix, and how good the performance is will still be a question. (think about Java)
Let's enjoy Both PHP and .NET if you are a developer.
If you are a decision-maker, think about your budget, your existing enviroment, your IT team's skill set, then choose the solution wisely.
If you are a real Microsft FAN, help Microsoft to find more bugs, help Microsoft to improve it's products, make Microsoft better tomorrow. but do not spoil Microsoft...

0
honestlistener
10/1/2003 9:36:10 PM
Let us face reality.  PHP and Perl are the future pascals programming languages.  THEY ARE DEAD for this future decade.  You wont find a single noble software company using them to create Intranet or Internet Software.  The only type of programmer that would use a scripting language like PHP or Perl are your shopping cart programmers.  The wanna be's in an evolutionized world.  I can't think of any PHP or Perl programmers that understands MVC or integrates UML in their OOP development.  Why,  because they are scriptors and dont fit in with higher development arenas.  Your heavy weight software engineers will laugh when they here a PHP or Perl programmer talk up their expertise.  Why,  most of them are uneducated when it comes to real design.  The PHP Perl programmers are Ma and Pop store programmers.  The future of software development is with the Internet and that future doesn't leave room for the historical PHP or Perl Programmer.  If you doubt me, then try and find a stable job with PHP or Perl in a web development atmosphere.  If you do,  that will be the company that is forced to re-organize its strategies and that re-organization may be to dismiss the PHP or Perl programmer and adapt to either Java or .NET.  The question shouldn't be PHP vs.  ASP.NET because that isn't were the fight for the title belt exists.  It's with Java and .NET and so far .NET is definetly taking its territory.    

If there are any PHP programmers out there I would highly suggest converting to .NET or Java. Do it now because it will be even harder to transition in the future and companies just wont see as creditable in the future. Even with five years experience with PHP or Perl.
0
brycegwillis
10/6/2003 6:35:36 AM
This was an amusing thread to say the least. I notice it is old now but I just have to comment on a few things and I'm sure it is still read by many. I also better state up front that I am biased in favour of PHP in this discussion. That said I still think one should use the tool best suited to the problem.

"I can't think of any PHP or Perl programmers that understands MVC or.."
Well this is just plain stupid thing to say when ASP.NET advocates talk about their events, data grids and what not. As I have come to understand more and more on this topic it sounds like an incredibly stupid thing. I thought most serious developers separated their presentation layer from the logic. Obviously not in your world. ASP.NET promotes something that over time makes it almost impossible to see any application layers. Web sites cannot be built like small personal Access databases with both client and server code mixed up in forms. Microsoft biased people fail to understand that architecture is bad bad bad...
As a consultant I mostly work with CORBA development in C++ apart from PHP. Lots of object orientation and encapsulating data as well as large systems behind classes and objects. This works fantastic if you do it right. Web services are also good technologies to use in some areas. But in yet other areas speed is essential and then we use pure socket communication so we can minimize the overhead which both CORBA and SOAP actually has.
With this I want to make two points. We use object orientation where appropriate, large complex systems with complex logic in old systems that needs to be hidden. Sometimes web sites present information from these kinds of systems but I have yet to see why object orientation is the best technology for everything - especially for web sites and web pages. Just because you can spell to bloat doesn't mean you need bloat in everything you do. If you create crappy procedural code you will probably create crappy object oriented code. Object orientation has it's place but is extremely overrated - it won't save you from being a lousy developer. Underlying applications that feeds a website with data might very well benefit from being object oriented sometimes - but not always.
When needed we use more low level technologies to increase performance. You say that ASP.NET is faster because it is compiled. I haven't made any benchmarks myself nor read any credible reports. But I can say that many functions/methods in ASP.NET do a lot more behind the scenes than functions in PHP. This makes it easier to make a PHP application do exactly what you want it to and thus make it run faster. The argument that very few actually use the "compilers" that exist for PHP is also stupid. When companies are serious about it and need the extra speed, they cough up the money. At least they have a choice to spend the money or not. If they need it they can use it - if they don't need it (which many don't) they don't need to pay for it.
As I said above - I am biased towards the unix way of doing things. Still I can acknowledge the fact that many good things have come out from Redmond. CSS and SOAP are two technologies that have Microsoft written all over it and I would not want to be withouth those. ASP.NET sounds interesting but the more I read about it the more it smells rotten.
Regards
dotvoid
http://www.dotvoid.com (No this site is not professional - it is a hobby)
0
dotvoid
10/10/2003 3:31:10 PM
---------------

"I thought most serious developers separated their presentation layer from the logic. Obviously not in your world. ASP.NET promotes something that over time makes it almost impossible to see any application layers. "
---------------
Yes, serious developers do separate their presentation from logic. Be sure you are looking at decent code examples for ASP.NET. You sound like you aren't that familiar with ASP.NET, so be careful of some of the hacked-out ASP.NET examples out there. The best code examples for ASP.NET use code-behind files. IMO, the best platforms for _truly_ separating code and presentation are ASP.NET and Java Struts. The reason I say "truly separated" is that many systems employed in PHP and ASP 3.0 strive for separation, but they only achieve it in one way. They remove logic from the HTML, but they can only achieve this by moving some of the HTML to their code. If you have PHP or ASP 3.0 template classes that output things like "<table>" and "<input name="myTextBox" type="text">", to the browser, then you still aren't achieving true separation. In my ASP.NET code, I have an HTML tag (server control) in my .aspx page for every single item that displays on the page. Any designer can come in and change display properties for those controls (re-arrange the order, whatever). But in my .cs page (code-behind page), I have all the logic for that page, and there is no HTML elements embedded in it. I can do all the logic programming and never touch the presentation. The designer can do all the presentation without touching my logic code.
Take a check box for example. If your logic dictates that the checkbox should be checked on the first page load, how do you do this in PHP and ASP 3.0? You have to output to the browser "<input name="checkbox" type="checkbox" value="1" checked>" at some point. Whether this is done in the HTML page with code, or the HTML is moved to the PHP code, at some point, those systems have to insert "checked" in this string and send it out. In ASP.NET, you simply reference the name of your checkbox in your code-behind file and set the checked property to true (checkbox.Checked = true;). And if your designer decides this checkbox should be rearranged on the form, she can do it in the .aspx page without touching code-behind code.
---------------
"Sometimes web sites present information from these kinds of systems but I have yet to see why object orientation is the best technology for everything - especially for web sites and web pages. "
---------------
Well, let me help with this. OO may not be the best technology for every example in every possibility, but it is darn close. Web programming has needed OO for so long. Why do you think PHP is working in that direction?
But there is an important distinction here. It's not about just having OO available in your code to create business objects and encapsulate other common methods/functions. MS has revolutionized how web development will occur in the future, I believe.
Everything in ASP.NET is part of an overall object model (.NET framework). Everything basically is an object, even a web page. Why would a web page need to be an object you ask? Well, it allows programmers to access all areas of the framework with a consistent and powerful API. Think about the possibilities. My websites are powered by template engine that uses inheritance (wow, there's OO) to be sure all pages have the same appearance and basic functionality. When I need to validate user input on a form, I can call "Page.Isvalid" and my page object checks all the validation controls on the page in one fail swoop. Why, because the page has a property (Controls) that contains the collection of validation controls for the entire page. Wow, another OO advantage.
Another example? How about extending existing server controls? Since all server controls are objects, you can add your own custom functionality to a list box by inheriting from the base class and adding your own code. You can distribute your listbox, and someone else can further extend it for their own use. This is easily done precisely because OO makes all aspects of ASP.NET accessible and consistently extendable.
This is where most PHP developers (and ASP 3.0 developers) fail to fully understand ASP.NET. Maybe because it makes web development so different from what we are used to. It is easy to understand using OO to encapsulate business logic. But as I said, ASP.NET revolutionizes how web development is performed. That can make it hard to understand by just looking at sample code available on the net. I agree, you can write bad OO code if you don't know what you are doing. I believe the majority of ASP.NET developers really don’t know how to fully leverage the .NET platform, and thus we get some terrible code. And that is one disadvantage of ASP.NET. It is so big and offers so much, it can be very hard to grasp and fully understand.
Some other aspects of ASP.NET that most PHP developers miss or don't understand at first glance:
Viewstate (Automatically maintains the values in your controls even after post backs. No more hidden form fields!)
Events! (Wow, you mean events happen on the web too? Of course they do! Finally, a web dev environment that provides a powerful event model.)
User Controls (you can make whole page components re-usable in other pages, and it uses OO to do it. Imagine that, OO allowing you to do even more.)
I guess I find it interesting that the people who down play OO the most are usually from the PHP camp (a close second is Perl). But at the same time PHP is moving in the OO direction all the time. PHP will get there some day (fully OO in all areas of the platform) and maybe then we will hear the benefits of OO in web dev. If PHP doesn’t continue in that direction, then the previous poster will be correct in his assessment that PHP will soon become irrelevant.

0
ttuttle
10/10/2003 5:46:31 PM
True enough, I don't have much experience in ASP.NET. 

---------------
"The reason I say "truly separated" is that many systems employed in PHP and ASP 3.0 strive for separation, but they only achieve it in one way. They remove logic from the HTML, but they can only achieve this by moving some of the HTML to their code."
---------------
Many strive for separation but fail to accomplish this. The tools at hand can aid you in separating logic and presentation or give you more freedom. The latter giving the developer more to think about. I don't see ASP.NET to be much better in this sense. On the contrary. From what I understand you can bind for example text boxes directly to data in the data source (database). This can be good (seldom) and bad (mostly).
Using a template solution the right way gives you the ability to build WML, XHTML and PDF presentation on the same logic. This is very simple. The applications I work on even make it easy to switch between a PHP template solution or XSLT. Even more separation... PHP does not limit you in this.
---------------
"Whether this is done in the HTML page with code, or the HTML is moved to the PHP code, at some point, those systems have to insert "checked" in this string and send it out."
---------------
No, "those systems" do not need to do that. There are many ways of doing this. In the case of form driven applications, which you seem to discuss mostly, I don't make that part of either application logic or the templates. It is part of the view logic. As we live in modern times I use javascript for this. Javascript is invented mostly for manipulating the user interface. This sounds much like your code behind file. This concept has been used for many many years in frameworks and languages, for example Smalltalk. It is not new - it is basic stuff and can easily be applied in your web programming languages of choice.
---------------
"I can call "Page.Isvalid" and my page object checks all the validation controls on the page in one fail swoop."
---------------
Irrelevant - I can call a method "isValid()" when receiving the input in "one fail swoop". I even lost the dot and the extra prefix... (And yes, I could have this simple naming scheme in a web application having many, many forms and still use procudural code.)
---------------
"I believe the majority of ASP.NET developers really don’t know how to fully leverage the .NET platform, and thus we get some terrible code."
---------------
The same goes for almost any programming language or developer tool. So, is it ok to criticize PHP using badly implemented open source projects as examples? Many in this thread have done do and fail to remember that this goes for any language.
---------------
Viewstate, events, user controls...
---------------
Apart from events this is not something new. Admittedly in PHP you might have to code a tad bit more than in an environment that supports this out-of-the-box. Both concepts are part of many PHP frameworks. Resusable components (yes, gui components as well) are the basics of any environment that you want to keep clean. Events on the other hand I fail to see what they are good for. You already have the http POST/GET - those two are what you usually work with. This goes for ASP.NET as well. In the gui on the other hand you already have the javascript event model to work with. That many web programmers fail to understand how to use it is as bad as many ASP.NET programmers fail to fully leverage the .NET platform.
---------------
"I guess I find it interesting that the people who down play OO the most are usually from the PHP camp"
---------------
My experience is the opposite actually. You can hardly find any serious projects nowadays in PHP that do not use OO. As I said before I use OO technology alot. I still don't think it is much needed in PHP yet. But it is popular - why do you think that a large voluntary project as PHP so quickly is moving in that direction? PHP 5 is almost here.
There are things in PHP that are not good. The lack of inconcistency for example. And I haven't seen any large projects in ASP.NET yet, so I cannot say how good or bad it is. The reason for me to write my comments are all the wrong (and sometimes stupid) comments about PHP here.
And please - ASP.NET is not a revolution. It is just another way of doing things, just another framework in which you add your code. Good or bad I leave that up to you.
Danne Lundqvist
http://www.dotvoid.com
0
dotvoid
10/13/2003 7:25:35 AM
----------------------

This is where most PHP developers (and ASP 3.0 developers) fail to fully understand ASP.NET.
----------------------
Think it was a mistake by Microsoft not to provide solid support for a dynamically typed language in .NET from the start. ASP 3.0, Perl and PHP have set the expection that web development projects can be completed quickly and cheaply. Although the user contols model of ASP.NET does alot to reduce development times, this is balanced against developing with statically typed languages like C#. Moving from ASP 3.0 to ASP.NET could have been alot smoother.
My understanding is that ActiveState's attempts to bring Perl and Python to .NET have been hampered by serious performance issues, the CLR basically not being designed to cope with dynamic typing, so some additional (high cost) type translation layer is required. I read somewhere this is a priority area for improving the CLR in the near future for Microsoft - would be interested to hear if anyone knows any more about it.
-------------
Viewstates and Events
-------------
The Event model is certainly interesting and provides perhaps a more developer friendly mechanism for web development than that offered by Struts.
That said, where Viewstates are concerned, think they're being used to encourage something which is a "Bad Idea" - taking the paged data grid, for example: http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrlref/webctrl/datagrid/VB/datagrid10.aspx
How do users send someone a link to, say, page 10 of the results?
--------------------------------------------
I guess I find it interesting that the people who down play OO the most are usually from the PHP camp (a close second is Perl).
--------------------------------------------
For any enviroment that _doesn't_ have a component model to build web pages with, in MVC terms there's little point in implementing the View in a OO fashion - you're far better off using procedural code of some form so that the the UI design can be easily modified.
To some extent that also applies to the Controller - if it's a relatively small application, unless there's a particularily compelling argument to use a framework like Struts, you're probably better of with simple procedures and switching logic, if you want the project to be completed on time. The Model and below - that's a different story and many Perl and PHP projects "out there" seem to take advantage of OO principles in this area. So think there are good reasons for developers from those backgrounds to question the idea the OO is everything.
That said, the UI component model of ASP.NET is an excellent idea and makes it worthwhile to use OO in the View. Guess time will tell if scripters using tools like Perl's HTML::Mason wake up to the fact that there are better approaches.
---------------------
1,000,000 objects...
---------------------
Was reading up there some comparison off the time take for ASP.NET / PHP to create this many objects. As someone already said, this is a pointless comparison.
The execution models of PHP and ASP.NET are completely different. PHP re-creates it's environment on every page request, while .aspx components remain memory resident.
A PHP good developer will focus on loading as little data as possible; only that needed to respond to the current request. Although that sounds bad if you come from a background in developing desktop applications, it's one of the things that allows PHP to scale well with load - other than the Sessions (cookie API) it's stateless and nothing is held in memory between requests. Load balancing is typically only a matter to re-distributing user Session data information in some form.
Interestingly , seems PHP5 has SQLite built in, which is a fast, mini database, written in C and capable of being memory resident - will be interesting to see if "disconnected" datasets start turning up in PHP.
0
activey
10/14/2003 1:39:25 PM

***********
From what I understand you can bind for example text boxes directly to data in the data source (database). This can be good (seldom) and bad (mostly).
***********
You can do this ASP.NET, but it isn’t recommended, nor is it common. I, as MS, recommend using Application Data Blocks for database access.

***********
Irrelevant - I can call a method "isValid()" when receiving the input in "one fail swoop". I even lost the dot and the extra prefix... (And yes, I could have this simple naming scheme in a web application having many, many forms and still use procudural code.)
***********
But my page object is already written for me. It’s the page object included in the framework. Yours must be written by you or a 3rd party, correct?
I used the same thing with procedural code in ASP 3.0. But relying on naming schemes to do validation is not a good practice. For one reason, most developers don’t check (or can’t) for sneaky users changing the input names in their form post. They can easily disable any automated form validation. There are ways to prevent this in your code, but it takes even more time to develop.
I’ll take the system that uses object types (validation controls) to enforce validation. It’s not dependant on a text box name that is sent to the browser (and thus can be changed).

***********
No, "those systems" do not need to do that. There are many ways of doing this. In the case of form driven applications, which you seem to discuss mostly, I don't make that part of either application logic or the templates. It is part of the view logic. As we live in modern times I use Javascript for this. Javascript is invented mostly for manipulating the user interface. This sounds much like your code behind file. This concept has been used for many many years in frameworks and languages, for example Smalltalk. It is not new - it is basic stuff and can easily be applied in your web programming languages of choice.
***********
I think I didn’t explain this thoroughly. Take this scenario for an example:
You have a checkbox on the form. When the page loads, the box is checked, unchecked, or hidden from view, depending on the user type and several conditions that are only accessible through the database. So, there is application logic that must determine the state of the checkbox. You are going to query the database, check a session variable, and then pass that on to JavaScript running in the browser? My head hurts thinking about it. In ASP.NET, I can perform all my app logic, and control whether the checkbox is checked, unchecked, or not displayed, all through my C# code in the code-behind file and any C# business objects in my middle tier. I don’t have to touch an input checkbox tag, nor do I have to write one line of JavaScript. It is controlled by two properties of the checkbox control (.visible and .checked). To accomplish this, your framework must have programmatic control of all aspects of a web page. PHP doesn’t have this (without mixing code and html). Or at least, no one can show me an example of it.
This is where the conversation usually breaks down. I have yet to have someone show me where PHP accomplishes true code and presentation separation. I don’t like doing this, but since you included a link to your website and Firesite app, I’ll use this as an example. First, I should say, your site looks good. You are a good developer from the files I peaked into. The app is well conceived and your code is very clean.
But your app illustrates the limitations of any scripting platform (PHP and ASP 3.0). Throughout your files, you have HTML and PHP code mixed. I’m sure you’ve heard the term “spaghetti code”? Your index.php is a good example. There are PHP scriplets (if that’s what they are called in PHP) throughout the file. And from lines 72 to 101, you have HTML embedded inside your PHP code. I know how it works and I’m not trying to criticize your code. I programmed ASP 3.0 for several years and that’s how much of my code appears. But that is the difference between these scripting technologies and a true programming framework.
I believe some of the most important reasons we strive for code/logic and presentation separation are code maintenance and collaboration. First, it is easier for any single developer to read and maintain code when it is contained in one place (not strewn throughout HTML). It is also easier to maintain HTML when it isn’t embedded inside a programming language. Secondly, true separation allows a multi-person team to collaborate much easier. Many developers (often in larger companies, but not always) must make the application accessible to professional web designers, who know nothing about PHP, ASP, or C# code. I can’t image any of the web designers I work with now trying to modify html inside some long concatenated string variable in my C# code. I guess they could tell me how to make the changes myself, but that defeats the purpose of separation doesn’t it; to let the designers work with presentation and programmers to work in programming?
As I stated before, ASP.NET allows you to put only presentation (tags) in the .aspx file and only programming code (C#) in the .cs code-behind file. In my apps, my C# code is contained in a wholly separate file than my presentation. A designer can modify the presentation file without having to step around my programming and vise versa.
I know that you make the distinction between application logic and view logic. But it appears in your app, you must still put your view logic in same file as the view (presentation). If a web designer needs to change the appearance of your table in lines 72 – 101 in index.php, she must step through PHP code.

***********
---------------
Viewstate, events, user controls...
---------------
Apart from events this is not something new. Admittedly in PHP you might have to code a tad bit more than in an environment that supports this out-of-the-box. Both concepts are part of many PHP frameworks. Reusable components (yes, gui components as well) are the basics of any environment that you want to keep clean. Events on the other hand I fail to see what they are good for. You already have the http POST/GET - those two are what you usually work with. This goes for ASP.NET as well. In the gui on the other hand you already have the Javascript event model to work with. That many web programmers fail to understand how to use it is as bad as many ASP.NET programmers fail to fully leverage the .NET platform.
***********
Well, more coding = more time = more money. I’m sure there are 3rd party products you can use for all these, but that’s where I get back to the OO architecture that ties ASP.NET together. I believe ASP.NET has more consistency (or at least the ability to be more consistent). First, there are more things done for the developer out of the box. Secondly, when you do need to use a 3rd party's tool, it will always have the same OO interface that all code must have in ASP.NET. There is very little learning curve when integrating 3rd party objects. Take a look at the PHP 5 docs for the new member access modifiers (one of the many things sorely needed in PHP 4).
Actually, you might take a closer look at user controls before you say they are nothing new. They aren’t simply ways to just reuse code. They depend on an event model to begin with, so they aren’t really possible on any platform that doesn’t have an event model.
I guess if POST/GET is all you know, then it must be hard to imagine something better, but there is something, and it is much better. I know it took me a long time to understand the advantage of events when I went from ASP 3.0 to ASP.NET. Basically, they are building blocks that allow you to skip many redundant steps. For example, if you have a form that uses a checkbox or dropdown list, and you need to force the page to post to the server when the user makes a selection, you can set the autopostback property to true. The .NET framework takes care of all the plumbing, you don’t need to write one line of JavaScript. And when the form posts, you can specify the exact method (your event method) to run. No more "if-then-else" statements to determine what to do on every post back. And that is just one example. There are a slew of built-in event that fire on every page load. I'm not going to take the time to explain them here. Events help reduce unnecessary code and greatly assist in making your code more maintainable.

***********
My experience is the opposite actually. You can hardly find any serious projects nowadays in PHP that do not use OO. As I said before I use OO technology alot. I still don't think it is much needed in PHP yet. But it is popular - why do you think that a large voluntary project as PHP so quickly is moving in that direction? PHP 5 is almost here.
***********
I guess I’m not sure where you stand on OO. You say that almost all serious PHP projects use OO, but then you talk about how you don’t think it is much needed? So are the project leads for these serious PHP projects just doing it for appearance sake? I would debate the point that PHP 4 or the soon to be released PHP 5 are fully OO anyway, but that is another discussion that is several pages back in this thread.

***********
And please - ASP.NET is not a revolution. It is just another way of doing things, just another framework in which you add your code. Good or bad I leave that up to you.
***********
I admit, revolution is too strong of a term. But you PHP guys really need to do some research on ASP.NET before making posts like this. It seems the best you have is “all this is possible with PHP and nothing in ASP.NET is new”. Well, some things are possible with PHP, but how much do you want to write yourself? Do you want to work on a car and you will need to build half the tools yourself? Or do you want the toolbox that is already mostly full?
And there are many things that PHP cannot do yet. As much as you folks would like ASP.NET to be a re-run of ASP 3.0, it isn’t. It is so much different than anything else in web development. And frankly, it’s getting ridiculous hearing the same old arguments used by PHP fanatics to critique ASP 3.0, applied to ASP.NET.
Ever notice how these types of PHP / ASP.NET discussions end up with the PHP folks scratching and clawing just to keep their heads above water (by saying their platform does the same thing as ASP.NET--even when the examples show it doesn’t). The ASP.NET folks are usually arguing the advantages ASP.NET has on the rest of the field. One side has enough proven innovation to talk about all types of new capabilities while the other side can only try to insist on “me too” or "wait until version 5".
0
ttuttle
10/14/2003 1:43:46 PM
What?  Implement business or view logic using client side scripting?  I think not... too many users disable javascript due to the increasingly prolific, intrusive javascript-based ads.  And what of the numerous older browsers and less popular browsers?  Now you have to implement all view logic 7 different times?
0
Stephen
10/14/2003 9:07:00 PM
***********

I don’t like doing this, but since you included a link to your website and Firesite app, I’ll use this as an example.
---------------
But your app illustrates the limitations of any scripting platform (PHP and ASP 3.0). Throughout your files, you have HTML and PHP code mixed. I’m sure you’ve heard the term “spaghetti code”? Your index.php is a good example
***********
I'm pretty sure you did like that. However, that particular example is not an example of the scripting language limitations. That is an example of me having too little time on my hands. Shortcuts are often necessary when you have people screaming for an application to be finished on time. (Please don't give me the "with ASP.NET you would have had time to...") The application you examined is not even using templates. And as to index.php being spaghetti code - I can only agree.
***********
I guess I’m not sure where you stand on OO. You say that almost all serious PHP projects use OO, but then you talk about how you don’t think it is much needed?
***********
Many (most?) larger PHP projects use the OO features provided by PHP. That does not t mean I think it is necessary for all of them. I think that in many cases it is unnecessary. I use the OO features of C++ every day but when it is not needed I use plain C. OO is great - I agree with you - but it is not the answer to everything.
***********
Do you want to work on a car and you will need to build half the tools yourself? Or do you want the toolbox that is already mostly full?
***********
Actually, I do like building my tools on my own. That way I get them exactly how I want them. I think that is the biggest difference between us. Sometimes it is good to have a framework that handles tedious tasks and hides what's behind the scenes for you - as ASP.NET do. I prefer to know exactly what is going on. We look at things differently.
You might find comfort in that I am, in a couple of weeks, attending a conference where one of the sessions will talk about the feasability of a PHP .NET compiler. I will also get a chance to investigate the PHP5 OO features more. Maybe I'll learn something.
Anyways, this is my last post on this subject as I cannot argue more without knowing more about ASP.NET.
0
dotvoid
10/17/2003 9:11:17 AM
PHP is to application development as 'paint' is to the auto industry.

It is one scripting language in a sea of application development variables.
These two things are apples and oranges.
Call me cynical, but I have used PHP, classic ASP, and ASP.NET extensively for some years, and anytime someone whips out some pro-PHP dogma like this, I smell a Bill Gates hater.
..NET is a comprehensive framework for application development.
The PHP verus MS camps are divided into the 'get its' and 'don't get its.'
Maybe if you are writing web sites on $5/month shared hosting sites and that's it, it isn't obvious to you.
I think when you are doing a ton of development in house, web, windows, XML, mobile, etc., .NET is a no brainer.



if(youTryToBeSmarter)

{

i.WillTryToBeNicer();

}

0
shamusCHW
10/20/2003 1:55:14 PM
#################

***********
I don’t like doing this, but since you included a link to your website and Firesite app, I’ll use this as an example.
---------------
But your app illustrates the limitations of any scripting platform (PHP and ASP 3.0). Throughout your files, you have HTML and PHP code mixed. I’m sure you’ve heard the term “spaghetti code”? Your index.php is a good example
***********
I'm pretty sure you did like that. However, that particular example is not an example of the scripting language limitations. That is an example of me having too little time on my hands. Shortcuts are often necessary when you have people screaming for an application to be finished on time. (Please don't give me the "with ASP.NET you would have had time to...") The application you examined is not even using templates. And as to index.php being spaghetti code - I can only agree.
#################
Just wanted to follow up on this one point. I can understand people screaming about their application being completed. I have clients that do the same. That's why I choose the dev platform that has a full tool box. I don't have to use as many shortcuts that compromise good system architecture and design. In ASP.NET, you are using what PHP'ers call templates as soon as you open your editor (code is separated from presentation). I don't have time to dicker around with writing my own plumbing. Don't assume you can't do it in ASP.NET. Any ASP.NET developer can revert back to the old, slow paradigm of POST/GET and spaghetti code development if needed. But 98% of the time, it makes sense to use the tools at your disposal.
And I guess that is how I see our different views. Much of what PHP'ers call development is what I call redundant plumbing. While you are writing that, I will be writing business logic for the client. That what ASP.NET is all about.

0
ttuttle
10/21/2003 4:22:04 PM
Bottom Line here now.

Does it REALLY matter if the page was served up in 5 milliseconds or 1500 milliseconds?
The user GOT their page and they can move on. That's point of the development effort anyway, is it not?
0
cmillens
10/23/2003 7:49:09 AM
Um, yes.  5 milliseconds vs 50, now.  5 milliseconds vs 1.5 seconds is a noticeable difference.  This is a well established thing among usability experts.
0
Stephen
10/23/2003 1:32:35 PM
pickyh3d dont be so hateful! ;O)

Im 100% agree with your statement - there is too much double standards when talking about the internet and especially MS.
But on the other side I think its great to live in a world where ppl are sceptical and innovative...this gives the world a wider perspective and the options infinite.
i think we can all agree to that monopoly is a bad thing, generally speaking...
If it aint broken - don't fix it...
0
iNFINITY
12/9/2003 10:05:40 AM
Your two pieces of code are completely different.

The data view is fetching ALL of the customer records then filtering them
the ASP code is querying at the database level for specific records.

Try using a datareader with your .net code [leave out the dataview/datatable] and compare that.
You're comparing apples and oranges.
0
WebpitSoftware
12/19/2003 2:46:22 PM
I thought the article was well written and not "full of BS" or hatred.

If you put your bias aside, PHP has been around for quite a while and has a lot of maturity. However, being a structured language rather than true OO, it allows sloppy programmers to be sloppy programmers while ASP.NET allows good programmers to be better. But C# isnt true OO either [no multiple inheritance].
Another note, say whatever you like but .NET code is still interpreted [by the CLR], its not a true compiled language. "Managed Code" is just another name for runtime interpreter.
Regards,
Mark
0
WebpitSoftware
12/19/2003 3:01:23 PM
Smalltalk doesn't have multiple inheritence, but I would consider it a true object orientated language. How would you define an OO language? You consider C++ the be all and end all of the object orientated paradigm?

PHP suffers from the fact its runtime is created and destroyed with each request. Sure hacks have been around to reduce this effect (ISAPI, mod_php) but its still a problem... When the developers of PHP decide to load the PHP engine into memory, and keep it there as a work process, it will enable such things as cached data, application wide scoped data, speed improvements etc...
0
malby
12/31/2003 2:02:11 AM
..NET code is compiled to machine code.  That just does not happen until it is on the machine it will run on, which enables things to be more optimized.
Picky
0
pickyh3d
1/5/2004 10:53:01 AM
"PHP suffers from the fact its runtime is created and destroyed with each request."

Some might say that's actually an advantage rather than a disadvantage for most web apps. The web is, after all, stateless. By way of example using Java, Lenya is essentially Yet Another CMS. Just starting it eats a 100Mb piece of memory... not the case with a stateless platform like PHP under Apache. With a well thought out design (the principle being "execute on demand") there no problem, while beginners are protected from resource headaches.
Also, FYI, mod_php is not a hack but (according to Netcraft) the most common way to deploy PHP (its what lead to PHP usurping the throne of CGI/Per).
With mod_php the runtime (assuming you mean the PHP engine) is not reloaded on every request - only the data created by a given script must be recreated on each request (for which file caching or stuff like http://www.php.net/sem come in useful - shared memory access etc). I've assumed here that some form of script cache is in effect (e.g. Zend Accelerator or the free PHP Accelerator) - the engine throws away OPCODEs by default, each time a PHP script is requested.
Bottom line is you can write very fast PHP apps without sacrificing functionality or scalability. The approach to design is very different to a compiled platform like .NET but the end result is similar.
0
activey
1/12/2004 5:54:49 PM
I know I'm going to get flamed for bumping this back up, but I wanted to add my comments.

I've had experience in both languages. PHP is fast. It's easy. If I want to slap together a simple "database call and display results page", it's faster to make in PHP (not for long... read my comments on ASP.net 2.0 below).
If you're developing an extensible, easy to understand enterprise application, there's no better substitue that ASP.net.
There are several points I don't like about PHP:
First off, it is NOT fully OO. If they want to maintain compatibility with existing PHP code, then it never will be. You may say "I don't need OO to develop an application!". Wrong. Coding a well-thought out class architecture and design is a much better programming pracice in the end.
It is not, by default, compiled, which will always make execution of code slower. Now, I admit, the path taken by an ASP.net page is much longer and more involved than a PHP page. Whether the obvious advantages of compiling make execution faster than an interpreted PHP page is up to a professional analysis.
Polymorphism is your friend! The rich class library shipped with ASP.net can handle SO many tasks. Image creation (without having to install a separate image creation driver), database call / caching, etc...
Try deploying your PHP app without releasing your source code. True, there are tools for decompiling IL, but it's not always failsafe.
And without further ado, I woud like to introduce you all to the wonderful framework called ASP.net 2.0.
Returning to a comment I posted above, I noted that it may be easier to code a simple db call and display in PHP. Welcome to the new databinding controls in ASP.net 2.0. Want a fully Pagable, Sortable, formatted Grid of database information? How about achieving that in 0 code? And the best part is that you don't have to worry about sloppy programmers, because all the calls are handled by the build in classes (and please don't make a comment about how Microsoft programmers are sloppy. ASP.net team has NOTHING to do with the Windows design team).
When you look at all the extra features ASP.net 2.0 are bringing in, I can't wait to see how many people move over. Imagine downloading a forum software, and with a simple one line change of code (pointing the forum software to the existing database), you would have a shared user base, roles, and profile? Try achieving that in PHP (without planning :D).
I believe ASP.net will increase in popularity. There will always be those die hard PHP programmers out there, but as more and more companies see the benefits of ASP.net 1.1/2.0, jobs for these people will diminish.
NOTE: This post does have bias (duh). I enjoy developing in ASP.net much more than PHP. However, I do bring up good points. Please feel free to correct any of my comments.
0
Vintious
4/29/2004 7:04:12 PM
Scott,

Perhaps you can help me then. I'm developing a site in ASP.NET with SQL Server. Just loading the login screen takes 10 to 15 seconds. This is the load - not even hitting the database.

I have a PHP site on the same server (alentus.com) and it's lightning fast - even the database access.

You can observe the performance problem:

If you could give me a place to email you the link, I'd appreciate some help tracking downt he issues.

I'm wondering if forms authentication could be causing some slowing?

thx

0
emc2dxn
11/11/2005 4:02:03 AM

I know this thread is old but i just had to add something. I am a php developer who currently works with asp.net. And yes, i see the good in asp.net - drag and drop is nice, easier to change html, etc etc..but asp.net does not give a programmer freedom to do what they want - you have to use OOP. WHile i love OOP, i have seen that when a person does not know what they are doing OO can be terrible and yes I agree with the statement made earlier that if you are a ******* coder in scripting you will also suck in OOP. The trick is know where which method works best and use it properly.

 

Secondly, visual studio constantly coughing up little errors - you run the program once and it is fine, then you close it, run it again and encounter some weird error. When I google the error I get a msdn page with ..you guessed it - a microsoft bug, they tell you to download a patch, etc etc. This is exteremely frustrating and time consuming. MS products that companies pay for are worse than Beta open source products. I have never experienced the same code behave differently when it is run in PHP or perl. In other words, MS products are half baked and developers are used as testers.

 

As far as separation logic from code, it is easy to do with templates like Smarty.


Microsoft's guinea pig
0
CosmicGirl
6/13/2006 12:49:59 AM
Well cosmic girl, bugs will surface in most applications. The more complex the application, the more bugs will surface with time. Visual Studio is built to dramatically increase productivity to shorten the time it takes to bring business applications from drawing board to the market. I've been using VS since 2001 and I have had very little problems. When problems have arisen, they have been easily solved thanks to the abundance of info and input found in different forums.
 
If you prefer to use PHP to develop your web applications that's fine. We do have a choice. I decided to focus on Asp/Asp.Net many years ago and I find the inherent possibilities of the .Net Framework to be enormous . My main responsibility is to my customers and to help their businesses get better and more efficient. In that respect Microsoft has proven to give the best value for money and provided me with tools and tecjniques to get the job done.

Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
6/14/2006 12:28:12 AM

Hi Andre,

I havent had the same experience at all. Php engine is a lot less complex, php is not a framework like asp.net, there are no 20 objects on top of one another.

My app was very easy - fetch the data from the database, present it to the user. in php it would have been 3 files, asp.net is simply too complex for this small app. I do see that maybe for large apps it would make sence to use it though.

Also, MS gets paid for support. Imagine this, I have a problem with php (say i need to download some lib), I find it within 1 hour on php.net. I have never encountered any bugs with the engine.

With asp.net on the other hand, should i have a problem, i have to call MS for support, open a ticket, it just drags on and on....sometimes takes few days/weeks to resolve. And I still can not comprehend how the same code can behave differently if you run it twice in a row????

asp.net has a great idea behind it...however the code bloat sometimes is simply not worth it...

 

 

 


Microsoft's guinea pig
0
CosmicGirl
6/14/2006 12:39:24 AM
CosmicGirl:
Php engine is a lot less complex, php is not a framework like asp.net, there are no 20 objects on top of one another.

This is of course correct. Php is pretty much the same as Classic Asp, and still use an interpreter to parse the code. Asp.Net is totally different and all Pages are compiled. With thousands of Classes included in the Framework, there is very little you cannot do.

CosmicGirl:
My app was very easy - fetch the data from the database, present it to the user. in php it would have been 3 files, asp.net is simply too complex for this small app.

Sorry CosmicGirl, but I cannot agree. Presenting Data from a Db including Paging etc can in it's simples form be accomplished with only a few lines of code. I fact, with Asp.Net 2.0 and the GridView Control in it simplest form, you actually get Paging, Sorting, Editing, Updating, Deleting and Inserting data records literally without writing any code if you use VS Studio 2005 (as well as using  Visual Web Developer which is free of charge). See a live example here.

CosmicGirl:
Also, MS gets paid for support. Imagine this, I have a problem with php (say i need to download some lib), I find it within 1 hour on php.net. I have never encountered any bugs with the engine..

I have never paid a dime to MS for support. But I always find answers to problems through the .Net Communities Forums and MSDN. Response is always quick, and plenty of MS people participate and contribute actively in answering questions. Plus, you'll almost certainly find Controls and solutions to use in your own application. Starter Kits with real life relevance which are totally free to adapt and use are issued regulary, look great and can save you plenty of time.

CosmicGirl:
asp.net has a great idea behind it...however the code bloat sometimes is simply not worth it...

Asp.Net is great and has potential beyond our imagination. It's the future of communication if you ask me. Download the free tools today and start experiencing how easy it's become to develop complex applications.


Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
6/14/2006 1:38:08 AM

well of course asp.net gives you a lot of capabilities - it better for the amount of classes are sitting there:) However, i have encountered numerous problems every time the 3rd party control is downloaded - literally, sometimes I have to spend half a day fixing these issues, like dll, or my controls not being recognised even though they are included everywhere, in fact so much time that I could write sorting paging etc in that time for php.

Asp.net is of course very powerful...but if you want to get the job done fast, php is the way to go, especially for small apps. Writing code for sorting and paging takes very little time and in php the same code never behaves differently, which happens all the time with .net. I find php more robust especially because it is cross platform.

Just recently, I wrote an app in .net, with paging and all, it worked fine for 2 months then the paging broke, without me even changing the code. So i googled it, surely enough that turned out to be a bug in VS.net...go figure. I do not know, perhaps when MS starts actually finishing their products, and not use us as testers, maybe then i will say that this is the future, but now, sorry i will stick with php and perl

 

 


Microsoft's guinea pig
0
CosmicGirl
6/14/2006 5:13:50 PM
CosmicGirl:
.....sorry i will stick with php and perl
 
Good luck!

Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
6/14/2006 9:04:51 PM

just another day in asp.net land

trying to display a message in a datagrid in a cell and a asp:label errors out...just posted a message on forums here might take a week to resolve. in php i would have been done within 5 minutes. i am a newby its true..but i have never found anything that painful to learn, even c++


Microsoft's guinea pig
0
CosmicGirl
6/22/2006 11:04:37 PM
First of all, asking Asp.Net related questions in this forum (Migration to ASP.NET) is probably not a good idea. In your case, I would try the Data Presentation Controls forum, and I'm sure you will get a quick answer provided you give us a little more info about the error. Is it possibly "Object not set to an instance of an object"? This is a very common error and easily solved once you know why it occurs and how to deal with it.
Regards

Andre Colbiornsen
---------------------------------
Seventh Day
Råbygatan 1A,
SE-223 61 Lund
Sweden
Mob.: +46-(0)708-97 78 79
Mail: info@seventhday.se
--------------------------------
0
adec
6/22/2006 11:42:23 PM

thanks Andre,

i have posted there about 30 minutes ago. my posting has not even been posted yet - moderators.

the whole issue of me not knowing what's wrong, having to wait hours before the posting gets posted, then days before someone replies to me...then in the end of it all i simply do not understand why displaying a text confirmation has to be so hard...it could easily be done with

<table><tr><td>{$message}</td></tr></table>

pass $message to template, done!

sorrry, i am just way too frustrated here. wish these forums actually helped.

 


Microsoft's guinea pig
0
CosmicGirl
6/22/2006 11:46:12 PM

by the way, why do ALL the errors say:

"Object reference not set to an instance of an object."????

cant they elaborate and explain what actually happens or is it too much to ask?  i find the error messages so cryptic that it almost doesnt matter if it says the above or just "Error".

the stack trace is also not terribly helpful. i will admit that sometimes it is, but in most cases, you just have to sit there and guess whats happened.

and of course, once you know it is easy to deal with. but then i might spend a day to find out why.....


Microsoft's guinea pig
0
CosmicGirl
6/22/2006 11:56:28 PM
Err, I was a PHP developer till two weeks ago. I must say, ASP.NET IS NOT hard to learn if you always had some experience with java, c#, etc... It's really quite simple, but disturbing colossal. I don't think I wanna go back to PHP anymore.

Brazil [<o>]
0
AlaorNeto
6/25/2006 3:23:10 AM
I admin that I'm new to ASP.NET, but I must say "Object reference not set to an instance of an object." is the most common, but the simplest to solve, if you really understand your code.

"Object reference not set to an instance of an object."  means what it said. You must set an instance of object to the object varriable you've declared. For example (VB.NET):

Dim bytBuffer As Byte()
Dim objFileStream As System.IO.FileStream
objFileStream.Read(bytBuffer,0,200)
objFileStream.Close

This would cause the error because objFileStream does not represent anything. But bytBuffer won't cause error because it is a value type variable, not a reference type variable, like objFileStream. Here's the solution

Dim bytBuffer As Byte()
Dim objFileStream As System.IO.FileStream
objFileStream = New System.IO.FileStream("C:\MyFile.txt",FileMode.Open)
objFileStream.Read(bytBuffer,0,200)
objFileStream.Close

Because of the added line, objFileStream now represent a file stream which read the file "C:\MyFile.txt".

ASP.NET engine cannot explain more that those words. The only way to get more information is to enable "debugging" in web.config. Then, when the error occurs, you can see exactly which line causes the error. Check the codes around that line and you'll be able to solve in in a short amount of time.

By the way, I recomend you to read some techincal articles like "Migrating from PHP to ASP.NET which can be found it in the Microsoft Visual Studio 2005 Documentation. However, if you still like script programming, I recommend you to continue using PHP.
0
nr2ae
6/30/2006 2:03:31 PM

^thanks, I knew that ....however, this error does not always mean that. You described the easiest case. Sometimes, it is pretty hard to understand what exactly the compiler is complaining about,

 

I am not migrating to ASP.net from PHP - I just changed jobs


Microsoft's guinea pig
0
CosmicGirl
7/18/2006 6:07:07 PM
CosmicGirl:
by the way, why do ALL the errors say:
"Object reference not set to an instance of an object."????

This reminds me the good old days of learning C, and getting every kind of access violation and wandering pointers. A null pointer actually was a lucky case, and i needed some time to just learn how to debug...

Great times...

:) -LV


Julio P. Di Egidio
Software Analyst Programmer
=BUSINESS AND SCIENTIFIC=
=SOFTWARE DEVELOPMENT=
http://julio.diegidio.name

(Peace X Love] = [++1)
0
LudovicoVan
7/19/2006 1:17:40 AM

adec:

CosmicGirl:
Php engine is a lot less complex, php is not a framework like asp.net, there are no 20 objects on top of one another.

CosmicGirl:
My app was very easy - fetch the data from the database, present it to the user. in php it would have been 3 files, asp.net is simply too complex for this small app.

adec:
Sorry CosmicGirl, but I cannot agree. Presenting Data from a Db including Paging etc can in it's simples form be accomplished with only a few lines of code. I fact, with Asp.Net 2.0 and the GridView Control in it simplest form, you actually get Paging, Sorting, Editing, Updating, Deleting and Inserting data records literally without writing any code if you use VS Studio 2005 (as well as using  Visual Web Developer which is free of charge). See a live example here.


I believe this is exactly what CosmicGirl was saying.  Even though you physically only write a few lines of code, there still is a large amount of behind the scenes work going on.

While you can write a small script in PHP that literally just does pagination, maybe that is all you need.  All that extra code that is taking up memory is not used, because maybe it is a read only site.

Flexibility over usability, verses processor cost.

0
Seann
7/21/2006 9:09:54 PM

pickyh3d:
I'm still considering moving from PHP to ASP.NET as well, and as it stands now I think I will try to make my next page with ASP.NET. I am curious if maybe your two speed variances occur because one is using C# and the other is using VB.NET? Is C# faster than VB.NET, or does it make no difference?

Absolutely no perfomance difference at all, all .NET language are compiled into a machine language and that's what get executed instead of your VB or C# code.

0
Googzie
7/22/2006 5:43:13 PM

I am sorry, but I am very proficient in both PHP and ASP.NET, but I choose C#/ASP.NET.  I will be honest, ASP.NET 1.0 was a pretty steep learning curve compared to 2.0, but if you are a coder and find .NET 2.0 hard, my goodness become a designer or something :)

Seriously though, I find a lot of fellow coders who say "I can accomplish that much easier in PHP compared to .NET" simply do not understand .NET or are not sufficiently proficient in developing in it.  I remember whining "My god why is this so hard compared to ASP??" back when beta 1 came out eons ago (ok 6 years ago) and it really was just my ignorance..  Again, the learning curve was definitely greater with 1.0.

Again, I am proficient in both but *choose* .NET.  I don't develop trivial web-applications, and I am coding roughly 10 hours a day.  If PHP was better, faster, easier or any combination of the three I honestly might be using it.  For right now I will stick with .NET  :)

0
Sharbel_
7/25/2006 11:06:08 PM
Sharbel_:

Again, I am proficient in both but *choose* .NET.  I don't develop trivial web-applications, and I am coding roughly 10 hours a day.  If PHP was better, faster, easier or any combination of the three I honestly might be using it.  For right now I will stick with .NET  :)

I agree with this.  I wrote a rather large sports management database site using PHP/MySQL and it just became a mess to maintain as it grew.  I am in the process of re-writing it in C# and it is much, much nicer.  My code is cleaner, I'm not doing things ad-hoc because the OO is amazing in C#, and it's coming along more quickly so I can do things the way they should be done.

PHP is nice for small sites, but large sites with a lot of objects and pages, it's just a mess.

0
Lou
7/28/2006 5:07:51 PM

With PHP5 OO is very easy and your code is cleaner. Also with MySQLI is finaly fully intregrated with PHP this means its faster lots of faster. And MySQLI gives a object back that you can use with a foreach loop.

This way of programing I couln't (yet) find in ASP.NET :(

Anyone?

I'm a ASP.NET C# programmer and I using C# with more fun than PHP but somethings I mis in ASP.NET

0
stefanw_nl
8/2/2006 1:05:14 PM

2 Lou Blobbs :

lou, if you find that your site is a mess to maintain cause it grewit has nothing to do with php and a lot to do with your bad design. Unless of course, your requirements have changed so much that you simply need to re-write it.

 


Microsoft's guinea pig
0
CosmicGirl
8/3/2006 12:04:34 AM
I did some tests on my own, therefore I'm certain that ASP.NET is a few times faster than PHP. Maybe I will do some DBMS tests in a few days, I will inform about results.
0
saner
8/6/2006 10:06:07 AM

Ok. second post here. I'm an ASP fanatic too and have been developing ASP projects (school. LOL) since first year college. Sometimes, I do weigh things up too. Of course. See php forums and sites so i can analyze things out accordingly... sometimes i'm annoyed by the conversations and nonsense things. Either way, I'm now moving to .Net since it's the mouth of the crowd lately and since most corporations are so conscious about Microsoft Technology, I let my self-in into the .Net stream.  sometimes, i can't figure out solutions on some .Net applications that I want to accomplish... just like my first post.

 Ok, since this is between PHP and ASP.Net arena, i will inject an irony for what Microsoft has said in the .Net MSDN. It's about performance. It's true that .Net offers cool features, controls, class and such but this is really an irony on their expertise:

Use ASP.NET server controls in appropriate circumstances. Review your application code to make sure that your use of ASP.NET server controls is necessary. Even though they are extremely easy to use, server controls are not always the best choice to accomplish a task, since they use server resources. In many cases, a simple rendering or data-binding substitution will do. The following example demonstrates a situation in which using a server control is not the most efficient way to substitute values into the HTML sent to the client. Each method sends the path to an image to be displayed by the requesting browser, but using server controls is not the most expedient approach, since the Page_Load event requires a call to the server for processing. Instead, use render statements or data-binding expressions. If you have a large Web application, consider performing pre-batch compilation. 

 

So, why introduce many fancy class and controls.... if we are to minimize their use?
 

 

0
ShunTrevor1985
11/25/2006 10:49:36 AM
Reply:

Similar Artilces:

[Hot Discussion] VB.NET vs. C#.NET by performance
Which one have the much better performance? Which one is the best?Parco LeeOwner + Webmaster + System Engineer + Professional ProgrammerSoftDweller Lab (a software laboratory)http://www.softdweller.comA professional laboratory for new technology softwares developing by .NET.http://www.nowlover.com Hmmm, the discussion doesn't appear very hot. By the way, the answer is its all personal taste, give or take a few things that aren't important.Thanks, Paul Wilson, ASPInsider, MC**For the best .NET code, examples, and tools, visit:WilsonDotNet.com, WilsonWebPortal.com, ORMapper.net I'...

Migrating from VS.NET 2003 to VS.NET 2008
 We are getting ready to start migrating all our applications from Visual Studio 2003 to Visual Studio 2008. Is anyone aware of any direct conversion issues? Also. a lot of our 1.1 apps use datatables as the datasource can we still do this in 2008? Yes you can.I have done some migration between 1.1 and 2.0 and there were some small issues but in general most of the things worked fine.For example Microsoft has changed the html validator in Visual Studio.also some events works a little different. If you share session cookie between some 1.1 and 2.0 (or) later apps you have to do so...

Migration VS.Net 2003 to VS.Net 2005
I want to migrate to framework 2.0.Questions :1) Can i use Vs.Net 2005 and framework 2.0 with Sql Server 2000 ? or must i migrate too 2005 2) I read in some forums there is some problem to migrate vs.net 2003 solutions/project to 2005, It's right ?3) Is it necessery to modify a lot of c# code (deprecate, ...) ?4) Can i work both Vs.Net2003 framework 1.1 ans Vs.net 2005 framework 2.0 on the same development machine ?Thanks. Patrick Ducret Hi, 1) Yes you can. You can use SQL2000 from .NET 2.0 as you did from .NET 1.x. SQL2005 just has some additional features to offer. 2) It can be if...

Migration issues from VS.Net 2003 to VS.Net 2005
I have a ASP.Net 1.x web application developed using VS 2003. The language used for this application is VB.Net. When I tried to migrate to VS 2005 I am getting the list of errors and warnings as shown below. I have been trying the migration in a new machine which does not have VS 2003.  List of Error:  1. Expression of type 'String' can never be of type 'System.DBNull'.   List of Warnings: 1. The referenced component 'CDONTS' could not be found.   2. Cannot load type library for reference "CDONTS". Library not registered. (Exception from HRESULT: 0x80...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

php vs .net
Hi , I know that .net is so better than php . But I need an article or essay that cntrast them with sientific reasons . I need it because I can not answer the users of php in most cases. when I say ASP.Net is faster , they answer PHP is faster! they say that PHP is compiled too and becuase of running in Linux server , it is so faster than .Net... (?) if anyone answer this , i will be so glad. thanks PHP is never compiled in the sense that an ASP.NET page is compiled. After the first run of an ASP.NET page, if you use in-page code for your .aspx files, the page is compiled a...

Can .NET Framework + SQLServer 2000 perform as well as with Linux, MySQL, PHP
From the articlehttp://software.newsforge.com/software/05/01/27/170244.shtml?tid=132&tid=75&tid=131&tid=13"Flickr runs on MySQL, the most popular open source database, and it has from the beginning. Today Flickr has around a quarter of a million users and serves around 5,000 pages per minute, generating about 100,000 database queries. "Now if we run above scenario in Windows 2003 Web edition and SQLServer 2000 on Windows 2003 Server.However may server do we need? Web Server how many? SQLServer how many?5000 pages per minutes100,000 database queryThanks,John It depends mostly on...

VS.NET 2005 vs VS.NET 2003
I have used VS.NET 2003 extensively and exploited all features like drag and drop functions for creating components, drag and drop data access components...For example VS.NET 2003 allows creating sqldataadapter for table mapping , stored proc parameters mappings etc..We can drag pretty much any object on component designer....Not it seems like all that gone...VS.NET 2005, there is no way we can drag the typed dataset, sqldata adapter, sqlcommand on forms designer . There is no concept of component. There is no component designer any more....Biggest flaw i found is sqldatasource and...

Password hashing PHP vs. VB.net (sha1() vs. HashPasswordForStoringInConfigFile)
Anyone a PHP expert out there that could help me out?  I am trying to do matching against a PHP SHA1 password created with the sha1() function in PHP.  should sha1("greenapples") and FormsAuthentication.HashPasswordForStoringInConfigFile("greenapples", "sha1")  return the same hash? And should dim salt as string = "34" sha1("greenapples" <not sure how to specify salt in php>) and FormsAuthentication.HashPasswordForStoringInConfigFile("greenapples" & salt, "sha1") return the sam hash?   Thanks, JasonJFeel free to hit me on MSN, I will try to help if...

.NET performance vs COBOL
Background: We have a Net Express COBOL application (a .exe) that sequentially reads thru a 200,000K + flat text file (1,800 char reclen) and loads each record to a SQL2000 database table. Total run time is 7min. The ASP.NET application takes 25+ min. Will be happy to send anyone the .NET code we wrote (or full Project) and SQL2000 table design. Typically we use an IIS server and a SQL server in testing and production. In our development, my desktop is set to 'animate' as the IIS and the Data Sources(ODBC) has the Path to a test SQL2000 server. The time differences are about same u...

PHP to .NET Migration Criteria
I'm guessing this is the area where I can find people who have recently switched from PHP to .NET, or are at least in the process of migrating. I have some questions for you: What criteria was used in deciding to migrate to .NET? Can you cite any reference material used to make your decision? What was the deciding factor (or factors) used in the decision making process? We currently have 3 platforms for development - ColdFusion-40%, PHP-40%, .NET-20%. Obviously, we need to consolidate on one platform for the future. Thanks! Hi FifthLegion, Currently in my organization we are ...

VS.NET 2005 vs VS.NET 2003 #2
why there is no datagrid anymore when i drag the tables in design view? it's the gridview,and where is the data adapter. How will i connect the tables now? Here are a couple videos on the new Data model in VS2005.  I think you will find it much easier to use.  I have watch the first one, but the second is by Fritz Onion.  I think there is an Advanced Data Binding Video in the same series done by him as well. ASP.NET HOW DO I Video Series: Data MSDN Webcast: Essential ASP.NET for the Web Developer (Part 5 of 15): Introduction to Data Binding (Level 200) Hope this helpsTh...

Performance of Db2. Net provider over Oledb.net provider
Hi,       I heard db2.net provider is better in performance compared to oledb.net provider for connecting to ibm db2 from asp.net applications. Currently I am using oledb.net provider in my application and I want to switch to db2.net provider. Before that,I thought of checking the performance with sample queries. The metrics show oledb having better performance compared to db2.net provider. I am confused. Is there any article or source where I can get more info on this.   Thanks Sveerapally  Hi,      I found the db2.net provider to ...

Incompatibilities in .NET vs PHP encryptions
I'm currently trying to encrypt a string in .NET (using RC2 algorithm in CBC mode) and then decrypt it in PHP but found it to be not working. Then I encrypt a test string using the EXACT same algorithm in .NET and in PHP and found their output to be completely different! Did I do something wrong or are .NET and PHP just using different algorithms internally? (Note that this problem exists with TripleDES as well.) Are there any ways to make them inter-operate? I'm stuck here for a long time... Please help! PHP encryption code (using PHP4.3.1 with MCrypt):- <?php $key = "\...

not able to post to news.php.net php.general ng
xpsp3, TB latest I subscribed to news.php.net php.general ng and could get several past messages but I composed a query and tried to post, but it is giving "sending of message failed". all settings in this mozilla server and php server are same, other than the names of server and ngs. port 119, Use Default Server for outgoing SMTP. What to do? Do I need an account on some server to post to this? I have aioe account. Should I use that? -- V V S Rawat keyboarded, On 8/5/2008 10:36 AM : > xpsp3, TB latest > > I subscribed to news.php.net php.general ng ...

Web resources about - Php performance vs ASP.Net Performance - asp.net.migrating-from-php

Performance - Wikipedia, the free encyclopedia
A performance , in performing arts , generally comprises an event in which a performer or group of performers behave in a particular way for ...

Men, sex and performance anxiety
Sex occupies the minds of young men in more ways than the obvious.

Apple updates Logic Pro X & MainStage 3 Mac apps with performance improvements, new features
... is now at version 3.2.3 thanks to its most recent update. Both apps have received a handful of new features, under-the-hood changes, and performance ...

Electric vehicle puts in solid performance in the world’s toughest rally
... but remote and arduous terrain. And this year an electric vehicle called the Acciona 100% EcoPowered put in an extremely credible performance. ...

BMW i8: Jaw-dropping style and green performance, but why?
... drives the BMW i8 for a week and starts to wonder why the Germans built this EV. Continue reading BMW i8: Jaw-dropping style and green performance, ...

"I agree that Sylvester Stallone gave a hearty, worldly-wise performance as the aged Rocky Balboa..." ...
"... and thought that he’d be one of the few intersections between my own year-end picks and the nominations. But the Academy’s choice of no ...

WaPo: Trump/Cruz Commanding Performances in Debate Make It a Two-Horse Race
WaPo: Trump/Cruz Commanding Performances in Debate Make It a Two-Horse Race

Here's the story behind the incredible performance by three young children at a Donald Trump rally
USA Freedom Kids opened for Donald Trump at his Florida rally on January 13, 2016. The children performed an original song by director and Trump ...

Suicide Squad: Jared Leto's Ambitious Joker Performance Teased - Collider
Directors David Ayer and Zack Snyder tease the dramatic lengths Jared Leto took for his ambitious performance as The Joker in DC's Suicide Squad. ...

Google to boost compression performance in Chrome 49
Google yesterday announced that a new in-house compression algorithm, dubbed "Brotli," will soon be added to Chrome to speed up page loading ...

Resources last updated: 1/22/2016 4:29:57 AM