开发者

Understanding large Java Code Base

Are there resources on going about trying to understand a large java code base. Like for example, a graph persistence implementation. If there is minimal / missing documentation, what kinds of approaches do you take ? Are there any books that deal with this ? I know one called Brownf开发者_如何学运维ield App Development in .NET.

Perhaps something similar ?


There are number of ways to tackle such a problem and most of the times it will be your personal preference and style of coding and solving problems... for ex:

  1. Start with any documentation/TDD if available.
  2. Use some design/UML tool like EA Architect to generate the UML/Class diagram to understand the class structure.
  3. If the project has some test cases, start by executing and understanding the code behind it.
  4. Try running the application and you can set some debug points and try understanding the flow.

End of the day it all depends on the project, how well the code is documented and your personal style of solving problems.


My suggestions would be:

  1. Get the code building. If there is no build script, write one.
  2. Get the code running.
  3. If there are no tests, start picking off bits of the system to write tests for. You're not really testing, you're learning about the system's behaviour.
  4. Use a modern IDE (Eclipse, Netbeans, etc.) to start tracing the declarations and references to methods and classes.

Good luck!

Ian.


It all depends on how the project is organized. Some ideas off the top of my head:

  1. Look for the core / domain knowledge:
    • See if domain knowledge is isolated and start from understanding it.
    • See how the code is split into projects, modules (e.g. jars) and packages. If there is at least some organization, look for the "core" and start learning from there.
    • Look for other traces of this knowledge: diagrams, tests, documents, samples.
  2. Try running the application. Analyze what happens from the entry points down.
  3. Learn the basic architecture. Look for the familiar ground (frameworks and solutions you know) and see how it is used.


If you want to trace the execution of your Java code to get a feel for the flow of control you can use a tool called InTrace.

NOTE: InTrace is a free and open source tool which I have written.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜