问题
I have written an application with approximately 500 classes in java , Now I know this has been asked plenty of times here, but I still couldn't find a proper resource or tutorial for creating a data flow diagram for my entire project.
Any help/tutorial/resource or code sample would be appreciated.
回答1:
You might be able to derive data flows from your unit tests. If you have a instance A
and a mock B
and you expect instance C
to be passed in as a prameter to B.bar(Object)
when you call A.foo(C)
. In such cases you get data flow from one object to another.
The second thing to do is to inspect you application configuration. If you find that instance D
is configured with instance E
, which itself is configured with instance F
you can chain together the data flows, that you have derived from your unit tests.
But i don't know of any implementation for this. But both parts seem to be relatively easy to implement. In the first part you need to hook on to your mocking framework. The second part is easy if you are using dependency injection.
EDIT:
If you got all that data together, you can for example use the Eclipse UML API to create the diagrams.
回答2:
Here is another try on that using Eclipse:
MoDisco is able to create an emf model of your Java project. That emf model will be the basis for creating the data flow diagrams. With ATL you can transform that model into an appropriate model for visualization. For visualization you can either choose an UML activity diagram. That has the advantage of being able to work with existing UML technologies. Another possibility is to use Zest or GraphML and yEd to create a visualization.
回答3:
Grab full version of IntelliJ idea - it has data flow diagramms and other nice analyze tools. You will get 30 day license on the sport so you can see it this is option for you.
来源:https://stackoverflow.com/questions/12743107/how-to-create-data-flow-diagram-for-java-source-code