Paul Ulvinius Blog

From one developer to another

Archive for August, 2007

Use FxCop to enhance your .NET code

Posted by paululvinius on August 11, 2007

I finally dusted off my copy of Microsoft FxCop (a program that analyzes your assemblies with reflection and finds out more stuff about your code than you probably want to know). The best thing about this tool is that its really clever. It analyzes design, performance, naming conventions, security and localization. It thereby covers many steps in the project life-cycle. During design, it can help you with design implementation decisions. During implementation it can help you with code optimization and see to that you follow naming conventions for managed code. During testing it can function as a complement to static testing / code review. Run it on your assemblies from time to time, I bet it will help you find some nasty bugs.

By following the naming conventions, you not only make sure we speak the same programming language, but also the same “dialect” if you will. They are formed to increase readability and maintainability and by implementing them you also tend to write more consistent code.

Of course, its a lot about making a decision about what rules are reasonable in a given project. But even in the process of doing that, you will find yourself considering some questions that are easily forgotten. If nothing else, it can be an educational trip to the Microsoft .NET Framework Design Guidelines which the tool is based upon.


Posted in Uncategorized | Leave a Comment »