Hi! I'm new to Java but I was given a 300 classes system that I need to understand and modify. When I try to follow the logic I get lost, I even can't find in which class is defined the method that is called because each class imports many others. It would help me very much if there could be some tool to build some kind of flowchart or classes diagram to visually show who calls who..
UML (Unified Modeling Language) is the commonest method of describing Object Oriented Systems. There are tools available that will produce UML diagrams from existing code. Google UML Tools to see what's available.
I think it would help if you use a UML diagramming tool such as "MagicDraw UML" or "Smart Draw". I personally prefer MagicDraw. You can download a trial version from magicdraw.com, if I am not mistaken.
If you're not familiar with UML, here's a great introduction to The Diagrams of UML 2 from Scott Ambler. I'll mention three that might be good starting points.
The Class Diagram shows how classes are related to each other. For example one might extend another, or one might have a reference variable whose type is another class. This is a good "static" view of how things are constructed.
The Communication and Sequence diagrams really contain the same information in different formats. Communication does a better job of showing some of the same relationships that were in the Class diagram. Sequence shows what things happen in what order better.
I often doodle Communication or Sequence diagrams on a piece of paper while reading complicated code. In rare cases I transcribe these to a tool for safe keeping or easier editing. So 1) learn a few of the diagrams, not all 13 on that list, 2) make a few on paper or a whiteboard, 3) worry about drawing tools.
You can probably find a tool that will read Java and draw the class diagram. I have rarely found this useful, as they show so much detail that they hide the important bits. Your mileage may vary.
Oh, what IDE do you use? In Eclipse I often highlight a method call and hit F3 to see where it's defined. I also have a plug-in that helps find implementations in case F3 lands you on an Interface.
Keep it fun, let us know how it goes! [ August 17, 2007: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi