I hope, you have
already read "Preface"
of my java power tools series. This post summarizes some of tools for drawing
manual diagrams as well as generating diagrams from existing java codebase.
This post would benefit you,
if your answer is "No" for below questions
- UML diagrams are
widely used for software architecture and design documentation. Are you
aware about UML tools, which offer forward engineering, reverse
engineering or roundtrip engineering?
- Forward engineering = First
design using UML diagrams and then generate code from diagrams.
- Reverse engineering =
Generating diagram from code by using static and/or runtime approach.
- Roundtrip
engineering = Forward + Reverse
engineering. UML diagram and Java code are constantly maintained in sync.
- There is a need to maintain
large and complex legacy systems of the enterprise, but system’s
documentation is missing or outdated. Beside that you have insufficient
knowledge of functionality, architecture and code. In such situation do
you use range of tools for visually explore the code or doing impact analysis?
- You are not able
to understand code sequence flow for the given functional use case of
application. Do you know how tools can help to explore code of critical
use cases by generating sequence diagrams on the fly? Well, runtime
reverse engineering tools can expedite you to perform impact analysis of
unknown code, and reduce the bug fix and release cycle time of
applications.
My Favorite Tools
Following are some
of my favorite tools, which evidently supported me while working on tasks like
software architecture and design documentation, impact analysis during
maintenance phase, java legacy systems assessment, etc. So I though to
summarize those in this post along with few demo diagrams generated for Spring Petclinic application
using different tools.
Diagramming Tools
Microsoft Visio - Though
commercial, it is my most favorite tool to draw software architecture and
design diagrams manually. Also you can empower it further by adding stencils
like UML stencils, AWS stencils…
Alternatively
sometimes I use free online web interfaces like,
- http://cacoo.com/ - to create a variety of
diagrams such as site maps, wire frames, UML and network charts
- http://www.gliffy.com/ - to create professional-quality flowcharts, diagrams,
floor plans, technical drawings, and more
Static Reverse Engineering
Tools
This means, such
tools would allow you to generate diagrams from the source code without running
your application.
ObjectAid (Free for class diagram /
Commercial for sequence diagrams)
- It is a lightweight code
visualization tool for the Eclipse IDE. The great features is that, it can
show Java source code and libraries in live UML class and sequence
diagrams that automatically update as code changes.
- My
personal feedback:
Easy to use. I found it highly useful to maintain critical class and
sequence diagrams of software system up-to-date as the code changes.
Architexa (Individual Edition is Free for
3 users for a year / Purchase Commercial Edition)
- One can use it by only
installing Architexa plugin in Eclipse IDE.
- Features - Generate diagrams
from code, Understand and document code from diagrams, Share and
collaborate visually.
- Supported diagrams - Layered
diagram, class diagram, sequence diagram.
- My
personal feedback:
Easy to use. Initially it takes few minutes to build indexes based on the
size of the project source code, but then offers to generate excellent
diagrams from the java code and specifically I love the unique layered
diagrams it can generate.
- Eclipse plugin to generate
package, class, interaction and sequence diagrams from existing java
source code
- My
personal feedback:
Doesn't generate beautiful diagrams, but may be helpful to generate simple
diagrams for some portion of java code.
Runtime Reverse Engineering
Tools
Such tools demand
your application to run, so first of all you need to setup runtime environment
of the application. Then run a functional use case scenario and record
corresponding trace using options (e.g. start and stop recording) given in the
tool. That would generate sequence or class or package diagram for the given call trace, which can
expedite developer to analyze application code of that functional use case
scenario from generated diagram in just few minutes. All in all, such tool are
extremely helpful when developers need to discover and document unknown
codebase for the given functional use case scenarios.
- Features - (1) Flow allows
you to visualise the dynamic dependencies between packages, types and
methods. (2) Flow provides a view of method call progression of all
threads for better understanding of the execution paths. Flow records the
entire execution so that it can be replayed forward but also back in time,
and as many times as needed.
- My
personal feedback:
It's indeed easy-to-getting-started and generates nice
package/class/method level visual diagrams. The tool has remarkable
ability to enable us recording the execution of code flow for the given
use case, and then it can be replayed and visualized through a web
interface. Be aware, the tool is free at this stage and it is likely that
free version will be always offered in future (as per FAQ). However, you never know. So I suggest check its
license, before using it.
Maintainj (7 days Evaluation, then Commercial)
- Maintainj claims
- Generate interactive sequence diagram and captures basic context
information from call trace by running a use case, which helps to
reduce the bug fix and release cycle time of applications; and document
code in minutes.
- Three step
process - (1) Instrument code (2) Generate trace files (3) View diagrams
(you need Eclipse IDE to install Maintainj plugin for analysis of
generated sequence and class diagrams)
- Supports - (1)
JRE 1.4, 1.5, 1.6 and 1.7. (2) Swing, Applets, JUnit (3) Most of
widely used J2EE application servers and Databases
- My
personal feedback:
Personally I found it quite useful for runtime reverse engineering. But
you must be aware that, it has performance penalty to increase server
startup time. So should only use in development/qa environment, but not in
production.
- Both are Free Eclipse plugins
and has runtime reverse engineering ability to generate sequence diagrams
from java source code
- My
personal feedback:
Based on my personal experience, I am skeptical about stability of both
compare to Maintainj. Also Maintainj has more advance features compare to
both.
- Eclipse Diver - The last
release is in Sep-2012, so it doesn't look active anymore. Also there is
major stability issue open for Windows 7 for runtime sequence diagrams
generation and analysis, which is mentioned as not going to be fixed in
near future. Still one may try it in Linux or other than Windows 7
OS.
- Eclipse JIVE - When I tried
it for one of J2EE application, it has taken more than 10 minutes time to
start server and then also eclipse was getting hang sometimes. I tried
with Eclipse Kepler only, and did not check with another Eclipse version!
Forward and Roundtrip
Engineering Tools
- Modelio is an open source
modeling environment (UML2, BPMN2, ...). By installing Java Designer Module (Free), it supports forward and
roundtrip engineering. This module claims to support Java 7 too. Some of
other Free Modules for Modelio are - Pattern Designer,
Hibernate Designer, WSDL Designer, XSD Designer, etc. See reverse engineering using Modelio in action video.
- My
personal feedback:
Modelio claims that reverse engineering feature is also supported in Java
Designer Module Free. But when I installed Java Designer Module, I could not find such reverse engineering option in the Modelio as
given in the available documentation and hence could not evaluate
"Reverse Engineering" feature. I am not sure, if the reverse
engineering related documentation is applicable to the commercial edition
of ModelioSoft! Anyway personally I prefer to use Modelio forward and
roundtrip engineering features only for POC/R&D purpose, but not for
complex software or enterprise application development.
Miscellaneous Tools
- Source code visualizer,
specifically can be useful to review and analyze complex conditional logic
flow within particular method of java class.
Below are
miscellaneous tools, which I consider sometimes for generating diagrams from
java code to represent internal and external dependencies of software
components.
Final Thoughts
- Use applicable tools to
generate diagrams from java code & accelerate productivity to
understand/analyze the code.
- Keep software architecture
and design documents up-to-date by adoption of appropriate tools.
Updates History
- 28/Dec/2014 - Added
JArchitect in Miscellaneous tools section
- 19/Jun/2016 - Added Flow tool (as per comment of Yiquan Zhou) in runtime reverse engineering tools section.
Disclaimer
I am not biased to
particular free or commercial tools, rather my objective is about sharing my
own experience on set of tools.
If you
know or have experienced any other reverse engineering tools suitable for Java
projects analysis, please share the name of such tool along with your personal
feedback in the comment.