ASP Weaknesses

Of course, using ASP is not all sunshine. As I mentioned, one of its strengths is also one of its weaknesses. For all its flexibility, VBScript is still fairly weak in some of the areas that would make creation of robust solutions easier. First, the structure of ASP pages can exacerbate VBScript's tendency to create applications that aren't structured the way you might want to structure them. For instance, programmers commonly use subroutines located in libraries linked in at compile time or DLLs linked in at run time to place commonly used routines in a single area. It is not as easy to do this in VBScript, though recent changes to ASP in IIS 5 have made it easier than before by introducing scripted objects that can be created at run time.

Variables present another problem for the VBScript programmer, especially the VBScript programmer who is a poor typist. While most languages will catch you if you call a variable szFirstName in one spot and szFristName in another, VBScript will happily create a second variable named szFristName , initialized to nothing. This can drive you crazy. Second, all VBScript variables are variants. Variants are variables that can be one of any number of types, and at run time you can place whatever you want into the variable. For instance, in a single module, you could say szFirstName="Fred" and several lines later say szFirstName=72 . In this example, the second assignment obviously defies the implied intention for use of the variable, since 72 is clearly not a first name , and our use of "sz" as a prefix implies that we are looking to place a string in the variable. Real-world cases are often much less obvious. A consequence using variants is that if you decide to move some of the code into an object that will be created in Visual Basic and used by the VBScript in an ASP application, you will have some work to do declaring the variables with types and then tracking down the places where you inadvertently do things that are not type-safe.

While ASP applications are much easier to debug than they once were, they are still not as easy to debug as a traditional Visual Basic or C++ application. In many scenarios, the debugger will show you the problem and allow you to check the value of variables. The view of the actual source will still be read-only, meaning that you can determine the problem and then fix it using another tool.

Another ASP weaknessespecially if you intend to distribute the applicationis the fact that the actual script code, not some compiled version, must be distributed. If you are creating an application for resale, this is a serious problem because a user might inadvertently modify the code and any trade secrets embedded in the script will be visible. This can be mitigated somewhat by placing key code in ActiveX components , but undoubtedly, much of the code will be exposed to your customers.



Inside Server-Based Applications
Inside Server-Based Applications (DV-MPS General)
ISBN: 1572318171
EAN: 2147483647
Year: 1999
Pages: 91

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net