Monday, May 7, 2007

Understanding Conventions & Casings

Use Case Scenario
Understanding Conventions & Casings

Objective
To understand common naming conventions prevailing in market.

Description


Traditionally meaning full identifier names were given by concatenating subsequent words with an Underscore( _ ) . e.g. back_color. But now a days instead of this traditional method casing styles are used to define identifires:

Casing Styles
The following terms describe different casing ways to identifiers.

Pascal Casing
The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters. For example:

BackColor, LoopIndexVar

Camel Casing
The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized. For example:

backColor, loopIndexVar

Uppercase
All letters or group of letters in the identifier are capitalized. For example:

IO, ReadXML

Naming Conventions

Hungarian notation
Hungarian notation is a naming convention, in which the name of a variable indicates its type or intended use by prefixing special characters to an identifire name.
numCount indicating a numeric variable
strAddress indicating a string variable
txtFirstName indicating a Text Box

But now a days a new naming conventions is used, instead of prefixing, the class name or type name is sufixed for special object type identifires. Say for example FirstNameTextBox, DateLabel, CancelButton.