Placement of SUB and FUNCTION

Results 1 to 3 of 3

Thread: Placement of SUB and FUNCTION

  1. #1
    Join Date
    Dec 1969

    Default Placement of SUB and FUNCTION

    Just a curiosity question: Does it mater in the placement of SUB and FUNCTION inside your page? Top of page, Bottom of page or use an Include page with all your routines?<BR>Does placement on a page effect performance?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Placement of SUB and FUNCTION

    No placement of functions do not affect performance but convention is to place at start of page.

  3. #3
    Join Date
    Dec 1969

    Default IMO

    Common Subs and Functions should be defined in an include file for easier maintenance and included in the page before the Dim statments, but after the option explicit.<BR><BR>If a function is unique to a particular page, then it should be right after any includes.<BR><BR>Example:<BR><BR>&#060;%<BR>Option Explicit<BR>Response.Buffer = True <BR>Response.Expires = 0 <BR>Response.ExpiresAbsolute = Now() - 1 <BR>Response.CacheControl = "no-cache" <BR>&#039; Add Includes files<BR>%&#062;<BR> &#060;!-- #include virtual="common/"--&#062; <BR> &#060;!-- #include virtual="common/"--&#062; <BR> &#060;!-- #Include virtual = "/includes/connection.asp" --&#062;<BR>&#060;%<BR><BR>Function MyUniqueFunction(strMyVariable)<BR> --- Some code here<BR>End Function<BR><BR>Dim intUserID<BR>Dim intScenarioId<BR>Dim objADOConn<BR>Dim objADORecs<BR>Dim arrResults, intCounter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts