What are the rules for naming variables in Visual Basic? Providing examples of the good and the bad, discuss what impact good programming practice has on the naming of variables.
What will be an ideal response?
The name must begin with a letter or an underline symbol (_). The name can contain letters, numbers, or the underline symbol. It cannot contain spaces or other special characters. Reserved words in Visual Basic cannot be used for variable names; reserved words appear in blue in the code window. Good programming practice dictates that the variable names you use should reflect the actual values to be placed in the variable. That way, anyone reading the program code can easily understand the use of the variable. For example, a good variable name for a string variable that will contain an employee's last name would be strEmployeeLastName. Names you should not use include strXXX, strLN, strEmp, or strName. Each of these names is imprecise and potentially misleading. You should consider the people who will be reading your code when you name the variables in your program. Your goal must be to make the task of reading your code as clear and easy as possible.
You might also like to view...
The statement for registering a listener for processing slider change is ___________.
a. sl.addListener(e -> {processStatements}); b. sl.getValue().addListener(e -> {processStatements}); c. sl.valueProperty().addListener(e -> {processStatements}); d. sl.getItems().addListener(e -> {processStatements});
The small circuit boards that hold a series of RAM chips are called ________
A) flash memory cards B) expansion cards C) memory modules D) virtual memory
Which of the following views displays the page as it would appear in Internet Explorer?
A. Code B. Design C. HTML D. Snapshot
You interact with a program through its user ______.
A. protocol B. development unit C. input window D. interface