05 November 2006

Naming conventions

While creating a big application is very important to have rules which let us not got confused when we have to correct this application couple months later. To help myself I decided to create a list which includes the most often used components and my names to recognize them.

  • private fields start from: "_" + first letter is lower-case (Camel Case)
string _myField;

  • properties start from: upper-case letter (Pascal Case)
string MyField;

  • local objects : first letter is lower-case (Camel Case)
string myField;

  • namespace I start from jurczyk.jarek next I add another clause like:
tools.
classes.
controls.
...

  • Methods name I write in Pascal Case I mean the first letter of each word is upper-case:
DoSomethingForMe();
  • constants name I write in upper-case like:
const string MYCONSTANT;

Controls name:
Assembly asm
Button btn
CheckBox ch
ComboBox cbx
Container ctr
DataColumn dcol
DataGrid dgrid
DataReader dr
DataSet ds
DataTable dt
DataTime data
Dialog dlg
DialogResult rdlg
Exception ex
GroupBox gbx
HashTable htbl
ImageList imgl
Image img
Label lbl
ListBox lbx
ListView lv
MainMenu mm
MenuItem mi
MDI-Frame frame
MDI-Sheet sheet
NumericUpDown nud
OpenFileDialog ofdlg
Panel pnl
PictureBox pbx
RadioButton rbtn
SQLCommand sqlcom
SQLConnection sqlcon
SQLDataAdapter sqlda
StatusBar sb
TabControl tc
TabPage tp
ToolBar tb
ToolBarButton tbbtn
Timer tmr
UserControl uc

0 Comments:

Post a Comment

<< Home