Looking for a tool to help me analyze and understand others' code [closed]

匿名 (未验证) 提交于 2019-12-03 02:59:02

问题:

I am looking for a tool to help me to more quickly grasp someone else's code. Usually I am working with 10-15 method call chunks scattered across 3-5 modules (DLLs or .NET assemblies). What I am after is a tool which could be used to draw an annotated call diagram in 10-30 minutes.

I think it should look like a some kind of combination of a workflow and combination UML diagrams without the monstrosity of UML editors. Just drop a dozen rectangles on the screen, add a method name to each (and optionally: module name, parameters, etc). Add a quick note what this method does, what goes in, what goes out, etc. Then connect these figures (rectangles) with a different looking arrows to indicate which type this method call is: simple call, a call which returns nothing, remote call, etc.

The important thing - the tool should be easy to use. Otherwise, I could just fire up MS Word and draw it there. But that is not going to be an easy task.

Thanks.

回答1:

It sounds like what you are looking is for a lightweight UML-like drawing tool.

There are quite a few that are being developed in academia, which use handwriting recognition and such so you can sketch but a fully-functional model is formed.

If you're just looking for a quick drawing tool, Word is not very convenient, I'd consider using Visio on PC, or OmniGraffle if you're lucky enough to use a mac. These are drawing programs, but easier to use than UML modelers.

There is a doctoral student at Carnegie Mellon whose research is focused on helping people understand control flow in applications and he's building a tool, but as far as I know it's not released yet.



回答2:

Tool is Doxygen

You can get reports like: alt text http://www.dcl.hpi.uni-potsdam.de/research/WRK/wp-content/uploads/2007/05/doxygen_wrk_cgraph.png



回答3:

Red Gate's .NET Reflector is a popular free tool for debugging, reverse-engineering and such.

To compliment it, there are several handy add-ins (also free) which will help you visualize with diagrams:

  1. Graph
  2. SequenceViz (Note that this is kind of tedious to install and configure. You will need to install the Win32 port of GNU PlotUtils first, and it isn't very clear in the instructions.)


回答4:

Visio is pretty easy to use if you're on Windows, but it'll cost you.

I've heard that ArgoUML is good, but it might be more complex than you're hoping.



回答5:

You don't mention which language you're dealing with, so I'll go with one generic answer, and one for C#.

WithClass looks like it does what you're looking for, no matter what language:

[...] allows you to draw UML Diagrams, generate code, and reverse engineer popular OO languages.

Reverse engineer C++. Java, Delphi, VB, IDL, Perl, PHP, C#, and VB.net.

For refactoring C#, IMO nothing beats ReSharper.



回答6:

The most useful tool I have ever found for performing this and many other kinds of code analysis is NDepend. It has lots of great analysis out of the box and you can even write queries in a SQL-like dialect CQL (Code Query Language) to get at specific information.

The creator, Patrick Smacchia also blogs and provides additional insights on how to use the tool.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!