views:

127

answers:

2
+5  Q: 

Understanding code

What is the best way to get acquainted with C# codebase of approximate size 200K LOC? Are there any tools available?

http://www.program-comprehension.org/ It seems there is an event going for a long time for this purpose.

Thanks.

+5  A: 

CodeCity has a really nice visualisation of a codebase; it uses the metaphor of a city which makes a lot of sense, as well as highlighting code smells usefully.

ndepend.com is pretty good for an overview.

Atomiq has a nice visualization for duplication. It parses your code-base and visualises it via a wheel, where duplications are represented by spokes in the wheel and you can hover over each to see the side-by-side diff.

Nitriq has a nice LinqToCode kind of thing to enforce quality constraints. You can run these rules from the command line as part of a build-process.

ReSharper's navigation features are invaluable for finding out what uses what. Find-Usages is terribly useful. For exploring a codebase, Alt+F7 is your friend, since it will also keep open a history of queries that you've run, so you can jump back and forwards in it to keep your place.

Visual Studio keeps a record of cursor positions / editor points and has ctrl+- and ctrl+shift+- to move the cursor back and forward between these.

You can insert notes to yourself if you decide on a comment that's conventional (for example // NOTE: blah) and then use ReSharper's TODO Explorer to find all such comments (and other patterns that you might define), then navigate to them. We use that for code-reviews at the moment, for example.

Visual Studio (at least, the Professional Edition) can generate a class diagram; multi-select files, and right-click then create a class diagram. I find these more useful as a scribble as opposed to an artefact to keep up to date and in sync with the codebase, though, frankly. It will tell you inheritance, but not show implements-interface very clearly, and won't even try to show collects, or composed-by.

Peter Mounce
+1 You should add some more information to your answer and it would be a lot better :).
Henrik
+1 for NDepend; it will show you the structure at each level (assemblies, classes, methods or any combination).
Joel in Gö
@Henrik if you added some more information to your comment about how I could add more information to my answer to make it better, it would be a lot better :):-P
Peter Mounce
I just wanted a more of your writing. You write inspiring prose.
Henrik
I was inspired by your comment ;-)
Peter Mounce
+1  A: 

As @Peter Mounce suggests, NDepend is good and you can use it for free for non-commercial uses. You get a lot of nice visualisations like dependency graphs which help you get an overview of what's going on.

Visual Studio 2010 also contains similar tools in the form of the Architecture Explorer, although I think you need the architecture addition (or above) to get that. But it's interactive and lets you drill down into into the structure which is useful.

Grant Crofton