Thursday, September 4, 2008

Coding and Design Guidelines

A coding standard is a set of guidelines, rules and regulations on how to write code. Usually a coding standard includes guide lines on how to name variables, how to indent the code, how to place parenthesis and keywords etc. The idea is to be consistent in programming so that, in case of multiple people working on the same code, it becomes easier for one to understand what others have done. Even for individual programmers, and especially for beginners, it becomes very important to adhere to a standard when writing the code. The idea is, when we look at our own code after some time, if we have followed a coding standard, it takes less time to understand or remember what we meant when we wrote some piece of code.

C# Coding Guidelines

Here are a number of article that can serve as good reference.

http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=336
http://blogs.msdn.com/ericgu/archive/2004/01/19/60315.aspx
http://www.tiobe.com/standards/gemrcsharpcs.pdf

Design Guidelines for Class Library Developers

The .NET Framework's managed environment allows developers to improve their programming model to support a wide range of functionality. The goal of the .NET Framework design guidelines is to encourage consistency and predictability in public APIs while enabling Web and cross-language integration. It is strongly recommended that you follow these design guidelines when developing classes and components that extend the .NET Framework. Inconsistent design adversely affects developer productivity. Development tools and add-ins can turn some of these guidelines into de facto prescriptive rules, and reduce the value of nonconforming components. Nonconforming components will function, but not to their full potential.


These guidelines are intended to help class library designers understand the trade-offs between different solutions. There might be situations where good library design requires that you violate these design guidelines. Such cases should be rare, and it is important that you provide a solid justification for your decision. The section provides naming and usage guidelines for types in the .NET Framework as well as guidelines for implementing common design patterns.

Refer MSDN for design guidelines above at http://msdn.microsoft.com/en-us/library/czefa0ke.aspx

No comments: