FROM : Scott Ellsworth
DATE : Mon Jul 10 20:22:37 2006
On Jul 10, 2006, at 7:11 AM, Scott Thompson wrote:
>
> On Jul 10, 2006, at 7:24 AM, Raphael wrote:
>
>> Hi,
>> is their a available Tool that can convert Java or C code into
>> objective-c source files?
>> I have try google, but I canīt found anything.
>> I have a old application that I like to convert into my objetive-
>> c. I wouldnīt use the JavaBridge in
>> that app, because it is a complete application and that makes no
>> sense for me.
>
> Well...
>
> Objective-C is a superset of C so all of your C files are, by
> definition, also Objective-C files.
>
> Unfortunately I'm not aware of any tool that might try to translate
> Java into Objective-C.
The object models are quite different. Having done this several
times, your best bet is to create a wrapper API, then do the changes
under the covers.
(I have had several projects where I was converting some Perl, C,
Java, C#, or ObjectiveC code to one of the other languages. Java and
C# convert easily, ObjectiveC using some C libraries is a no brainer,
moving Java or C# to ObjC or the reverse is more complicated.)
For very self contained code, your wrapper can use JNI to get at Java
code, or plain old library calls to get at C code. For example, a
matrix library with a large suite of tests, or a database kit that
already does what you need done, might make sense to leave as one big
block until performance testing tells you it is time to change.
Most code is not that well contained. In that case, you are best off
rewriting, as the human eye really is one of the better translation
tools. There again, a good, minimal interface will tell you what you
need to move.
As far as the nuts and bolts, create appropriate class skeletons, use
accesorizer to handle instance variables, and then move one routine
at a time. I strongly suggest unit tests to make sure you did it
right. (One bennie of the JNI/C library approach - you can get it
working, then as you port methods based on performance needs or
maintenance, you can validate their working against the old, working,
code.)
Scott
DATE : Mon Jul 10 20:22:37 2006
On Jul 10, 2006, at 7:11 AM, Scott Thompson wrote:
>
> On Jul 10, 2006, at 7:24 AM, Raphael wrote:
>
>> Hi,
>> is their a available Tool that can convert Java or C code into
>> objective-c source files?
>> I have try google, but I canīt found anything.
>> I have a old application that I like to convert into my objetive-
>> c. I wouldnīt use the JavaBridge in
>> that app, because it is a complete application and that makes no
>> sense for me.
>
> Well...
>
> Objective-C is a superset of C so all of your C files are, by
> definition, also Objective-C files.
>
> Unfortunately I'm not aware of any tool that might try to translate
> Java into Objective-C.
The object models are quite different. Having done this several
times, your best bet is to create a wrapper API, then do the changes
under the covers.
(I have had several projects where I was converting some Perl, C,
Java, C#, or ObjectiveC code to one of the other languages. Java and
C# convert easily, ObjectiveC using some C libraries is a no brainer,
moving Java or C# to ObjC or the reverse is more complicated.)
For very self contained code, your wrapper can use JNI to get at Java
code, or plain old library calls to get at C code. For example, a
matrix library with a large suite of tests, or a database kit that
already does what you need done, might make sense to leave as one big
block until performance testing tells you it is time to change.
Most code is not that well contained. In that case, you are best off
rewriting, as the human eye really is one of the better translation
tools. There again, a good, minimal interface will tell you what you
need to move.
As far as the nuts and bolts, create appropriate class skeletons, use
accesorizer to handle instance variables, and then move one routine
at a time. I strongly suggest unit tests to make sure you did it
right. (One bennie of the JNI/C library approach - you can get it
working, then as you port methods based on performance needs or
maintenance, you can validate their working against the old, working,
code.)
Scott
| Related mails | Author | Date |
|---|---|---|
| Raphael | Jul 10, 14:24 | |
| Scott Thompson | Jul 10, 16:11 | |
| Sherm Pendley | Jul 10, 17:32 | |
| Raphael | Jul 10, 17:45 | |
| Rob Ross | Jul 10, 18:57 | |
| Scott Ellsworth | Jul 10, 20:22 |






Cocoa mail archive

