NYCPHP Meetup

NYPHP.org

[nycphp-talk] Newbie needs help - why PHP over ASP?

Kenneth Downs ken at secdat.com
Wed Aug 24 09:27:34 EDT 2005


I can tell you why I tried ASP.Net and why I eventually walked away from it.

First, cross-platform is big, it had to run on Linux.  But I had to work
out some basic ideas first about the app and I had no knowledge of Linux
dev tools, while I was very comfortable with Windows, so this made
anything .Net the easiest way to get started.

So I put .net onto the Win2k laptop, installed MSDN and got started with
the tutorials.  Built the basic 3-tier and 4-tier model of a basic
application.  Then started working through my own ideas.

The first trouble I ran into was how difficult it was to code manually. If
you don't use the IDE it is nigh near impossible to grind out the simplest
page.  There is a huge overhead of declarations, namespaces and binding to
work out.  This is a problem because as I get older I am much less
impressed with complexity and really like simple programs that are easy to
read and understand on sight.  But so far I withheld judgement and kept
looking at it.

The next trouble was dynamic database connections.  In my systems users
connect as who they are, not using an aliased generic connection.  In PHP
I can create a connection on-the-fly using session variables and work with
it, while ASP.Net wants a gazillion different objects before you execute
your first SELECT statement.  Programmatically changing the connection to
log in as somebody else did not seem to be something they were expecting
anybody to do.  I found nothing easy about dragging and dropping 3 or 4
objects around and setting all kinds of properties (that i could then not
change dynamically) compared to this:

$conn = pg_connect("host=1.2.3.4 dbname=.... etc)

The IDE would do extremely perverse things to your page.  If you went in
and tried to monkey with the HTML, the editor inserts line breaks and
spacing that appear to be deliberately obfuscating the page.  This made it
very frustrating to work through what was going on.

At this point I was still getting useful work done prototyping the actual
project, so I still pressed forward.  However, the tide of opinion had
changed and I was, as you might say, looking for trouble.

The deal-killer turned out to be the very foundation of ASP.Net, what i
believe really makes it bad, its concept of the 'code-behind' page that
stores processing code separate from HTML code.  This is the biggest
departure from original ASP, it is what also truly distinguishes ASP.Net
from PHP, and it is what makes ASP really really bad.  The problems are:

1) It makes it very difficult to create completely dynamic pages.

2) You've got two pages no matter what (AFAICR), even when you don't need
that kind of complexity.

3) It hides the details of execution flow and actually denies you access
to those details.  If you have ever seen the horrors of what happens when
a programmer is shielded from architecture realities, you will appreciate
the kind of resource hogs this is going to create.  While it is clever to
allow a programmer to put server-side event code in for a single control,
it is also lunacy to execute round trips on these events.  PHP requires
you to know about the architecture so that you can code it right.

Now, compare this to PHP, which meets the first requirement for
programming: if the computer can do it, PHP can do it.  But it also meets
the second requirement: Don't fluff it up, just do the job!  ASP.Net has, 
to put it mildly, a lot of fluff.  PHP has so far is OO-sane, it provides
OO without requiring it.  That sums up the entire PHP experience regarding
almost everything, it provides it and supports it but does not require it.


> Hello all,
>
> A silly question perhaps but I'm fairly new to PHP and looking to do
> some work on a new MySQL driven website - I have been asked to provide
> reasons why PHP is a better option than ASP. I am not familiar with ASP
> so if anyone out there can trash it for me... I mean give good reasons
> why ASP should not be used for this application it would be really
> useful! I'm hoping to use this project to really push my PHP learning so
> I really don't want the owners of the site to go with ASP.
>
> :)
>
> Cheers,
>
> Jay
> South Australia
>
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>


-- 
Kenneth Downs
Secure Data Software
631-379-0010
ken at secdat.com
PO Box 708
East Setauket, NY 11733




More information about the talk mailing list