how do I generate a graph of class relationships

S

shahbazc

I would like to attempt a 'code comprehension' utility that clearly
(graphically) displays a set of java classes and their relationships to
each other (inheritence, association, etc.) There are plenty of graph
libraries out there, but what is a good way of extracting relationships
themselves? I supposed I could use reflection for compiled
classes...but it seems various UML packages use a different method.
What if I have just source code (which is the point of this utility)?
How do eclipse, argouml, netbeans, etc. extract not just relationships
but also other information such as fields, methods, etc. ... not just
from compiled classes, but also from source code?

I would like to do a quick prototype...that's why the idea of using
programs like javacc and antlr scare me. I would also like to avoid
limiting my utility to a specific framework (eclipse for example).
There must be libraries out there which extract this information...no?
Any way, thanks.

-falcon
 
T

Thomas Weidenfeller

How do eclipse, argouml, netbeans, etc. extract not just relationships
but also other information such as fields, methods, etc. ... not just
from compiled classes, but also from source code?

They use a parser. If the tool designers were clever (and they usually
are) they use a forgiving parser which ignores as many syntax errors as
possible. They also skip a lot of details, e.g. things like constant
expression evaluation. I haven't looked into the particular tools you
mention, but from tools I have seen for other programming languages I
would guess that these parsers are typically hand-coded and not build
with tools like JavaCC.

/Thomas
 
T

Tilman Bohn

In message <[email protected]>,
(e-mail address removed) wrote on 27 Jan 2005 23:20:35 -0800:

[...]
How do eclipse, argouml, netbeans, etc. extract not just relationships
but also other information such as fields, methods, etc. ... not just
from compiled classes, but also from source code?

If I were you I'd simply take a look how they do it. Last time I
checked, all of these came with source code... Depending on what license
you're envisioning for your own project, you might even be able to use
some of their code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top