CSC/ECE 517 Fall 2010/ch5 5b mt: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 14: Line 14:
==Notable Naming Conventions==
==Notable Naming Conventions==
===General Conventions===
===General Conventions===
<hr/>


====Hungarian====
====Hungarian====
Line 22: Line 23:


<hr/>
<hr/>
===Language Specific Conventions===
===Language Specific Conventions===
||This is our second subtopic||
||This is our second subtopic||

Revision as of 01:19, 3 November 2010

Variable Naming Conventions

Variables are used in all computer programming languages and are used for various reasons; such as, holding the value of a constant, holding the value of something used many times throughout the program, or used briefly for counting. The names used for each variable are more difficult to choose than simply making any word or word combination. The rest of this article is dedicated to helping the novice programmer determine variable names for different programming languages and purposes.


Introduction

A Variable is a name used within a program that holds the value of something that is known or unknown. For example, the variable "firstName" would be used to hold the string of letters that comprises a person's first name. The variable may not be set at the beginning of the program and it may change multiple times after being set. Naming conventions are a set of rules used to guide the programmer when creating the names of variables. Using the previous example, if there were no naming conventions, the variable could be named "fn", which is ambiguous and would be hard to follow when reading through many lines of code. Therefore, general naming conventions, which are incorporated by many languages are needed to aid the ability to follow the code without having the author present. General naming conventions are not perfect; thus, many coding languages have adopted their own type of convention. Furthermore, there are universally used variables and special types of variables that are used without regard for a language type.


||An example of multiple cites for the same resource [1] [1] If it doesn't have multiple cites for the same resource just leave off the a and b

||

Notable Naming Conventions

General Conventions


Hungarian

Universally Used Variables

Special Variable Conventions


Language Specific Conventions

||This is our second subtopic||


Ruby

Java

C/C++/C#

.NET

Conclusions

Variables are inevitable in programming. The naming of variables must be taken with caution so that they make sense to any who read through the code. When creating names of variables the author should take into account the language of the code, the purpose of the variable, and the type of value the variable will hold. Adhering to naming conventions is not a requirement, but they are merely guides that a programmer can use to determine the best way to name the program's variables.

References

1. a, b Author last, FI. (2010, April 26). Title of webpage. Retrieved October 15, 2010, from site name (Github): http://github.com/

Additional Resources