Translator tools?

A

Andrew Thompson

(OP)
Has anybody actually mentioned 'JavaDoc' yet?

You do not make that clear in your rather
...vague question.
 
T

Tim Ward

Gerry Murphy said:
I was about to throw in the towel on this
project I've inherited. It's about 5,000
Java files, totally undocumented and uncommented.

After automatic translation you would have 5,000 lines of undocumented and
uncommented C++ (in fact worse than the original because any such
translation process is bound to introduce messy artefacts), yes? This would
be better than the original how, exactly?

For such a tiny project I'd just rewrite in C++ from the specification,
maybe I'd have a look at the Java code first, maybe I wouldn't. (I wouldn't
have given this answer if you'd had 500,000 lines of rubbish Java.)
 
T

Thomas Kellerer

For such a tiny project I'd just rewrite in C++ from the specification,
maybe I'd have a look at the Java code first, maybe I wouldn't.

It's not a tiny project. It's 5000 Java *files* not /lines/

Thomas
 
G

Gerry Murphy

I did mention it in a reply to Roedy Green,
you might also have remembered that you
yourself mentioned it in comp.lang.java.help.
Perhaps you forgot because you were too busy
with gratuitous insults. I think I'd be happier
if you didn't respond to my posts in future.
 
A

Andrew Thompson

I did mention it in a reply to Roedy Green,
you might also have remembered that you
yourself mentioned it in comp.lang.java.help.

ahh yes,..
<http://groups.google.com/groups?th=6ac5ef631b675a37>
I see you should have not learned much
and should still be posting there.. ;-)
Perhaps you forgot because you were too busy
with gratuitous insults.

...or perhaps I was too busy helping people
who deserve help, to recall ..you.
..I think I'd be happier
if you didn't respond to my posts in future.

Sure, if you don't completely
slip my mind, again.. ;-)

OTOH, I empower *you* to plonk me.
It's your choice, sunshine..
 
R

Roedy Green

It's not a tiny project. It's 5000 Java *files* not /lines/

Good lord. It is astounding someone could keep track of a project in
their own head that big without documenting as they went.

Some young hot shot right?
 
G

Gerry Murphy

Well, we only hear your side of the story. In another posting you
confessed that you are a C++ guy (maybe Windows-only?). And you also
mentioned a beginner's textbook about Java. Could it be that it is not
only the previous programmer who is to blame, but that this system is
just beyond your area of competence? That you simply don't like it?

I've been primarily a C++ guy, mostly windows, occasionally Unix
for twenty years. Also several other languages.
You also told us, that you didn't even manage to set up an IDE and get
the thing compiled. Which is, hmm, rather interesting, because Java's
class naming requirements (public class name must equal file name), and
the common way to lay out a package structure in a file system (each
package component becomes a directory) makes it fairly trivial to figure
out which files make up the source.

The code compiles as is with the existing build. And the, "...common way
to lay out a package structure in a file system..." you mention has been
explicitly violated in this code.
Oh, and the reason why you tried to set up an IDE was that you didn't
like the current build system. Well, it was good enough for that one guy
you call incompetent. But you you can't handle it? Something just smells
fishy here.

Now you're just being nasty. Please point out where I called anyone
incompetent?
Because you told him? The owner is best advised to first get a second
opinion from an experienced Java developer.

No, it was his idea actually. You're just full of unwarranted assumptions,
aren't you?
TIA for any advice.

I don't think you want to thank me after this posting.

/Thomas

Wrong again. Thank you.
 
D

David Alex Lamb

When it comes to documentation, javadoc is a very powerful tool that can
lead (if used at all, and used well) to a good documentation also.
I don't know if such a thing exists for C++

Doxygen

JavaDoc may help a bit even with undocumented code -- it can give you the
class hierarchy (labeled Tree in the generated docs), which can be a
reasonable place to start understanding the old code. A good IDE should be
able to do the same, but I don't use one so can't advise.

I've recently been reading a subset of the vast literature on "program
understanding" and "reverse engineering" but haven't (yet?) found much about
working tools (just research systems). Anyone know of a good survey.
 
C

Chris Smith

Gerry,

Here's my opinion on the matter, for what it's worth.

First of all, while Thomas wrote one of the more insulting replies in
this thread, he also managed to be exactly right about at least one
thing. So I quote:

Thomas said:
I think you are naive to believe that such a translation would help you.
The most common thing between Java and C++ is the syntax. Java's class
library (usually heavily used in any Java application), and Java's
garbage collection are fundamentally different from what you have in
C++. As a consequence, a Java program is most likely structured very
differently from a C++ program.

This is a very reasonable explanation of what you can expect from a
conversion tool. If you were familiar with a language that exhibits
wildly different syntax, I could see translating just so you're more
comfortable with the resulting code. Java, though, is almost identical
to C++ regarding its procedural language features and general syntax.
The only major things that differ are exactly those things that you will
not be able to translate in an automated way.

I expect if you've really got a bunch of poor code, that it's mostly
poor in how it interacts with the core library or other third-party
APIs. You're absolutely not going to be able to automate a conversion
from a Swing-based application to an MFC application with Visual C++.
The means of performing common tasks are just so different from each
other that this would be better done as a translation by hand.

If I were you and had a project of this size, I'd start learning Java
and try to improve as you go. Write unit tests. Use automatic
refactoring support. Make changes that you think should still work and
then repeat your unit tests to verify that they do. If you're
experienced with C++, you should have a fairly good idea what
constitutes good design in an OO environment, so you are qualified to do
this. The change across languages, though, just introduces more work
and more cleaning up to get done.

And, of course, if you have specific questions we're happy to address
them.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
G

Gerry Murphy

Hi,

Yes, what you suggest is what I'm doing. I finally sorted
out the problems I was having with NetBeans and was
able to compile some of the code. Within minutes I discovered
packages being imported but never used. Today I ran
another tool that discovered lots of dead code.

The translator issue was based on a quote in a book and the
only reason I threw it out there was the owner expressed a
willingness to have this rewritten in C++, which I wasn't about
to do by hand given his timelines.

Until last Friday I felt like Sisyphus, but the boulder wouldn't budge.
At least now it's movimg a bit, even if it is uphill. 8-}

Thanks,

Gerry Murphy
 
T

Thomas Weidenfeller

Chris said:
First of all, while Thomas wrote one of the more insulting replies in
this thread,

The OP set the tone of the discussion by throwing wild accusations about
this predecessor around. Especially when taking into account that he is
a Java beginner. Nothing wrong with being a beginner, but that doesn't
really qualify him to judge other people's work, bad mouth them and call
them unprofessional.

Ironically, he accused his predecessor to have chosen Java just to learn
it, while in some other post he also admitted that he took the job so he
could work with Java - presumably to learn it. Now, what is wrong with
that picture? When his plan didn't work out because he can't handle the
existing code, he panicked, bad mouthed his predecessor and tried to go
back to C++. IMHO, it is not the previous programmer who is responsible
for the failure of his plan.

/Thomas
 
G

Gerry Murphy

Wow, where do I begin with this guy?
Let's take it point by point:

Thomas Weidenfeller said:
The OP set the tone of the discussion by throwing wild accusations about
this predecessor around. Especially when taking into account that he is
a Java beginner. Nothing wrong with being a beginner, but that doesn't
really qualify him to judge other people's work, bad mouth them and call
them unprofessional.

I asked you to document the insults you alleged. You still haven't.
Ironically, he accused his predecessor to have chosen Java just to learn
it, while in some other post he also admitted that he took the job so he
could work with Java - presumably to learn it. Now, what is wrong with
that picture? When his plan didn't work out because he can't handle the
existing code, he panicked, bad mouthed his predecessor and tried to go
back to C++. IMHO, it is not the previous programmer who is responsible
for the failure of his plan.

Let me fill you in. The code base originallly WAS C++. It was the opinion
of folks who worked with him that he unilaterally made the change for
personal reasons, not for any valid engineering reasons. After inspecting
his code I tend to concur.

I did take the job to learn Java. Note that in doing so I'm not changing
anything.
Going back to C++ was merely one option I was considering. Perhaps,
"...what is wrong with that picture..." is that the distinction is too
subtle for you.

IMHO, it is not the previous programmer who is responsible
for the failure of his plan.

Well, time will tell what your opinion is worth.
BTW, I haven't panicked and the rumors of the 'failure of my plan'
are greatly exaggerated.
 

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,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top