Flylib.com

Books Software

 
 
 

Professional Visual Studio 2005 Team System (Programmer to Programmer) - page 72


Summary

The SDM captures the basic invariant structure and behaviors of a system in a self-contained model. It provides the scaffolding to which other information can be applied. This may include deployment information, installation procedures, configuration schemas, automation tasks , events and instrumentation, health models, and operational policies. Additional information can be added across the lifetime of the distributed system by vendors , the operations staff, and/or management.

Through the SDK, the SDM encourages the creation of reusable, prescriptive models that can be easily incorporated into the application or hosting environment of Team Architect.

Visual Studio will extend design for deployment by enabling production deployment and operations management of distributed applications.



Part II: Team Developer

Chapter List

Chapter 8: Managed Code Analysis
Chapter 9: Code Analysis for C/C++
Chapter 10: Application Verifier
Chapter 11: Refactoring and Code Snippets
Chapter 12: Profiling and Performance



Chapter 8: Managed Code Analysis

Overview

In this chapter and the next , we describe the code analysis features included with Visual Studio Team System. These tools can quickly and easily inspect your code to find common mistakes, suggestions for improvements, and even violations of standards.

In this chapter, we'll focus on analyzing managed code, such as C# and VB.NET. If you're working with C or unmanaged C++, turn to Chapter 9, where you will learn how to analyze native code.

We begin by discussing the origins of the Static Code Analysis tool. We'll introduce Microsoft's .NET Design Guidelines for Class Library Developers and describe how it is related to the tools.

Then we will describe the tool itself and how to take advantage of its full integration with Team System. This includes enabling Static Code Analysis review for your projects, selecting rules to apply, and working with the results of the analysis.

However, using the IDE is not always an option and sometimes you need additional flexibility. The Static Code Analysis tool is available to you from the command line. You will also learn how to use the command line for code analysis and how to include code analysis with your automated builds.

The Static Code Analysis rules that ship with Team System will probably not be sufficient for the specific standards and practices of your own projects. To address this, we will also describe how you can create and integrate new custom rules. We begin by describing the mechanics of rules, introducing the new Introspection engine. You will then create an example rule using introspection and call it from the Visual Studio IDE.



The Need for Analysis Tools

Ensuring that developers follow best practices and write consistent code is a major challenge in today's software development projects. The act of documenting standards and practices is often skipped or overlooked. However, even in projects for which standards have been established, getting developers to read and follow those practices is another major challenge.

One of the best resources available for .NET developers is Microsoft's .NET Framework "Design Guidelines for Class Library Developers." These guidelines document Microsoft's (formerly) internal practices for developing class libraries and are freely available at http://www.msdn.microsoft.com/library/en-us/cpgenref/html/cpconnetframeworkdesignguidelines.asp.

The guidelines cover a wide range of subjects, including naming conventions, usage guidelines, and performance and security considerations. The importance of these guidelines cannot be overstated. When put into practice, they help ensure that your approach will be consistent with that of other developers. In addition, they have evolved over a number of years to reflect a considerable amount of knowledge, best practices, and lessons learned.

As useful as the design guidelines are, the reality of software creation is that many developers, due to lack of time or perhaps of interest, will not be familiar with their contents. The desire to automate the process of evaluating code for compliance with these guidelines led to the creation of FxCop.