Franc Stratton's .NET (TM) Web Application, OOP, and SOA Architecture & Programming Site

A site devoted to ASP.NET (TM), SilverLight (TM) and Browser-Based WPF (TM) Applications, IIS Services, and OOP Architectures

Home     .NET Security     Standards     Data Store     Windows Form Apps     WF/WCF/WPF     jQuery     C# Developer Corner     Java Development     Site Map      
Code Formatting
Code Notation
Passing Parameters
LINQ
AJAX
Database
SDLC (ALM)
ASP.Net Callbacks
SuggestedTraining
Code Notation Policy

The types of code notation used by a development group are the Camel and Pascal notation standards.

1. Instance private member field and method variables/fields and parameters: Use Camel notation (e.g., myVariable).

2. Web/Windows controls variables: Use Camel notation (e.g., btnSave).

3. All other public and protected identifiers for properties and methods: Use Pascal (e.g., MyClass).

4. Other code notation standards.
    • Do not use Hungarian notation except for component naming on a form (e.g., “txtLastName” is okay for a textbox name on a form, but don’t use “iNumber” for a   an integer variable or “oOjbect” for an object variable in a program.) See Table 3 below.
    • Do not use a prefix for member variables (_, m_, s_, etc.). If you want to distinguish between local and member variables you should use “this.” in C# and “Me.” in VB.NET.
    • Do use camelCasing for private member variables
    • Do use camelCasing for method parameters
    • Do use camelCasing for local variables
    • Do use PascalCasing for function, property, event, and class names
    • Do prefix interfaces names with “I”

Hungarian Prefix Connotation Example:
    txt Text Box txtLastName
    lbl Label lblMessage
    opt Option or Radio Button optChoice1
    chk Check Box chkCheck1
    ddl Drop Down List ddlSelections


Table 1: Hungarian Notation for Form Control Names

Identifier Notation Example:
    Class Pascal: Car
    Constant Pascal: MaximumValue
    Delegate Pascal: ChangeInformation
    Enum Type Pascal: ColorChoice
    Enum Value Pascal: OnlyBlack
    Event (Delegate) Pascal; ChangeDirection
    Event Handler Pascal OnChangeDirection
    Exception Pascal OutOfOrderException
    Static Member Variable Pascal ThisValue
    Interface Pascal IEngine
    Public Method Pascal StopEngine()
    Namespace Pascal: Enterprise.BusinessRules
    Property Pascal: RadiatorCap

Pascal notation is written as: “ThisIsPascal” (multiword) or “Pascal” (single word). The standard acknowledges the use of Pascal notation for class, constant, delegate, enum type, enum value, event, event handler, exception, static member variable, interface, method, namespace, and property.