There are a lot of areas of coding convention. Which are you interested in?
Class, Method(, Argument), (Local/Global)Variable naming conventions?
Bracketing styles?
I use the following naming conventions:
Variables: 3 character camelCased pseudo-hungarian notation (globals prefixed with underscore)
Code:
intPageCount, strUsername, bolSuccess, _aryObservers
Classes: PascalCased
Code:
class User
class FluxCapacitor
Interfaces: PascalCased with prefixed I
Code:
IModelObserver, IController
Methods: PascalCased
Code:
SaveUser(), CalculateFluxCapacitance()
Method arguments: non camelCased descriptive names
Code:
SaveUser(User user), CalculateFluxCapacitance(DateTime destinationDate)
I personally use this bracketing convention for code layout:
Code:
class FluxCapacitor{
int CalculateFluxCapacitance(DateTime destinationDate){
if(...){
....
} else {
....
}
}
}
However, my employer favors the brackets on separate lines:
Code:
class FluxCapacitor
{
int CalculateFluxCapacitance(DateTime destinationDate)
{
if(...)
{
....
}
else
{
....
}
}
}
-
Peter