This page provides information on how to successfully contribute to the Coherence .NET extend client. Coding conventions are stylistic in nature and the Coherence style is different to many open source projects therefore we understand the raising of eyebrows. However, consistency is significantly more important than the adopted subjective style, therefore please conform to the following rules as it has a direct impact on review times.
Except otherwise listed below, use the Java Coding Guidelines.
- All source files end in the .cs suffix.
- Use the .NET "
#region/#endregion
" instead of the "// ----- xxx -----...
" style to separate logical sections
- Each class, method and data member must be preceded by a .NET style comment.
- All interface names must start with "I" (uppercase i). For example:
IOperationalContext
The following rules apply to how objects should inherit from base classes:
- Always inherit Object virtually.
- Always inherit interfaces virtually (interfaces are pure virtual and must have an empty constructor).
- Avoid virtual inheritance except for the above two use cases.
-
Each indent consists of 4 spaces (no literal tabs).
-
Curly braces are on their own line, not indented from the parent (Visual Studio default setting). This is different than the Java coding guideline.
-
Source lines within the curly braces must be indented 4 spaces (Visual Studio default setting). This is different than the Java coding guideline.
-
Each indent consists of 4 spaces (no literal tabs).
-
Curly braces are indented from the parent and on their own line.
-
Statements that may span multiple lines must be enclosed in braces (e.g. if/for/while/try). This implies that there must never be one or two line if blocks.
if (condition)
{
code...
}
- Coherence .NET source DOES NOT use type prefixes for variable names
- Good
int count;
- Bad
int nCount;
Visual Studio 2008 or later