Coding Standards & Guidelines

You can download the word document from here

 

Naming Guidelines

Capitalisation Styles

Pascal Case:

The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. E.g. TaskName.

Camel Case:

The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized. E.g. taskName

Upper Case:

All letters in the identifier are capitalized. Use this convention only for identifiers that consist of two or fewer letters. E.g. System.Web.UI

Hungarian notation:

Hungarian notation is a naming convention in programming where the naming of a variable indicates its usage. Hungarian notation was designed to be language-independent eg. lSerialNumber — indicates that the variable is of type long 

The following table summarizes the capitalization rules and provides examples for the different types of identifiers.

Identifier

Case

Example

Class

Pascal

ScheduleOff

Enum type

Pascal

ErrorLevel

Enum values

Pascal

FatalError

Event

Pascal

ValueChange

Exception class

Pascal

WebException

Read-only Static field

Pascal

RedValue

Interface

Pascal

IDisposable

Method

Pascal

ToString

Namespace

Pascal

FedEx.COMPASS

Parameter

Camel

typeName

Property

Pascal

AssignScheduleOffDate

Case Sensitivity

Abbreviations

Class Name Guidelines

Namespace Naming Guidelines

Interface Naming Guidelines

Attribute and Enumeration type Naming Guidelines

Static Field Naming Guidelines

Parameter Naming Guidelines

Method and Property Naming Guidelines

Constant Naming Conventions

Variable Naming Conventions

To enhance readability and consistency, use the following prefixes with descriptive names for variables

Data Type

Prefix

Example

Boolean

bln

blnFound

Byte

byt

bytRasterData

Date (Time)

dtm

dtmStart

Double

dbl

dblTolerance

Error

err

errOrderNum

Integer

int

intQuantity

Long

lng

lngDistance

Object

obj

objCurrent

Single

sng

sngAverage

String

str

strFirstName

 

 

 

Variable Declaration

Comments

Comments are necessary at the start of each section, logical block of program code and critical statements. Comments should briefly expalin the purpose of the statements that follow.

E.g: ‘This is a comment line

Object Naming Convention

The following table lists recommended conventions for objects

Web Form Controls

 

Object Type

Prefix

Example

Button

btn

btnSubmit

Checkbox

chk

chkMon

CheckedListBox

clb

clbTemplates

Combobox

cbo

cboLocation

RadioButton

rad

radGender

CrystalReportViewer

crv

crvMaxSettings

MonthCalendar

cal

calEmpScheduleOff

Panel

pnl

pnlDailyMaxSettings

GridView

gdv

gdvEmployees

Label

lbl

lblState

LinkLabel

lnk

lnkEmpSchDetails

ListView (3.5)

lvw

lvwData

LinqDataSourceControl (3.5)

ldsc

ldscTestdatabase

ListBox

lsb

lsbBPCategories

MainMenu and MenuItem

mnu

mnuTasks

TabControl

tab

tabRoute

TextBox

txt

txtEmpName

ToolTip

tip

tipContinue

Tree Node

tvn

tvnLocations

TreeView

tvw

tvwCountries

Image

img

imgLogo

MultiView

mvw

mvwTasks

Update Panel

upl

uplTasks

Calendar

cal

calShiftPlanner

UserControl

ucl

uclCalendar

Table

tbl

tblEmpDetails

Data List

dls

dlsTasks

Repeater

rpt

rptCertification

PlaceHolder

phd

phdTask

RadioButtonList

rbl

rblTemplates

RangeValidator, RegularExpressionValidator, RequiredValidator, ValidationSummary ,etc

val

valMonthDays

Table

tbl

tblTasks

TableCell

tcl

tclWk

TableRow

trw

trwFirstRow

 

 

 

 Note: Form objects follow class naming conventions.

ADO.NET

           

Object Type

Prefix

Example

Connection

con

conCompass

Command

cmd

cmdManagers

DataAdapter

da

daEmployees

DataColumn

dc

dcEmail

DataReader

dr

drTasks

DataRow

drw

drwDeletedShift

Dataset

ds

dsTasks

DataTable

dt

dtRoutes

DataView

dv

dvLineHauls

Parameter

prm

prmEmpId

Transaction

trn

trnUpdateShifts

 

 

 

Class Member Usage Guidelines

Property Usage Guidelines

Method Usage Guidelines

Constructor Usage Guidelines

Field Usage Guidelines

Parameter Usage Guidelines

Type Usage Guidelines

Base Class Usage Guidelines

Inheritance Usage Guidelines

Usage Guidelines

Nested Type Usage Guidelines