Translator Tools?  
Author Message
Gerry Murphy





PostPosted: 2004-6-18 3:40:00 Top

java-programmer, Translator Tools? 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.

I asked and looked for tools that would help
me make sense of this mess, so far to no avail.

Now the owner of the company is willing to
consider redoing it in C++. ( In my opinion
there was no good reason for the previous software
engineer to write this in Java. It's a pretty
straightforward Windows desktop app that would
be much easier to understand and maintain had
it been written in VC++. There's some evidence
he chose Java just so he could get some experience
with it,)

Anyhow, I'm not rewriting this by hand.
I came across the following in Bruce Eckel's
'Thinking In Java', "I've even heard it
suggested that you start with Java, to gain the
short development time, then use a tool and support
libraries to translate your code to C++, if
you need faster execution speed."


Has anybody heard of or better still used
such translator tools? Even if it only did
80-90% and the rest required manual intervention
it might work.

TIA for any advice.

Gerry Murphy


 
Gerry Murphy





PostPosted: 2004-6-18 3:42:00 Top

java-programmer >> Translator Tools? 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.

I asked and looked for tools that would help
me make sense of this mess, so far to no avail.

Now the owner of the company is willing to
consider redoing it in C++. ( In my opinion
there was no good reason for the previous software
engineer to write this in Java. It's a pretty
straightforward Windows desktop app that would
be much easier to understand and maintain had
it been written in VC++. There's some evidence
he chose Java just so he could get some experience
with it,)

Anyhow, I'm not rewriting this by hand.
I came across the following in Bruce Eckel's
'Thinking In Java', "I've even heard it
suggested that you start with Java, to gain the
short development time, then use a tool and support
libraries to translate your code to C++, if
you need faster execution speed."


Has anybody heard of or better still used
such translator tools? Even if it only did
80-90% and the rest required manual intervention
it might work.

TIA for any advice.

Gerry Murphy


 
Mike





PostPosted: 2004-6-18 3:55:00 Top

java-programmer >> Translator Tools? In article <40d1f366$0$2998$email***@***.com>, Gerry Murphy wrote:
> 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.
>
> I asked and looked for tools that would help
> me make sense of this mess, so far to no avail.
>
> Now the owner of the company is willing to
> consider redoing it in C++. ( In my opinion
> there was no good reason for the previous software
> engineer to write this in Java. It's a pretty
> straightforward Windows desktop app that would
> be much easier to understand and maintain had
> it been written in VC++. There's some evidence
> he chose Java just so he could get some experience
> with it,)
>
> Anyhow, I'm not rewriting this by hand.
> I came across the following in Bruce Eckel's
> 'Thinking In Java', "I've even heard it
> suggested that you start with Java, to gain the
> short development time, then use a tool and support
> libraries to translate your code to C++, if
> you need faster execution speed."
>
>
> Has anybody heard of or better still used
> such translator tools? Even if it only did
> 80-90% and the rest required manual intervention
> it might work.

Once at the end of a project I had ~50,000 lines
of code that needed very specific documentation
by the contract. Instead of documenting the code
by hand, as my fellow developers in the project
did, I learned how to write compilers. At first
I was about two weeks behind them and then in one
afternoon all my code was documented without any
compiler syntax problems, etc.

My suggestion, write a compiler/translator to
change the code to what you want.

Mike
 
 
Roedy Green





PostPosted: 2004-6-18 4:25:00 Top

java-programmer >> Translator Tools? On Thu, 17 Jun 2004 15:41:42 -0400, "Gerry Murphy"
<email***@***.com> wrote or quoted :

>
> Has anybody heard of or better still used
>such translator tools? E

God NO! If the code is an unreadable mess now it will be 5 times a
bigger mess after translation.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Roedy Green





PostPosted: 2004-6-18 4:25:00 Top

java-programmer >> Translator Tools? On Thu, 17 Jun 2004 15:41:42 -0400, "Gerry Murphy"
<email***@***.com> wrote or quoted :

> It's a pretty
>straightforward Windows desktop app that would
>be much easier to understand and maintain had
>it been written in VC++.

I would say, the opposite. Generally even badly written Java is
fairly easy to follow. Even well written C++ requires enormous coding
discipline to be readable.

Your problem may be unfamiliarity with Java. Perhaps you could solve
the problem by getting the code documented and cleaned up by someone
who knows Java.

Perhaps your predecessor took my essay on how to write unmaintainable
code to heart. You can do it is any language.

See http://mindprod.com/jgloss/unmain.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Sudsy





PostPosted: 2004-6-18 5:08:00 Top

java-programmer >> Translator Tools? Roedy Green wrote:
> On Thu, 17 Jun 2004 15:41:42 -0400, "Gerry Murphy"
> <email***@***.com> wrote or quoted :
>
>
>> Has anybody heard of or better still used
>>such translator tools? E
>
>
> God NO! If the code is an unreadable mess now it will be 5 times a
> bigger mess after translation.

I was about to say essentially the same thing but Roedy beat me to
the punch. Think about it: if the Java looks like spaghetti to you
now, how do you think it's going to look when translated into C++?
The NEXT person to come along will be calling for YOUR head on a
platter!

 
 
Roedy Green





PostPosted: 2004-6-18 5:16:00 Top

java-programmer >> Translator Tools? On Thu, 17 Jun 2004 15:41:42 -0400, "Gerry Murphy"
<email***@***.com> wrote or quoted :

> 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.

You want a navigator tool to help you get the sense of how the big
picture fits together.

You could try on of the more elaborate IDES such as IntelliJ or
Eclipse or SlickEdit or Juliet.

See http://mindprod.com/jgloss/ide.html
http://mindprod.com/jgloss/slickedit.html
http://mindprod.com/jgloss/juliet.html

Eventually you will have even better tools called SCIDs.
See http://mindprod.com/projects/scid.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Thomas Kellerer





PostPosted: 2004-6-18 5:29:00 Top

java-programmer >> Translator Tools? Gerry Murphy schrieb:

> In my opinion there was no good reason for the previous software
> engineer to write this in Java. It's a pretty straightforward Windows
> desktop app that would be much easier to understand and maintain had it
> been written in VC++.

Now, this surely is a wrong conclusion. A bad programmer will write
horrible code in both languages (and I tend to think that the code will
even be more horrible in C++, but then I'm a Java programmer :) )

A well written Java/Swing application is as easily understood as a well
written C++ program.

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++

I would think that this application would be an absolute nightmare to
maintain if you automate the transition to C++ (as already mentioned) if
it's already a mess. Automatically generated code is *never* maintainable
by a human brain.

If I was you I would consider a complete re-engineering/re-coding using
your preferred language. I'm pretty sure that's the fastest thing you can do.

Just my 2 cents.

Thomas

 
 
Gerry Murphy





PostPosted: 2004-6-18 6:08:00 Top

java-programmer >> Translator Tools? Hi,

I've found your site very useful. And I'm 99% sure
that the previous fellow read your unmaintainable code section.
I recognize several of the tips. I think this was unprofessional
on his part.

My unfamiliarity I readily admit. I've been studying it on
my own but this is my first chance to use it in the job.
I don't think the owner would go for hiring an outside party
to do as you suggest, and I don't have the authority to
do it myself. Ultimately, it's not my code.

Thanks for youe help.

Gerry Murphy

"Roedy Green" <email***@***.com> wrote in message
news:email***@***.com...
> On Thu, 17 Jun 2004 15:41:42 -0400, "Gerry Murphy"
> <email***@***.com> wrote or quoted :
>
> > It's a pretty
> >straightforward Windows desktop app that would
> >be much easier to understand and maintain had
> >it been written in VC++.
>
> I would say, the opposite. Generally even badly written Java is
> fairly easy to follow. Even well written C++ requires enormous coding
> discipline to be readable.
>
> Your problem may be unfamiliarity with Java. Perhaps you could solve
> the problem by getting the code documented and cleaned up by someone
> who knows Java.
>
> Perhaps your predecessor took my essay on how to write unmaintainable
> code to heart. You can do it is any language.
>
> See http://mindprod.com/jgloss/unmain.html
>
> --
> Canadian Mind Products, Roedy Green.
> Coaching, problem solving, economical contract programming.
> See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


 
 
Gerry Murphy





PostPosted: 2004-6-18 6:10:00 Top

java-programmer >> Translator Tools? The issue is that I understand C++ and have lots of tools
I've used over the years that would help me clean it up.

Thanks anyway.

Gerry Murphy

"Sudsy" <email***@***.com> wrote in message
news:email***@***.com...
> Roedy Green wrote:
> > On Thu, 17 Jun 2004 15:41:42 -0400, "Gerry Murphy"
> > <email***@***.com> wrote or quoted :
> >
> >
> >> Has anybody heard of or better still used
> >>such translator tools? E
> >
> >
> > God NO! If the code is an unreadable mess now it will be 5 times a
> > bigger mess after translation.
>
> I was about to say essentially the same thing but Roedy beat me to
> the punch. Think about it: if the Java looks like spaghetti to you
> now, how do you think it's going to look when translated into C++?
> The NEXT person to come along will be calling for YOUR head on a
> platter!
>


 
 
Gerry Murphy





PostPosted: 2004-6-18 6:17:00 Top

java-programmer >> Translator Tools? I've tried a couple of things already, JavaDoc,
Doxygen with GraphWiz, JDepend, and I've
been trying to figure out NetBeans so I could at least
have an IDE. ( Not only is the code undocumented
and uncommented, they build it manually with Sun's
command line compiler, some antiquted build tools
and other compilers and a mind-numbing array of
batch files and makefiles. It's enough to make you weep.)
Can't get it to compile with NetBeans so far.

Another problem I'm having my be called 'tool-fatigue'.
I need to start making progress ASAP, not taking a
week or a month to figure out how to get a tool to work.
I will take a look at the ones you recommend however.

Thanks,

Gerry Murphy


"Roedy Green" <email***@***.com> wrote in message
news:email***@***.com...
> On Thu, 17 Jun 2004 15:41:42 -0400, "Gerry Murphy"
> <email***@***.com> wrote or quoted :
>
> > 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.
>
> You want a navigator tool to help you get the sense of how the big
> picture fits together.
>
> You could try on of the more elaborate IDES such as IntelliJ or
> Eclipse or SlickEdit or Juliet.
>
> See http://mindprod.com/jgloss/ide.html
> http://mindprod.com/jgloss/slickedit.html
> http://mindprod.com/jgloss/juliet.html
>
> Eventually you will have even better tools called SCIDs.
> See http://mindprod.com/projects/scid.html
>
> --
> Canadian Mind Products, Roedy Green.
> Coaching, problem solving, economical contract programming.
> See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


 
 
Gerry Murphy





PostPosted: 2004-6-18 6:21:00 Top

java-programmer >> Translator Tools? What you suggest is the only other option I'd consider,
but I don't think the owner would go for the time, money
and effort involved. If I don't show some progress it's
a tossup whether to walk away or wait a bit and get canned.

Thanks,

Gerry Murphy

"Thomas Kellerer" <email***@***.com> wrote in message
news:cat2e1$fct$email***@***.com...
> Gerry Murphy schrieb:
>
> > In my opinion there was no good reason for the previous software
> > engineer to write this in Java. It's a pretty straightforward Windows
> > desktop app that would be much easier to understand and maintain had it
> > been written in VC++.
>
> Now, this surely is a wrong conclusion. A bad programmer will write
> horrible code in both languages (and I tend to think that the code will
> even be more horrible in C++, but then I'm a Java programmer :) )
>
> A well written Java/Swing application is as easily understood as a well
> written C++ program.
>
> 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++
>
> I would think that this application would be an absolute nightmare to
> maintain if you automate the transition to C++ (as already mentioned) if
> it's already a mess. Automatically generated code is *never* maintainable
> by a human brain.
>
> If I was you I would consider a complete re-engineering/re-coding using
> your preferred language. I'm pretty sure that's the fastest thing you can
do.
>
> Just my 2 cents.
>
> Thomas
>


 
 
Liz





PostPosted: 2004-6-18 6:43:00 Top

java-programmer >> Translator Tools?
"Gerry Murphy" <email***@***.com> wrote in message
news:40d1f366$0$2998$email***@***.com...
> 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.
>
> I asked and looked for tools that would help
> me make sense of this mess, so far to no avail.
>
> Now the owner of the company is willing to
> consider redoing it in C++. ( In my opinion
> there was no good reason for the previous software
> engineer to write this in Java. It's a pretty
> straightforward Windows desktop app that would
> be much easier to understand and maintain had
> it been written in VC++. There's some evidence
> he chose Java just so he could get some experience
> with it,)
>
> Anyhow, I'm not rewriting this by hand.
> I came across the following in Bruce Eckel's
> 'Thinking In Java', "I've even heard it
> suggested that you start with Java, to gain the
> short development time, then use a tool and support
> libraries to translate your code to C++, if
> you need faster execution speed."
>
>
> Has anybody heard of or better still used
> such translator tools? Even if it only did
> 80-90% and the rest required manual intervention
> it might work.
>
> TIA for any advice.
>
> Gerry Murphy
>
Sounds like you are looking for an excuse to use the "GOTO" ;-)

Why not reverse engineer it from its behaviour and toss the java code.




 
 
Sudsy





PostPosted: 2004-6-18 7:17:00 Top

java-programmer >> Translator Tools? Gerry Murphy wrote:
> What you suggest is the only other option I'd consider,
> but I don't think the owner would go for the time, money
> and effort involved. If I don't show some progress it's
> a tossup whether to walk away or wait a bit and get canned.

I was going to ask some probing questions, but you've already been
candid in your replies. Would it be fair to suggest that the
situation is something like this?
- you don't have a lot of Java experience
- you've "inherited" a project which is a "rats nest"
- you'd like to convert the code to a language with which you're
more familiar
- you're facing unrealistic expectations and pressure from your
management

Welcome to the real world! Sorry if that doesn't sound particularly
supportive but it's a fair comment. I well recall the times I was
"dropped into it", typically at the 11th hour.
So look upon this as a personal and professional challenge! You'll
have a tough sell in the expectation management area but you seem
to already accept one of the possible outcomes (getting axed).
You're also heading in the right direction by trying to import the
project into an IDE. Try to provide concrete numbers to management
on a daily basis, something along the lines of "I've now got 60%
of the code imported and syntactically correct".
I don't know Netbeans but some people here swear by Eclipse,
particularly for refactoring code. I'm sure that there are also
tools available which can analyze the existing code for linkages
and dependencies but, having never had to do this kind of job
myself, will defer to the recommendations of others.
Just keep trying to move forward and explain that even the "best
of the best" wouldn't fare well faced with atrocious code.
Keep the chin up, try not to dump on the original author, and
maintain your integrity. That, as much as your programming prowess,
will help you through the most trying of times.

 
 
Roedy Green





PostPosted: 2004-6-18 8:32:00 Top

java-programmer >> Translator Tools? On Thu, 17 Jun 2004 17:07:32 -0400, Sudsy <email***@***.com>
wrote or quoted :

>I was about to say essentially the same thing but Roedy beat me to
>the punch. Think about it: if the Java looks like spaghetti to you
>now, how do you think it's going to look when translated into C++?
>The NEXT person to come along will be calling for YOUR head on a
>platter!

Does the code at least work?

If it works, likely you best bet is to get someone more familiar with
Java to document and clean it up for you. Then is suddenly may seem
more comprehensible. (Hint, I do this sort of thing on a contract
basis.). You need quite different sorts of docs for newbies and for
experienced programmers.

I got in to heck of a fight with a guy on a team once because he was
FURIOUS with me for documenting every method and parameter with
JavaDoc no matter how obvious it was. He prided himself on terse
code, and my JavaDoc blew up his line counts.

If the program seriously does not work, your best bet if you have to
maintain this, is just to extract a spec from the working program and
from crucial bits of the code, and redo it in the C++ you are familiar
with.

The docs most often missing are the "forest" docs. It is easy to
figure out how a method works, but much harder to see what it is FOR,
and how it fits into the big picture.

The most important docs are the "most obvious" docs to the coder --
what a class is FOR. To him the details are the complicated things.
To someone coming cold, details are easy to figure out. What's hard is
how the whole thing fits together. What is the overall flow.

In cleanup, you just whittle away, working on the most comprehensible
bits. It is a bit like a crossword puzzle. Every part you figure out
makes some more part clear.

You refactor and clean up code. This makes new levels of meaning shine
through.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Liz





PostPosted: 2004-6-18 9:43:00 Top

java-programmer >> Translator Tools?
"Roedy Green" <email***@***.com> wrote in message
news:email***@***.com...
> On Thu, 17 Jun 2004 17:07:32 -0400, Sudsy <email***@***.com>
> wrote or quoted :
>
> >I was about to say essentially the same thing but Roedy beat me to
> >the punch. Think about it: if the Java looks like spaghetti to you
> >now, how do you think it's going to look when translated into C++?
> >The NEXT person to come along will be calling for YOUR head on a
> >platter!
>
> Does the code at least work?
>
> If it works, likely you best bet is to get someone more familiar with
> Java to document and clean it up for you. Then is suddenly may seem
> more comprehensible. (Hint, I do this sort of thing on a contract
> basis.). You need quite different sorts of docs for newbies and for
> experienced programmers.
>
> I got in to heck of a fight with a guy on a team once because he was
> FURIOUS with me for documenting every method and parameter with
> JavaDoc no matter how obvious it was. He prided himself on terse
> code, and my JavaDoc blew up his line counts.

Then he was not using a proper method of counting lines.

> If the program seriously does not work, your best bet if you have to
> maintain this, is just to extract a spec from the working program and
> from crucial bits of the code, and redo it in the C++ you are familiar
> with.
>
> The docs most often missing are the "forest" docs. It is easy to
> figure out how a method works, but much harder to see what it is FOR,
> and how it fits into the big picture.
>
> The most important docs are the "most obvious" docs to the coder --
> what a class is FOR. To him the details are the complicated things.
> To someone coming cold, details are easy to figure out. What's hard is
> how the whole thing fits together. What is the overall flow.
>
> In cleanup, you just whittle away, working on the most comprehensible
> bits. It is a bit like a crossword puzzle. Every part you figure out
> makes some more part clear.
>
> You refactor and clean up code. This makes new levels of meaning shine
> through.
>
>
> --
> Canadian Mind Products, Roedy Green.
> Coaching, problem solving, economical contract programming.
> See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


 
 
Sudsy





PostPosted: 2004-6-18 9:50:00 Top

java-programmer >> Translator Tools? Liz wrote:
<snip everything>

You quoted, in its entirety, a response to a follow-up post and
then added a single line. Could we ask you again to please trim
your posts? All you need to quote is a paragraph or two, just to
provide some context. Pretty please?

 
 
Liz





PostPosted: 2004-6-18 9:55:00 Top

java-programmer >> Translator Tools? sure no problem as long as i can top post

"Sudsy" <email***@***.com> wrote in message
news:email***@***.com...
> Liz wrote:
> <snip everything>
Pretty please?
>


 
 
Roedy Green





PostPosted: 2004-6-18 10:05:00 Top

java-programmer >> Translator Tools? On Fri, 18 Jun 2004 01:43:19 GMT, "Liz" <email***@***.com> wrote or
quoted :

>Then he was not using a proper method of counting lines.
I offered to write a program to count lines not counting comments, but
his view as good code does not need comments, so comments should
count.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Liz





PostPosted: 2004-6-18 10:11:00 Top

java-programmer >> Translator Tools?
> I offered to write a program to count lines not counting comments, but
> his view as good code does not need comments, so comments should
> count.
>
There are a couple of public tools that will do it.

jcsc and ncsl


 
 
nobody important





PostPosted: 2004-6-18 15:10:00 Top

java-programmer >> Translator Tools? How will a C++ port of bad Java code make it easier to understand and
maintain? Was that a "C++ is better than Java"-comment? If so, I think
you're barking in the wrong forum :o)

Do you really need the speed-up? If it's a Windows desktop application I
wouldn't think so :o)

If UML will make the code more understandable then I would recommend you
take a look at some of these tools as most of them have reverse-engineering
from code to UML. The first tool, that springs to mind is TogetherSofts
tool - but it's a long time since I've tampered with it and it seems it may
be difficult to find.

otherwise try Google e.g.
http://www.google.com/search?hl=da&ie=UTF-8&q=uml+reverse+java&lr=

/nobody important



"Gerry Murphy" <email***@***.com> wrote in message
news:40d1f2ee$0$3011$email***@***.com...
> 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.
>
> I asked and looked for tools that would help
> me make sense of this mess, so far to no avail.
>
> Now the owner of the company is willing to
> consider redoing it in C++. ( In my opinion
> there was no good reason for the previous software
> engineer to write this in Java. It's a pretty
> straightforward Windows desktop app that would
> be much easier to understand and maintain had
> it been written in VC++. There's some evidence
> he chose Java just so he could get some experience
> with it,)
>
> Anyhow, I'm not rewriting this by hand.
> I came across the following in Bruce Eckel's
> 'Thinking In Java', "I've even heard it
> suggested that you start with Java, to gain the
> short development time, then use a tool and support
> libraries to translate your code to C++, if
> you need faster execution speed."
>
>
> Has anybody heard of or better still used
> such translator tools? Even if it only did
> 80-90% and the rest required manual intervention
> it might work.
>
> TIA for any advice.
>
> Gerry Murphy
>
>