views:

123

answers:

2

Hi,

recently I was given the task to discover a C# solution I have never seen before, and give suggestions on refactoring it. I think I will use NDepend (for the first time ever) to see the overall picture, and also to check a lot of code metrics to figure out what could be refactored. NDepend is pretty good at showing the structure of a project, I think.

My question is a more general one: what do you think is the best way to discover code that you are seeing the first time, and need to understand it's structure? (Unfortunately there is no logical design documentation and the code is poorly commented.)

+2  A: 

I frequently use Reflector to study third-party assemblies as well as .NET assemblies. Not so much for a bird's-eye view of the relations between classes, but a more for close-up detail of exactly what is going on.

Joel B Fant
Yes, NDepend can actually work together with Reflector. If you select a method in NDepend, you can right click and go to Visual Studio or Reflector right away and see the code.
Sandor Davidhazi
Yay for tools that work together.
Joel B Fant
+4  A: 

Code Discovery is much more easy with NDepend. This tool provides a top-down approach on dependencies and layering between assemblies, namespaces and classes. This is done with some graph and depednencies matrix generated from the code.

You'll also get dependencies on tier code assemblies, which is really useful to know which part of the code does what.

Also, some graphical representation of volume metrics such as # lines of code helps a lot to get a clear idea of where the effort where done on the code.

Patrick Smacchia - NDepend dev