views:

253

answers:

3

Are there a lot of IT shops utilizing FxCop for writing production code? If so, what was/is your overall experience implementing it in terms of culture shift, pain points, and tangible benefits?

I am in an environment that is somewhat chaotic and looking for tools to help us standardize our development efforts and get us home at a decent hour. I want to avoid egg on my face for pushing a static analysis tool only to have it fail because it’s “not practical”. <- (Anticipated management response)

+3  A: 

I'd say there aren't that many places really using FxCop. We have it turned on, but most of the dev staff ignores the warnings produced.

Also, Dev Management here hasn't been interested in really pushing cleaning up the warnings, in part because FxCop really dislikes the conventions (variable names, etc) that management wants us to follow...

On projects where I've been the lead, I've mandated its use because I think it helps us be better programmers. But you have to have by in at the top in order to get all the dev's to follow it.

Chris Lively
"aren't many places really using FxCop", I'd love to see the reference to the usage statistics that you base this observation on?
jerryjvl
Negative Nancy, relax! There is not any usage statistics, hence my question. For me, this is a good answer as I am looking for real world experiences and best practices. This is his experience and I am grateful he answered the question!
Zaffiro
@jerryjvl: As far as statistics goes, I only have my own experience to talk about. Just going back over the past 3 years (I'm a contractor) I've done work for about 6 or so clients. Of those, only 2 had other dev's that bothered reading the warnings even though all had them enabled. The only reason those 2 read the warnings was quite frankly because I was running the projects.
Chris Lively
I didn't mean that to sound hostile; it is just that unqualified statements like that without specific numbers are by definition a bit suspect. Besides, it's a much stronger answer with the detail added that you just gave in your comment ;) (that's a suggestion you add the specifics to the answer proper ;)
jerryjvl
+3  A: 

Note that FxCop is very customisable with regards to the rules you wish to apply. You may find it works best by incrementally introducing it; only for a certain set of rules for a certain set of files, or even excluding all legacy files initially.

There are bound to be rules that you may never activate because they just do not suit your problem domain. And remember that if a piece of code 'breaks a rule' for a specific purpose, there is an attribute to mark such code as acceptable, although I would instate a rule that all such overrides must use the Justification property on the attribute to indicate why.

Finally, as much as the built-in rules will help a lot with improving code quality, the really big wins are to be had in custom rules that will allow you to check for company conventions. If you do not automate your 'peer review' in this fashion, then you cannot really guarantee compliance.

I use FxCop as an integrated part of the build system at work, and our common libraries currently get released with all rules enabled with minimal attribute overrides, and it has been worthwhile in more than a few places.

jerryjvl
A: 

Probably not. There aren't many rules in the app and most senior devs who are good at what they do know them. I am trying to push for it to be used where I work as most of the devs are rubbish.

dotnetdev