I have to understand many java classes in short time [closed]
开发者_高级运维
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this questionI have been given new project which has many classes and I have to understand them in very short time.
Is there any tool available so that I can give input as source files and it will show me all the relations between all classes.
Is startUML helpful for this kind of task? Its bit difficult to use. Is there any other tool that shows class diagrams and its relations by seeing source code.
Thanks in advance.
If the project is well designed and the developers placed great value on common design patterns, then I'd suggest:
- Have a look at the GoF and J2EE patterns (skip, if you already have experience with those)
- Study the architecture design documents (should give you a good view on where to expect which functionality)
- Study the design documents of the major "subsystems"
Bottom up may work as well, but only, if the the programmers used good names (packages, classes, methods,...).
If your code is .. say .. coded by cowboys (and you see no chance to run away), you could use a profiler to record typical use cases. Like the startup procedure, a login process, HMI interaction and study the profiler output. Then you'll see the flow and might get a feeling on whats going on.
Code coverage tools (emma) could help as well: write a test case for a simple use case, run it with emma and study the results (they should, what classes and methods have been in use).
Finally: good luck.
Instead of looking at UML diagrams I will usually just fire up the debugger and see the execution path for a couple of use cases. After of some "ahaaa..." moments the big picture will become clear, especially if the application is layered sensibly (which means that not each and every use case needs to be examined that way).
Also, since this is work, try to focus on the parts of the application that you'll be asked to change/fix/extend. You may not need to understand the application as a whole, at least for starters.
SPARX Enterprise Architect can do this pretty slickly.
Its a relatively expensive product -- but you get a thirty day free trail on downlaod!
link
While generating a diagram can be handy, why not just grab pen and paper and do it yourself? I'm not talking UML here, just boxes with lines.
By doing it this way you at least know you've seen the class/interface before when you hit it again and you actually can form a structure of the whole thing and really learn the connections between classes. As a great plus, you can then use your own diagram as reference to ask others if you've understood the structure and behavior correctly.
I don't believe there's any "fast" ways to do it, you just have to accept the fact that you have to sit down and really do it. We recently had a new employee in the company I work for, it took him about a week to learn the full structure of our main product (and just how bad can legacy JSP look) but in the end he knew enough to start working with the application itself. The big thing here is, however, that don't expect to fully learn the software in a week, usually understanding the software takes at least 10% of the time that has been spent on engineering it in the first place.
精彩评论