From The Archives

Active Shitter Pages

As I probably mentioned, about 3 months ago I landed a kick ass job at a well established local web firm [names concealed to protect the innocent]. Before starting that job I had very minimal experience with ASP – in school, it left a bad taste in my mouth but i couldn’t remember any specifics. I wrote it off as one of those pathetic microsoft things. In spite of my aversion to and inexperience with ASP, I still managed to land a job with a company who – up until then – had relied heavily on ASP. I had no choice but to dive headfirst into uncharted waters. All tolled, in the past few month’s I’ve become about 50% as comfortable with ASP as I am with PHP – and I’m decided that all future projects will be written in PHP.

Aside from any possible performance issues, benefits open source software, etc, I’ve come across a few really practical (arguably nitpicky) reasons not to use that M$ tripe:

1. Syntax:
ASP syntax is horrendous! Here a a few common things i do on day to day basis. First I’ll give you the ASP, then the PHP:

Open a database connection and run a query:

' Open connection to database
db = "d:\path\to\file.mdb"
Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open "DBQ=" & db & ";Driver={Microsoft Access Driver (*.mdb)};uid=;pw=;"

' Do Query and get object
sql = "SELECT * FROM table"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, dbConn, 1, 3

// open connection to database
mssql_connect ( servername, username, password );

// Do query and get object
$sql = "SELECT * FROM table";
$rs = mssql_fetch_object($sql);

Why does ASP require 6 long, hard to remember, lines for something PHP does with 4 much shorter lines? The PHP could be reduced to 3 lines, but if the ASP was reduced to any fewer lines it would lose readability. The structure of the ASP code is much more mishmash. What I mean, is from a purely visual standpoint, the ASP just has too much going on – it’s ugly.

If Statement:

If something = 1 Then
'Do Something
ElseIf somethingElse = 1 Then
'Do something else
'Do something different
End If

if($something == 1){
//do something
}elseif($something_else == 1){
//do something else
//do something different

Granted the ASP is actually a lot more legible in this example (for an english speaker), but the added legibility adds extra keystrokes. Ok, so maybe it’s only 4 characters, but why is “ElseIf” one word, when “End If” is two. WTF?!

Print A variable:


echo $foo;

2. Multipart Form Data
ASP does not support ‘multipart/form-data’! (thanks google) said it best:

“It is a Shocking Revelation that although Microsoft browsers have supported this format from the moment that Microsoft got interested in the Web, the standard form components they supply for Web serving do not.”

That’s right, if you want to handle form uploads, you have to write your own code. Or find something you can use for free.

3. Reference
There is no good central reference for ASP, but there sure are a tonne of bad references. Whenever i do a google search for something ASP related I get a hundreds of shady pop-up-infested “reference” pages. I wouldn’t be suprised if I got similar results with PHP, but PHP has so I don’t ever have to resort to googling.

The best reference I’ve found is the W3 Schools’ site. But it only contains basic information, I’m quickly outgrowing it.

My final complaint is moot, but i thought it was worth mentioning. You can install ASP on Windows ME, but not Windows XP Home.

W T F ?!