[thelist] ASP advantages and disadvantages

David.Cantrell at Gunter.AF.mil David.Cantrell at Gunter.AF.mil
Fri Feb 7 09:26:37 CST 2003


>ASP is dead easy. VBScript syntax is pretty simple.

That's true, but people also need to be aware of the serious performance
issues involved with VBScript. For example, when concatenating strings with
VBScript, the time increases *quadratically* compared to JavaScript.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasp/html/
asptips.asp

I've been writing ASP for years with VBScript, and while it's an easy
language, it is definitely not very powerful, nor is it very flexible. If I
had to go back and do it all over again knowing what I know now, I would
have chosen to go with JavaScript. You get a massive performance increase
over VBScript (but still interpreted script) as well as "syntactic sugar"
such as being able to dynamically add properties and methods to objects at
runtime. It may also support basic reflection.

VBScript also has really whacked-out namespace scoping, so doing things like
dimming a variable inside a loop will throw the compiler into utter
confusion. The ASP+VBScript combo also encourages using nested server-side
includes, which also causes namespace scope problems due to the two-pass
nature of the ASP interpreter. Check the following:

[script1.asp]
<%
Dim foo : foo = "This is foo"
%>

[script2.asp]
<!--#include file="script1.asp"-->
<%
Dim foo : foo = "I want to declare variable foo at this level and don't know
it was previously declared"
%>

BANG, the interpreter dies because it can't re-dim a variable automatically.
It also blatantly violates the basic concept of information hiding and
modularity, because now I have to think about which variables are declared
in what scope in all my referenced scripts, when the whole point of SSI is
the eliminate that problem. The solution is to re-architect your code to
take advantage of Server.Execute instead of includes, but not many examples
show this.

Just spouting my two-cents this morning,
-dave



More information about the thelist mailing list