Coding standards for .NET

Coding standards for .NET

What do coding standards do for you? Well, the most important thing is that they ensure your code will be compatible with other code that runs in your target environment. Without standards, the world of coding languages would be a veritable tower of Babel. So it is with .NET, but more so. In .NET, you can use a lot of different languages, so standards are more important than ever. This tip, excerpted from InformIT, discusses some of the coding standards issues in .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.

NOTE

    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

    Requires Free Membership to View

    When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to provide a unique online resource for developers, architects and development managers tasked with building and maintaining enterprise applications using Visual Basic, C# and the Microsoft .NET platform.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchWinDevelopment.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchWinDevelopment.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

    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.

NOTE

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.


To read the entire article from which this tip comes, click over to InformIT. No registration, no muss, no fuss; just good info.


This was first published in September 2003

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.