0% found this document useful (0 votes)
21 views

Coding Standard

This document provides naming conventions and programming style guidelines. It defines naming rules for identifiers, variables, classes, interfaces and more. Identifiers should not use underscores and variables should be lowerCamelCase. Class members should start with underscores and properties start with capital letters. Interfaces start with a capital I. The document also provides programming best practices around array usage, preferring typed over untyped arrays, and disposing objects that implement IDisposable.

Uploaded by

balazsy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Coding Standard

This document provides naming conventions and programming style guidelines. It defines naming rules for identifiers, variables, classes, interfaces and more. Identifiers should not use underscores and variables should be lowerCamelCase. Class members should start with underscores and properties start with capital letters. Interfaces start with a capital I. The document also provides programming best practices around array usage, preferring typed over untyped arrays, and disposing objects that implement IDisposable.

Uploaded by

balazsy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1. Definitions...........................................................................................................................................

2
1.1. Definition specification................................................................................................................2
2. Identifier naming.................................................................................................................................3
2.1. Identifiers.....................................................................................................................................3
2.2. Local variables.............................................................................................................................3
2.3. Class members.............................................................................................................................3
2.4. Class properties...........................................................................................................................3
2.5. Interfaces.....................................................................................................................................4
3. Programming style...............................................................................................................................5
3.1. Array usage..................................................................................................................................5
3.2. Disposing.....................................................................................................................................5
1. Definitions
This section describes the naming definitions which are used to define naming styles in this document.

1.1. Definition specification


[…] – characters or character range definition

* - zero or more characters

+ - one or more characters

[a-z] – character range from “a” to “z”

[a-zA-Z] – character range from “a” to “z” including capital characters


2. Identifier naming
This section describes the identifier naming styles which should be used in our codes.

2.1. Identifiers
Do not use “_” in identifier naming if not necessary. Use capital letter instead:

DEFINITION: [a-zA-Z][a-zA-Z0-9]*

CORRECT FORM: identifierName

INCORRECT FORM: identifier_name

2.2. Local variables


Local variable should be started with lower case letter and should be continued with one or more letters
or numbers.

DEFINITION : [a-z][a-zA-Z0-9]*

CORRECT FORM: localVariableName

INCORRECT FORM: LocalVariableName

2.3. Class members


Class members should be started with underscore followed by a lower case letter and should be
continued with one or more letters or numbers. Class members should be defined in the beginning of
the class or before each property definition.

DEFINITION : _[a-z][a-zA-Z0-9]*

CORRECT FORM: _memberVariableName

INCORRECT FORM: memberVariableName

2.4. Class properties


Class properties should be started with capital letter and should be continued with one or more letters
or numbers. Class members should be defined in the beginning of the class after the member
definitions.

DEFINITION : [A-Z][a-zA-Z0-9]*
CORRECT FORM: ClassPropertyName

INCORRECT FORM: classPropertyName

2.5. Interfaces
Interfaces should be started with capital ”I” followed by a capital letter and should be continued with
one or more letters or numbers.

DEFINITION : I[A-Z][a-zA-Z0-9]*

CORRECT FORM: IName

INCORRECT FORM: InterfaceName


3. Programming style
This section describes the coding techniques which should be used by the programmer.

3.1. Array usage


Typed arrays should be used always, avoid using un-typed arrays as ArrayList, Hashtable …

CORRECT USAGE : List<int>, Dictionary<int, string>

INC ORRECT USAGE: ArrayList, Hashtable

3.2. Disposing
Always check if the used object implements the IDisposable interface and call it immediately if exists.
The better way is to use the “using” statement which automatically disposes the object after the code
exits from the object`s range.

You might also like