.NET Coding Standards
- Determining Coding Standards for .NET
- Sample .NET Coding Standards
This is the fourth article in a series about coding standards. If you want information about the purpose of coding standards, I invite you to read the first three articles. When determining .NET coding standards for your organization, you can use the sample standards in this article as a starting point. Earlier articles in this series also provide other sources that can help you in your quest to implement coding standards.
Determining Coding Standards for .NET
Apart from the usual purposes for which coding standards are developed, many people using the .NET platform have some other very specific needs with regard to coding standards. The main requirement is ensuring some consistency between the many languages (ever increasing!) that can be used in a .NET environment. In the Java world, JSP is based on the same Java language used by applets, servlets, and EJBs. In a .NET environment, by contrast, it's likely that more than one development language will be used, and it's crucial to realize the effects that these different languages could have on the (lack of) consistency of coding standards. Coding standards must reflect all the languages in the .NET environment.
However, it's also sensible in a corporate environment for standards to dictate which languages a developer may use, limiting the choices in order to ensure maintainability.
The other main requirement for coding standards in a .NET environment is making it easier to convert existing applications (typically written in Visual Basic 5 or 6) to the .NET environment. This is no easy task, as Visual Basic .NET is very different from its predecessors. However, there are some measures that VB coders can take in their existing code to make the transition less painful; for example, explicitly declaring parameters as ByRef or ByVal, and explicitly specifying default properties of objects.
There are a number of places where this issue is discussed on the web. For example:
Fortunately, tools are available to help you with the process of conversion. For example, VB Law applies automatic coding standards to the code and checks the code for Visual Basic .NET compatibility. Visual Basic Code Advisor offers similar facilities, but checks against Microsoft's own best practices rather than your coding standards. Microsoft also provides a guide for porting ASP to ASP.NET.