What are naming conventions?
Naming conventions are simply a standard format in which you name your Variables/References/Identifiers, etc...
While you can name these things anything that you wish, by using the standard conventions, you will save time and eliminate a lot of confusion when start getting into large coding projects. By using these conventions, you should be able to identify what variables contain, just by looking at how it is named. In addition, since you cannot use spaces in your variables, and you want to be as descriptive as possible, mashing words together can be very difficult to read and this will help that.
You won't understand all of these quite yet, but come back to this post when you start to see them.
Types of Notation
Camel Casing: first word all lower case, capitalize first letter of each subsequent word. Generally used for primitive type variables (will cover later)
camelCasing
helloWorld
myAge
payRate
Pascal Casing: capitalize the first letter of every word. Generally used for name classes and methods, depending on the language that you're using
PascalCasing
GetPayRate
MoveCharacter
CalculateInterest
Hungarian Notation: when dealing with objects, you prefix your identifier names with an abbreviated description of what type of object it is, and then capitalize the first letter of each subsequent word.
txfFirstName >> a text field called FirstName
txaMessageBody >> a text area called MessageBody
btnSubmit >> a button called Submit
cboOptions >> a combo box called Options
If you're confused right now, ask questions. But don't worry about it too much at this stage as we will touch on these as we encounter them in later lessons.
No comments:
Post a Comment