Skip to content

Steps to avoid common problem while debugging

August 11, 2009

Here are the common problem the developer phase when debugging the code and steps to overcome the problem.

1. Misspelling variables:

To avoid this proble, use “Option Explicit” statement as the first line of script on every page.The Option Explicit statement require variables to be explicitly declared with Dim statement.

2. Using and object or variable out of scope:

Make sure the object you reference are in current scope.

3. Mixing data types:

Follow naming convention that will help you to avoid mixing data types.

4. Not handeling errors:

Use Try Catch block so that you can catch the exception.

5. Forgetting Ending braces,delimiters and statements:

To avoid this problem, make a practice of typing the closing portion of a statement as soon as you type the opening portion.

6. Misusing the Equal Sign :

Visual Basic users expect the single “=” (equal sign) to evaluate the equality of the two operands. In JScript, however, the single “=” will assign the right-hand value to the left-hand operand. (JScript uses a double “=” to express equality.) Mistakenly using a single “=” in an expression will not only overwrite the left-hand value, it will cause the expression to evaluate to True. If this happens in an If statement, the inner logic is executed; in a While statement, it creates an infinite loop. Remember that “=” is different than “==” in JScript. Additionally, don’t forget to include the equal sign when using an <%= expression %> instruction.

7. Using Procedures Incorrectly :

Not understanding when to use a function or procedure, or calling the incorrect function, is a common problem. It can be avoided using the incorrect arguments for functions, or passing arguments in the wrong order, by double-checking the function definition. Additionally, make sure that the function calling performs the task, check syntax for functions whenever using them, and avoid relying on default argument values.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: