Live data from Hacker News

Ask HN: I have to analyze 100M lines of Java – where do I start?

news.ycombinator.com

1–10 of 126 posts

Ask HN: I have to analyze 100M lines of Java – where do I start?

#1
As part of a huge "let's see what's going on here and re-build this from scratch" they dumped the whole code repository on me and my team.

We've started parsing it and tried to work on extracting abstract syntax trees and all that.

Any idea would help us a great deal.

Thanks.

Re: Ask HN: I have to analyze 100M lines of Java – where do I start?

#3
Please elaborate. Why is there need for extracting ASTs? Is it a single 100M line of Java source file? AFAIK Java has limitations on method size. If code is already organized into file and methods try to come up with some sort of UML representation. (I am assuming you are trying to understand the code base, not profiling or doing code analysis.)

Re: Ask HN: I have to analyze 100M lines of Java – where do I start?

#7
Start at the main function. See how things get setup and walk through the code from there. Keep notes on the structure and flow of things (if any). There isn't really an easy way to do this unless it had been documented properly before.

AstroGrep is a good Windows based tool that allows you to search within file so you could use it to find which files spit out a particular output to screen.

Not sure what you mean by using ASTs though.

Re: Ask HN: I have to analyze 100M lines of Java – where do I start?

#8
post #6

You haven't really described your goals: What do you want to extract from your analysis? Metrics to tell you what's "wrong" with the existing code base? Some sort of model of the system's semantics?

At a guess, understanding and ability to fix/change, that's the usual with projects like these, bringing the code back into a state of maintenance which could be described as 'under control'.

Re: Ask HN: I have to analyze 100M lines of Java – where do I start?

#10
post #6

You haven't really described your goals: What do you want to extract from your analysis? Metrics to tell you what's "wrong" with the existing code base? Some sort of model of the system's semantics?

We'd love to know what these lines do. For example what part of this codebase deals with the DB and what part does not. And then go deeper.

The final goal is to re-do what these lines do :(

Post reply on HN