Roy Schestowitz asked:
I would like to find out if there are tools which make large
transitions from C++ to Java easier. I am looking at about one
hundred classes with a logical hierarchy and many dependencies.
Will any tool convert syntax semi-automatically? Will any tools
simplify the construction of Java classes? Are there any tools or
Web links that refer to this subject? Maybe some advice? Is this a
smart move at all?
We just did a hand-conversion of this very type, we have a C++
application with a class library for about the same size (~100
classes) that we just converted to C# for a client (not exactly Java,
but very close for this purpose).
We did the conversion by hand, because the syntax is close enough.
The syntactic conversion took on the order of a couple of weeks (or
less, perhaps only a couple of days; and a good bit of that was
learning C#). I am not awaare of any tools that will do it for you.
However, there might be something in the DMS toolkit (if you can
afford it) that does exactly that task. One of the reasons that I
doubt there are tools that take one very far is that there are severl
points of "impedence mismatch" between that languages, things which
one can/must express/distinguish in on language than one cannot/does
not express distinguish in the other. One really needs to understand
the relationships between the classes and their member functions to
make the conversion (a tool is not likely to be able to do that).
That said, after the syntactic conversion came the "real work". In
addition to the syntactic issues, there is a real difference in the
way one deals with data in the two languages. In C++ one uses a lot of
"value types" and pointers, these are types where significant
semantics are attached to destruction and copying of data. In
Java-like languages, the implicit reference types and garbage
collection do the work. The class library we had, had one important
set of arrays of pointers that it manipulated, which was very
important semantically and for performance. It took significant work
(and the performance side of that is not completed) to create a
similar structure in C#--the underlying model was different and we
kept getting items shared, when we wanted a copy of the item, where we
could change some members.
This was in a library that was OO, but not template oriented. I would
shudder to think what additional issues might be encountered if one
had that additional level of semantic mismatch. Now, perhaps if one
had a very modern library that was more "functional" in nature
(e.g. boost), the mismatch would actually be lessened.
So, as always, how difficult the job will be and how smart it will be
to do the conversion, depends heavily on what your original C++ coding
style was and how close that is to the Java model. The bulk of our
code converted easily and with little effort. However, the key
performance critical part was not Java-like at all and that was the
major source of work. We spent 90% of the conversion time on this 10%
of the code, and we still aren't completely happy.
Hope this helps,
-Chris
************************************************** ***************************
Chris Clark Internet :
co*****@world.std.com
Compiler Resources, Inc. Web Site :
http://world.std.com/~compres
23 Bailey Rd voice : (508) 435-5016
Berlin, MA 01503 USA fax : (978) 838-0263 (24 hours)
------------------------------------------------------------------------------