Live data from Hacker News

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

news.ycombinator.com

91–100 of 126 posts

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

#91
10 years ago I worked on a large project to re-write a code base written in C. Our approach was to forget about the code and document everything it did from the user's perspective. Once everything was mapped out we decided on what we were going to keep, modify or remove, and then started building everything from scratch. You can always go back to the original code to see how a particular feature was implemented and perhaps re-use the same logic.

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

#92
Several years ago I saw an impressive demo of an analysis and refactoring tool for large Java codebases called SonarJ (now Sonargraph) by hello2morrow. There are a few other tools in this category (jdepend, agilej, jarchitect). They can give you dependency graph visualizations to help untangle the spaghetti and grok the higher-level structure.

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

#94
post #61

Earlier quoted context omitted.

I started in August 1995 when I first heard about it, which I thought was when they released it but it may have had a variety of trickle releases.

I was working on something slightly similar (embedding a VM into a browser) during '94/'95 and was a bit miffed when I first heard of Java.... However, I did think Java was rather good and when I co-founded a start-up in mid '95 we positioned ourselves as a "Java company" - which was no bad thing in the long term as we were in a reasonable position when Netscape, Novell and IBM later decided they wanted to support it…

I was doing Java in a very mainstream UK company in 1998; but we were leading edge and it became "standard" in 2000ish. By 2003 there were 100's of developers using it where I worked.

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

#95
First think is to go find the key users (start from the CEO and work down) and find out what is important that it does to them. Map that.

Find anyone technical who is still around and can talk sensibly about it and find out what they think is important. Map that.

Use anything automated to map what it's up too (calling...) and find out where the core of it is.

You may know what is important by this time, you will be able to make some sort of start...

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

#97
The hardest part is often figuring out what the inner loop actually looks like. The best way to find it is to hook up a profiler, and look at a bunch of stack traces. That'll let you find the most common entry points and calling patterns, which will go a long way towards understanding it.

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

#98
Here's a suggestion I haven't seen: Unless you have full management support, a skilled team, valid business reasons for this conversion, and expectations of succeeding, consider moving to another company/job.

You've been given the task of digital archeology/septic cleanup. Unless you like the tedium and stank, it's not going to bode well...

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

#99
post #91

10 years ago I worked on a large project to re-write a code base written in C. Our approach was to forget about the code and document everything it did from the user's perspective. Once everything was mapped out we decided on what we were going to keep, modify or remove, and then started building everything from scratch. You can always go back to the original code to see how a particular feature was implemented and p…

Having done projects like this before as well, this is the best method. Knowing WHAT needs to be done today and tomorrow is far more important that knowing HOW it was done before. The how is only important once you know what you need to do.

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

#100
I don't think you can just do a cold re-write of that size without domain knowledge. I would first try to refactor the existing system just to reduce the code size. That big a system probably has horrific code and you can easily shrink it quickly. Just finding duplicate code will have an impact. Pulling out to open source systems like file utilities based code.

Basically I would first try to reduce the size of the problem while trying to get domain expertise. I wouldn't consider a rewrite at this stage...

Post reply on HN