Visual Basic Coding Standards
Use the following styles and standards in your Visual Basic programs. You may lose points on any assignment if you fail to adhere to these guidelines.
When a programmer works for a company that produces software or studies computer science in college, he or she must work closely with others. Often, programmers work on team assignments. Therefore, the code that one programmer writes must be consistent with the code written by others around him or her including bosses, fellow employees, fellow students, and teachers. Following the institution's coding standards is essential. At Wyomissing, students must apply these principles to every program that is submitted for a grade. Even though a program may function properly, the programmer is responsible for documenting the program.
It is also essential for all programmers to use good internal documentation (i.e. comments) so other programmers can understand your code. It is also important to use good external documentation (i.e. user manuals, Help menus, etc.) so your program is user-friendly and doesn't confuse users.
Coding
Use perfect spelling and grammar throughout your code, especially when it can be viewed by a user. If necessary, use a dictionary or copy and paste your code into Microsoft Word or Google to do a spell-check.
Include the following information in the general declarations
section of every form in a project and the standard code module:
Programmer Name Project Name Class Period |
' John Doe ' Chaos ' Period 1 |
|
|
Documentation
Use a consistent format with regard to internal documentation. If you use complete sentences in inline comments, then do so throughout your program's code, otherwise use explanatory, understandable phrases. Remember comments are the main form of internal documentation. They should be explanatory but not too verbose (wordy). They should help explain the purpose of the program or method in which they are used. They should also explain the purpose of variables within specific algorithms. Always use correct spelling, punctuation, and grammar within comments.
A program should be self-documenting which means that its variable names are descriptive and not single letters like x and y. That is, variable names should be whole words or phrases that make refer to the purpose they serve within the program. Begin the names of variables with lowercase letters as in num instead of Num. However, if the variable name consists of two or more words then every word except for the first one should be capitalized as in numApples or numApplesPurchased. Constants must be named with all-uppercase letters and underscores to separate consecutive words (e.g. TAX_RATE).
Annotate medium to complex algorithms and assignment statements with inline comments. Do not necessarily assume that fellow programmers (or instructors) will understand your logic. However, do not document the obvious.
Turning-In Programming Assignments
Delete unused methods (i.e. methods that have no statements in their body.) Highlight the code in the code window and click the Delete key. The code should not appear on the final code printout. If it does, try it again.
Never fix code or add statements with a pen or pencil. You MUST make any necessary corrections on the computer and reprint the program.
Other Links of Interest
Other Stylesheets & Standards from Corporations and Universities