views:

260

answers:

6

I don't intend this to be subjective, but if the answers can be seasoned a little with advice or direction I would appreciate it :)

Over the past couple years my job has been to develop and now maintain/extend a fairly large application. The application was among the first .NET projects ran by our department and for nearly the whole development team it was a huge learning curve. Since it was a new experience for nearly everyone we have laid down some ugly code--actually "some" is more like "probably a few hundred thousand lines".

Our team how now matured for the most part and we are realizing our faults pockmark the application, and that maintaining in its current state is nearly as difficult as the arcane VB6 app which it replaced. Thankfully the decision-makers realize that we need to remedy our errors, however we are behind the 8-ball with much of our developers working either on scheduled feature enhancements (a necessary evil in our line of business) or on side-projects.

We are working with .NET 2.0, VS2005 (hopefully migrating to 2008), TFS 2005 (moving to 2008 soon)

  • What tools are available to assist us in enforcing coding standards (I am reviewing Juval Lowy's C# standards and transcribing them for VB.NET)

  • What tools are available to help us identify components which are poorly designed?

  • What tools are available to help us map our currently jumbled namespaces?

I might extend this with more questions as I think of them, or as responses spark a synapse.

new - Are there any tools that work directly against TFS to assist in analyzing our code?

+5  A: 

The first thing to do is to make sure you have adequate unit test coverage. If you've got this you can then refactor and recode while still ensuring that your app still works.

Code standards - have you looked at FxCop or something similar?

There's also StyleCop - C# only though

ChrisF
Thanks for the tip on StyleCop; we have VS2005 for Teams which includes built-in FxCop testing. Unit testing is a dirty phrase around here, our project lead doesn't quite grasp the "test one thing only" concept and managers cringe when we mention that adding unit tests or doing TDD would add extra development time up front but save time in the long run--they don't have much faith since our timelines are always overrun (ironic, no?)
STW
Been there, done that, don't want to do it again ;)
ChrisF
oh boo, StyleCop is C# only, still something I'll keep in my personal toolbelt though. Maybe one day I'll get the green-light to write some of the architecture in c#
STW
Sorry - missed that you were working in VB.NET
ChrisF
+5  A: 

Get ReSharper! It has code cleanup tools that can help immensely - including notifications for violations of coding standards.

I also agree with ChrisF's recommendation that you implement Unit testing to ensure that changes do not break that application. Resharper can help with this as well as it has a built in tool for running single or multiple Unit tests right from within Visual Studio.

Mark Brittingham
Thanks for the tip on ReSharper, I'll definately check it out
STW
You're welcome. It has made a tremendous difference in my coding practices - all for the better. BTW - I have FxCop but ended up not using it as ReSharper did enough that I didn't need FxCop. Still I do recommend that you check it out as well, especially if you don't have the $$ for ReSharper.
Mark Brittingham
+4  A: 
  • For checking coding standards you can use FxCop
  • To get an overview over your design have a look at ndepend
  • Generally a powerful refactoring tool like the resharper will help you
tanascius
Thanks for the tips on nDepend and ReSharper, I wasn't familiar with either
STW
+1  A: 

Resharper hands down.

and make the background color setting hot pink.

Chad Grant
If it forced everybody to use the ZenBurn color theme then you'd be my hero :D ...but hot pink? my corneas have treated me well so far but they might just up and die if I put them through 60 hours of that a week :)
STW
A: 

Since you mentioned you are using VS Team System and will soon be migrating to VS 2008, definately take a look at the built-in code analysis (FxCop) and code metrics. You can also use NDepend for your code metrics as well. One thing to keep in mind is that the built-in code analysis uses slightly different rules than the stand alone version of FxCop. FxCop (or the built-in code analysis) can also generate a lot of "noise" and some rules are more important for public facing (API) code than for non-public facing code.

StyleCop is good for source code style issues, although it can generate a lot of "noise" and some of the rules are less important than others. (Such as the code "layout" rules that say private methods should come after public, etc. The biggest thing to keep in mind as far as code formatting is that it should be consistent.)

For mapping the current namespaces, you can use the built-in class diagrams, although I think NDepend may do a better job at giving you a more overall picture.

As far as I know, there are no tools that will work directly against a TFS repository. You would need to checkout the code locally, run the tools and then check it back in.

You also mentioned that you were looking at the IDesign code style document. You should also take a look at the Framework Design Guidelines, which is what the IDesign stuff is based on. The IDesign guidelines are good, but I don't agree with all of them.

Scott Dorman
Thanks for the tips, I'll be the code-churn hero (although I'm proud that between my cleanup and new development I still manage to shrink our codebase, but then again some other developers make it reaaaally easy)
STW
A: 

As many have said Resharper helps drastically reduce some redundancies and general bad practices. I just downloaded another tool CloneDetective which is supposed to help identify duplicate code. Together the two seem like a powerhouse. But I have yet to review clone detective.

Pat
Looks like it's C# only, but I'll still check it out for other purposes. Thanks for the tip
STW