Oh, how I hate ASP

Writing ASP (Active Server Pages) sucks. All I want to do, is to add one array to another. Sounds easy, right? Well, with ASP it isn’t. Not by a long shot.

But first, and just for contrast, let’s see how PHP does it:

$array1 = array("12","35","45");
$array2 = array("334","355","456");
$new_array = array_merge($array1, $array2);

Nice and simple, right? Okay, now how about Perl?

my @array1 = ("12","35","45");
my @array2 = ("334","355","456");
my @new_array = (@array1, @array2);

Wow! That’s also pretty brain-dead easy. But, I'm writing about ASP here, so let’s move on to that example:

Dim aArray1(), aArray2(), aNewArray(), iArrayCount, iInArray
aArray1 = Array("12","35","45")
aArray2 = Array("334","355","456")
ReDim aNewArray(0)
iArrayCount= 0

' Note that this below is part of a bigger loop where depending on input, I may
' have to add arrays together several times in one go. So, multiply the code below
' like ten times and that's what I'm dealing with.
If (UBound(aNewArray) = 0) Then
   ReDim Preserve aNewArray(UBound(aArray1) + 1)
Else
   ReDim Preserve aNewArray(UBound(aNewArray) + UBound(aArray1))
End If
For iInArray= 0 To UBound(aArray1)
   aNewArray(iArrayCount) = aArray1(iInArray)
   iArrayCount= iArrayCount+ 1
Next
If (UBound(aNewArray) = 0) Then
   ReDim Preserve aNewArray(UBound(aArray2) + 1)
Else
   ReDim Preserve aNewArray(UBound(aNewArray) + UBound(aArray2))
End If
For iInArray= 0 To UBound(aArray2)
   aNewArray(iArrayCount) = aArray2(iInArray)
   iArrayCount= iArrayCount+ 1
Next

I rest my case.

Jun 13, 2005 06:37PM (asp, perl, php, programming, work)

Comments

  1. kv said on 14 June 2005:

    my thoughts exactly!

  2. Philip said on 16 June 2005:

    That’s a VB problem. ASP itself is just an interface (like CGI). Do your ASP coding in PerlScript or JScript instead of VBScript. It’s far simpler.

  3. tausif said on 18 April 2008:

    It helped me a lot.

  4. tausif said on 18 April 2008:

    it helped me a lot.

  5. garrett said on 03 July 2008:

    hey look at me, im using asp

    if i want to goto another line i have to add some bullshit &_ to the end of the previous line

    isnt convenience great

    i hope asp burns.

  6. Nem said on 08 September 2008:

    My employer now offers ASP-services. Guess who’s screwed now…

    Gimme my PHP back!

Add a Comment

Your name, a valid email address, and a comment are required. Your email address will not be displayed or shared.

or Cancel