转自:A List of Coding Standard Websites
注:已将Google的编程规范(google-styleguide)整理进相应的列表。
Why follow a coding standard? Standardize coding practices allow code to be more easily read by other programmers. Just imagine if you inherited code that was labeled as follows:
string b;
int flag1;
int flag2;
This might look like the code you wrote when you wrote your first program. However, if you saw this coding style in a professional environment you might have a difficult time understanding the meaning behind the variable names.
Coding standards are not necessarily dictated by the creator of the language. Many have just evolved into standards among the programmers who use the language.
I have compiled this list of several coding standards and styles. If want to start adhering to coding standards, I suggest you start with the official standards (if available). Also, check with your organization to see if they have a coding standards document already created.
.NET (C#/VB.NET)
- Design Guidelines for Class Library Developers
- C# Coding Standards and Best Programming Practices
- C# Coding Standards and Best Programming Practices (.doc)
- C# Coding Standards Document
- VB.NET Coding Standards (.doc)
- .NET Naming Conventions and Programming Standards
PHP
C/C++
Python
- Google Python Style Guide
- PEP 8 — Style Guide for Python Code
- PEP 257 — Docstring Conventions
- How Not To Write Python Code
Java
Ruby
HTML/CSS/Javascript
- HTML Coding Guidelines
- Google HTML/CSS Style Guide
- CSS Coding Standards (via coffeepowered.co.uk)
- CSS Coding Standards (via drupal.org)
- CSS Coding Conventions (via phpied.com)
- Google JavaScript Style Guide
- Code Conventions for the JavaScript Programming Language
- JavaScript Coding Standards (via drupal.org)
- JavaScript Coding Standards (via brevardcounty.us)
Objective-C
- Google Objective-C Style Guide
- Introduction to Coding Guidelines for Cocoa
- Cocoa Style for Objective-C
If I left out your favorite programming language, check out the Coding Conventions for languages at wikipedia.
Do you know of any other coding standards resources that I should include in the list above? Please share in the comments.