Standard Requirements for Programming Assignments
Documentation
- Provide a block of comments near the beginning of each source code file that gives your name, course and section number, e-mail address, project, the purpose of the project, the date, and other explanatory material as appropriate to the assignment.
- An example of a block suitable for file documentation is shown here:
'------
'
'Name:Don Bailes, email:
'Course:CSCI3800, Dr. Bailes
'Assignment:Lab Exercise 1
'Created:Wednesday, August 30, 2006
'Modified:August 31: Added Data Validation and Goodbye Message
'File:HotelBillForm.vb
'Solution:Exercise1-Hotel Bill.sln
'Project:Exercise1-Hotel Bill
'======
'Purpose:Example illustrates use of labels, textboxes, various kinds
'of buttons, group boxes, data validation, and so forth. It
'illustrates data conversion, computation, decisions, loops,
'commenting, course standards for Windows Formsprojects,
'event-handling, setting focus, selecting text,form loading
'and form closing, and the use of message boxes.
''------
- An example of a block suitable for method documentation is shown here:
'======
'
'Name:Don Bailes
'Date:Wednesday, August 31, 2006
'======
'Method:txtNumNights_KeyPress
'Solution:Exercise1-Hotel Bill.sln
'Project:Exercise1-Hotel Bill
'Access:Private
'Handles:txtNumNights.KeyPress
'Purpose:Only allow digits and backspace for number of nights
'
‘======
- For eachProperty, Function, or Sub that you define, include a block of comments that give the name of the routine, the arguments and their uses (if any), the return type if it is a function, and its purpose. If the code is lengthy or not fully self-documenting, describe the algorithm used, and any special features that might not be obvious to a reader of the code.
- Fill in the appropriate information in the AssemblyInfo.vb file so that the application can obtain it during execution via reflection. Use the project properties as a means of doing this if you prefer.
Appearance
- Align controls on the form to give it an attractive, reasonably professional appearance. Use centering, spacing, and so forth, as appropriate.
- For TextBoxes, string values should be left-justified, and numeric values should be right-justified.
- Use appropriate fonts, colors, and sizes, taking into account that the computer on which you develop your code will not be the one on which it is graded.
- Unless the requirements of the application indicate otherwise, suppress the Maximize button and prevent the user from resizing forms.
- If appropriate, provide accelerator keys for controls. Make sure the taborder is such that tabbing and accelerator keys work the way a user would expect them to work and make the form easy to use.
- If appropriate, set the AcceptButton and CancelButton properties of each form to allow the user to use the Enter key and Esc key to take default actions in a way the user might expect them to be set.
- Format output values appropriately for their types and uses (currency, fixed point numbers with an appropriate number of places after the decimal, etc.).
- Display the form centered on the screen initially. Splash screens, dialogs, and other secondaryforms should be centered on their parent form.
- Place your name at the beginning of the caption of major forms and be sure the entire caption is visible as the program runs.
General
- Option Strict MUST be ON. Option Explicit MUST also be ON.
- Use VB.NET classes and methods rather than the older VB6 methods. For example, use the MessageBox class instead of the VB6 MsgBox function. VB.NET will be around for the foreseeable future, but VB6 relics will begin to disappear from future VB versions.
- Rename all classes and source files so that they have meaningful names (e.g., rename Form1.vb to SalesForm.vb and rename the Form1 class to something more like SalesForm; do this for all classes/forms in your application).
- Use Hungarian notation in naming fields and local variables (precede the name of a variable such as Count with a lower case abbreviation of the type of data such as n for integer: nCount). For example: strName, btnExit, txtName, bOK, and dAmt represent a string, a button, a textbox, a Boolean variable, and a double precision number respectively.
- Use Pascal-casing in naming methods, properties, and so forth. Examples are SortValues, DisplayNames, CheckForErrors, and BackgroundColor.
- After each action taken by your event handlers, make sure that the focus is correctly set to make it easy for the user to do whatever is most likely the next action. Where appropriate, SelectAll of the text in an input field to make typing convenient.
- Try to make the program as “bullet-proof” as possible by techniques such as disallowing invalid input and missing input where such would cause the program to throw an unhandled exception.
- Provide appropriate Welcome/Goodbye messages (or splashscreens), and so forth.
- Control propertiessuch asReadOnly, NotEnabled (grayedout), TabStops (or not), etc.should be set appropriately.