[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Differences between a VBScript Class and using includes

Posted on 2002-04-06
3
Medium Priority
?
739 Views
Last Modified: 2013-11-18
Is there any difference regarding performance, etc. in using a VBScript class file over an include file in an ASP page?
0
Comment
Question by:wsteph
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 6923379
I am not familiar with the use of a "VBscript class file", I am afraid you have to explain that one. (I found nothing relevant in MSDN when searching for it).

The SSI include is quite a basic function that uses very little resources. I once made a test where I had one file include hundreds of other files, and the execution time for this was not even noticable.

The concept of classes is quite different from including files, so the answer to your question must be that it depends very much on what you would be using it for.
0
 

Author Comment

by:wsteph
ID: 6923424
A VBScript class file is used in practically the same way a class in a dll would be. For instance say I have a file called methods.vbs and have the following code in that file:

<%
Class MyClassMethods
  Private Sub ConnectToDatabase()
    ...Code to connect to db
  End Sub

  Public Function GetRecords()
    ...Code to return db data to ASP page
  End Function
End Class
%>

I can call the methods in the script file much like I would call the methods in a dll from the ASP page like so:

<% @Language=VBScript %>
<!-- #include file="classes/class.cls" -->
<%
  Dim strHoldReturnData
  Dim objASPClass
  Set objASPClass = New MyClassMethods
  strHoldReturnData = objASPclass.GetRecords
  Set ObjASPClass = Nothing
%>

I was just wondering if there were any substantial differences between using this approach to encapsulate methods or just using a plain old include file that contains the methods. As you found out, Microsoft doesn't provide much information on this topic.
0
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 100 total points
ID: 6923933
Oh, you mean just a plain simple include file containing a VBScript class definition. :)

I have to disagree that the class file is used even remotely the same way as a dll. The class file is simply a plain text file that is added to the source before the ASP parser gets it's hands on it. To ASP it looks like a single file. Just because the include file has a special name or contains code for a class definition, there is nothing special with it; there is no added functionality over a plain include file.

Well, lets get to the point: As you use the same method for including functions and classes, there is no difference there. The only difference is encapsulating the code in a class. The overhead for this is not very much, though, it will add about a millisecond or two to the execution time of your code.

Usually objects is used to hold some kind of data. If your functions doesn't share any data, there is no reason to put them together in a class.

If you find it useful to construct a class, you should definitely do so, but not for the sole purpose of grouping some functions together.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question