Coding Standards

Welcome to the official coding standards guide for the Microsoft Developer Network (MSDN). Adhering to these standards ensures consistency, readability, maintainability, and high quality across all MSDN documentation projects.

1. General Principles

2. Naming Conventions

2.1 Variables and Parameters

2.2 Functions and Methods

2.3 Classes and Constructors

2.4 Constants

3. Formatting and Indentation

3.1 Indentation

3.2 Braces

if (condition) {
    // code block
} else {
    // another code block
}

3.3 Whitespace

3.4 Line Length

4. Comments and Documentation

4.1 Single-line Comments

4.2 Multi-line Comments

4.3 JSDoc

/**
 * Calculates the sum of two numbers.
 * @param {number} a The first number.
 * @param {number} b The second number.
 * @returns {number} The sum of a and b.
 */
function add(a, b) {
    return a + b;
}

5. Error Handling

Best Practice: Always validate input parameters to prevent unexpected errors.

6. Version Control (Git)

7. Code Reviews

By adhering to these coding standards, we can collectively build robust, maintainable, and high-quality documentation and code for MSDN.