When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

Business Systems Analyst - Clearing - SQL Server - ASP - VB (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume

Use prefix notation when naming your variables!


  • Back to Beginner's Tip Index
  • Next tip...

    If you give your variables names like i, j, x1, stuff, or blah, you are using poorly named variables, I assure you! Imagine reading through the code. You come across a statement like:

    x1 = 5

    Now what does that mean? x1 = 5? What is the coder trying to do? (This is particularly embarassing when you are reading your own code sometime later!)

    First off, you should choose variable names that make sense. If the variable is going to store the user's name, it should be named strName, not a or something nondescriptive. Also, you should use prefixes to convey the type of data you expect to be stored in these variables. Below is a short table of prefixes commonly used for various types of variables. Since all variables are variants in ASP, there is no formal or explicit type casting. (Although you can use casting functions such as CInt(), CStr(), etc.)

    Prefix Notation
    Integeri
    Longlng
    Singlesgl
    Doubledbl
    Stringstr
    Booleanbol
    Objectobj

    I strongly suggest you adopt this naming convention, or use your own. Regardless of the standard you choose, what is important is that you adhere to it! :) You'll note that the majority of code snippets on the site that I have written use the above prefix notation.

  • Back to Beginner's Tip Index
  • Next tip...


    Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article


  • The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers