• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classes/methods diagram

 
alejandro garcia
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic