Game Development Reference
In-Depth Information
chapter 13
Enforcing Coding
Policies with FxCop
The trouble with programmers is that you can never tell what a programmer
is doing until it's too late.
Seymour Cray
People write bad code. It is a common reality, and poorly written code can lead to
many maintenance and design issues. Microsoft realizes this and has presented a
couple of well thought out solutions, such as the Design Guidelines for Class
Library Developers , which helps promulgate best practices and coding standards to
maintain consistency among .NET assemblies. Having a set of guidelines can do
wonders if developers follow them in an almost religious fashion. However, this is
not always the case, and many times source code deviates from the proposed
norm. This prompted Microsoft to create the FxCop utility, which tests .NET code
to confirm that it follows the best practices and design guidelines.
The developers of FxCop could have designed the tool to perform conformance
analysis at a source code level like most tools of a similar nature, but instead chose
to use the powerful features of the .NET platform to make a tool that performed
analysis on a much grander scale. Rich and extensible meta-data concepts along-
side powerful reflection support, MSIL parsing, and call-graph analysis allow for
the inspection of many different areas of your software instead of just analyzing
source code. FxCop looks for over 200 different defects and issues in regards to
library design, naming conventions, localization, security, and performance. There
is also an SDK that allows you to write custom rules to enforce conventions specific
to your needs.
129
Search Nedrilad ::




Custom Search