Java to Python translation

Frithiof Andreas Jensen frithiof.jensen at removethis.ted.ericsson.dk
Thu Apr 4 03:50:16 EST 2002


"vio" <vmilitaru at sympatico.ca> wrote in message
news:3CAB60E7.8BEF40DC at sympatico.ca...
> I basically want to re-use all the o-o logic currently buried into the
java code
> (which is not really Java-specific, rather program-specific). So
recuperating
> "most" of that already coded logic would be the main goal.

Then use a UML tool to capture the java design and re-implement it in
Python - http://www.objectdomain.com/index.html does a UML tool that support
Java and Python, although I have not used it.  (In my opinion, that is the
only sensible way - apart from starting completely from scratch!)

> In my view, the bigger the java code,
> the bigger the appeal for such an automated approach. Because however
imperfect,
> it's still less expensive than a complete rewrite.

I will bet against that - a complete rewrite is often the most effective and
the least expensive way to port a program to another programming language.
Often the requirements have changed too and the design wants refinement etc.
so one is already rewriting to some extent.

> And who wants to reinvent the
> wheel "in another language"?

You  - you want to program a translator when The Job is porting to another
language....

> It all comes down to cost-benefit ratio. The
> automated translation could also be viewed as a good jump-start, upon
which
> breathing programmers could maybe easier improve upon, rather than
starting from
> scratch. In this sense, we're now talking philosophy.

No, thats (PHB) management speaking: Automatically translated code is shite
to look at and even worse to understand, to debug and to extend - and when
you add the requirements that you want to preserve the *design* as well, you
just up the requirements on the translator to that of a human - since the
design/architecture is really only there to make humans able to understand
and work with the code.

The compiler/interpreter do not care.

If you really are not convinced, then run a Fortran program through f2c on a
Linux box and gaze upon the resulting C code. Then try and modify that. If
you want to learn Flex/Bison then get the tools & docs off the net and build
yourself a calculator. You will then appreciate what a huge task a decent
translator is and why the code generated by one is so hackish.





More information about the Python-list mailing list