Page 1 of 1

Naming convention

PostPosted: 21 Feb 2013, 10:39
by Ursego
Use a naming convention if it exists in your programming language / organization.

IMHO, it's very important to easily distinguish in code between:

1. Local variables (including arguments to functions) and instance variables. You are lucky if your IDE automatically displays variables of different scope using different colors /bold/italic (as my favorite Eclipse does), but if it doesn't - you can use, for example, the following practice:
localVariable
_privateInstanceVariable
__privateStaticVariable
PublicProperty

2. GUI controls of different types, like lblFirstName (for Label), txtCity (for TextBox), btnCancel (for Button), dgCustomers (for DataGrid) etc.

3. Objects of different classes in frameworks like ADO.NET, for example: cnConnection, cmdCommand, dsDataSet, tblDataTable, rowDataRow, colDataColumn, drDataReader, daDataAdapter...