devxlogo

Encapsulate Your Code

Encapsulate Your Code

One of the most common mistakes developers can make is to extensively use global variables. While they are sometimes necessary, global variables can cause problems in code that are both difficult to find and costly to fix. One way of preventing the use of global variables is by encapsulating all of your code in subroutines.

As in the code fragment below, ASP pages can be organized into a set of functions, all called from a Main subroutine declared at the top of the page. Using this coding standard can prevent debugging later.

  ---------- Sub Main %> 

devx-admin

Share the Post: