Difference between revisions of "Front-End Standard"
Line 13: | Line 13: | ||
=== Coloring & Emphasis === | === Coloring & Emphasis === | ||
Blue: Text colored blue indicates a keyword or .NET type. | Blue: Text colored blue indicates a keyword or .NET type. | ||
+ | |||
Bold: Text with additional emphasis to make it stand-out. | Bold: Text with additional emphasis to make it stand-out. | ||
=== Keywords === | === Keywords === | ||
Always: Emphasizes this rule must be enforced. | Always: Emphasizes this rule must be enforced. | ||
+ | |||
Never: Emphasizes this action must not happen. | Never: Emphasizes this action must not happen. | ||
+ | |||
Do Not: Emphasizes this action must not happen. | Do Not: Emphasizes this action must not happen. | ||
+ | |||
Avoid: Emphasizes that the action should be prevented, but some exceptions may exist. | Avoid: Emphasizes that the action should be prevented, but some exceptions may exist. | ||
+ | |||
Try: Emphasizes that the rule should be attempted whenever possible and appropriate. | Try: Emphasizes that the rule should be attempted whenever possible and appropriate. | ||
+ | |||
Example:Precedes text used to illustrate a rule or recommendation. | Example:Precedes text used to illustrate a rule or recommendation. | ||
+ | |||
Reason: Explains the thoughts and purpose behind a rule or recommendation. | Reason: Explains the thoughts and purpose behind a rule or recommendation. | ||
+ | |||
== Terminology & Definitions == | == Terminology & Definitions == | ||
Line 32: | Line 40: | ||
=== Camel Case === | === Camel Case === | ||
A word with the first letter lowercase, and the first letter of each subsequent word-part capitalized. | A word with the first letter lowercase, and the first letter of each subsequent word-part capitalized. | ||
+ | |||
Example: customerName | Example: customerName | ||
Line 39: | Line 48: | ||
=== Identifier === | === Identifier === | ||
A developer defined token used to uniquely name a declared object or object instance. | A developer defined token used to uniquely name a declared object or object instance. | ||
+ | |||
Example: public class MyClassNameIdentifier { … } | Example: public class MyClassNameIdentifier { … } | ||
=== Pascal Case === | === Pascal Case === | ||
A word with the first letter capitalized, and the first letter of each subsequent word-part capitalized. | A word with the first letter capitalized, and the first letter of each subsequent word-part capitalized. | ||
+ | |||
Example: CustomerName | Example: CustomerName | ||
Line 56: | Line 67: | ||
=== Naming Conventions === | === Naming Conventions === | ||
* “c” = camelCase | * “c” = camelCase | ||
+ | |||
* “P” = PascalCase | * “P” = PascalCase | ||
+ | |||
* “_” = Prefix with _Underscore | * “_” = Prefix with _Underscore | ||
+ | |||
* “x” = Not Applicable. | * “x” = Not Applicable. |
Revision as of 10:18, 26 April 2015
Contents
Introduction
This document describes rules and recommendations for developing applications in .NET and class libraries using the C# Language. The goal is to define guidelines to enforce consistent style and formatting and help developers avoid common pitfalls and mistakes.
This document covers Naming Conventions, Coding Style, Language Usage, Object Model Design and Tips for developers.
Document Convention
Much like the ensuing coding standards, this document requires standards in order to ensure clarity when stating the rules and guidelines. Certain conventions are used throughout this document to add emphasis.
Below are some of the common conventions used throughout this document.
Coloring & Emphasis
Blue: Text colored blue indicates a keyword or .NET type.
Bold: Text with additional emphasis to make it stand-out.
Keywords
Always: Emphasizes this rule must be enforced.
Never: Emphasizes this action must not happen.
Do Not: Emphasizes this action must not happen.
Avoid: Emphasizes that the action should be prevented, but some exceptions may exist.
Try: Emphasizes that the rule should be attempted whenever possible and appropriate.
Example:Precedes text used to illustrate a rule or recommendation.
Reason: Explains the thoughts and purpose behind a rule or recommendation.
Terminology & Definitions
The following terminology is referenced throughout this document:
Access Modifier
C# keywords public, protected, internal, and private declare the allowed code-accessibility of types and their members. Although default access modifiers vary, classes and most other members use the default of private. Notable exceptions are interfaces and enums which both default to public.
Camel Case
A word with the first letter lowercase, and the first letter of each subsequent word-part capitalized.
Example: customerName
Common Type System
The .NET Framework common type system (CTS) defines how types are declared, used, and managed. All native C# types are based upon the CTS to ensure support for cross-language integration.
Identifier
A developer defined token used to uniquely name a declared object or object instance.
Example: public class MyClassNameIdentifier { … }
Pascal Case
A word with the first letter capitalized, and the first letter of each subsequent word-part capitalized.
Example: CustomerName
Premature Generalization
As it applies to object model design; this is the act of creating abstractions within an object model not based upon concrete requirements or a known future need for the abstraction. In simplest terms: “Abstraction for the sake of Abstraction.”
Flags
The following flags are used to help clarify or categorize certain statements:
Quick Summary This section contains tables describing a high-level summary of the major standards covered in this document. These tables are not comprehensive, but give a quick glance at commonly referenced elements.
Naming Conventions
- “c” = camelCase
- “P” = PascalCase
- “_” = Prefix with _Underscore
- “x” = Not Applicable.