You are here -> Home > Developer Center > Increasing performance with good coding practices

Increasing performance with good coding practices
By: Jason Nowicki This article has been viewed 206 times.

In this article I will be talking about using Microsoft's FxCop 1.36 Beta. Before I get into the details you can download the program here. Okay let's get started.

So what is FxCop anyways? FxCop is a program that Microsoft developed to help developers make sure they are using proper coding practices as well as provide ideas as to how things could be coded differently to increase performance and interoperability.  At this point you may be saying to yourself, "I'm a good programmer, what do I need this for?" Well, I asked the same thing until I ran the program the first, needless to say, it was a humbling experience. Okay, enough of the fluff, let's get down to business.

Installation

The installation is pretty straight forward so I won't spend any time on that. As my supervisor would say, "It's a spouse based install, just keep answering yes."  If you need the program just use the download link above.

First Time Run

Go ahead and open FxCop 1.36 Beta, it should be located on your start menu. Once open it won't look like much.

If you click the Rules tab you can view all the rules that will be applied to any program you run this against.

You will learn about all these rules as you use them. What I've learned so far is that I don't need Mobility, Interoperability or portability, so I uncheck those. The next thing to do is to choose a program to run FxCop against. On the Projects menu option, choose Add Target. Go ahead and locate the .Net program you want to run FxCop against. Once you have your program selected it will show up in the Targets window.

FxCop will allow you to inspect your program by expanding the tree nodes. If you want to avoid a truck load of messages uncheck any datasets that you may have in your project. I don't have any in this project so I'll run it as is. Now all you have to do is click the Analyze button on the toolbar menu and watch the issues accumulate. Once it's done analyzing your program it will display a list of potential issues, categorized by Breaking, Non Breaking or Depends on Fix. The ones you probably want to look at are the Breaking ones first, as these could cause your program to fail.

When you want to learn more about an issue, just click on the issue and in the bottom part of the program there will be a description with a link to a MSDN page that will give you more details about the fix and the cause of the problem.

This program has given me plenty of hours of fun. I hope it helps you have as much fun as I have fixing all my issues.

Happy Coding.

How helpful was this article?