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

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
<h1>Variable Naming Conventions</h1>
<h1>Variable Naming Conventions</h1>
<p>Almost all programming languages allow the programmer a great deal of freedom when naming variables in a program's source code.  But choosing good names is hard. This is a tutorial on how to choose good variable names! </p>
==Introduction==
<p>Naming conventions is one topic in programming that has probably not been emphasized enough. There has always been a debate about its importance and effort taken to learn and follow them. Naming conventions make programs more understandable by making them easier to read. They can also give information about the function of the identifier-for example, whether it's a constant, package, or class-which can be helpful in understanding the code thereby reducing development time specially when the code is large.</p>
<p>
As an example, say a variable holds the average age of students in a class. <b>Int averageAge</b> or <b>int AverageAge</b> gives a lot of information to the programmer about what the variable does than say just int a; Also capitalizing the very first letter of every word makes it more readable than just <b>int averageage</b>.</p>
<p>
In this chapter, we are mainly going to look at some rules and guidelines to choose good variable names.
</p>

Revision as of 00:54, 4 November 2010

Variable Naming Conventions

Almost all programming languages allow the programmer a great deal of freedom when naming variables in a program's source code. But choosing good names is hard. This is a tutorial on how to choose good variable names!

Introduction

Naming conventions is one topic in programming that has probably not been emphasized enough. There has always been a debate about its importance and effort taken to learn and follow them. Naming conventions make programs more understandable by making them easier to read. They can also give information about the function of the identifier-for example, whether it's a constant, package, or class-which can be helpful in understanding the code thereby reducing development time specially when the code is large.

As an example, say a variable holds the average age of students in a class. Int averageAge or int AverageAge gives a lot of information to the programmer about what the variable does than say just int a; Also capitalizing the very first letter of every word makes it more readable than just int averageage.

In this chapter, we are mainly going to look at some rules and guidelines to choose good variable names.