users
[Top] [All Lists]

Re: [cinjug-users] Java vs. C

To: users@xxxxxxxxxx
Subject: Re: [cinjug-users] Java vs. C
From: "Edward Sumerfield" <esumerfd@xxxxxxxxxxxxxx>
Date: Mon, 15 Oct 2007 14:43:24 -0400
Delivered-to: mailing list users@xxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; bh=OleHpB+tYXFamfATHAG1yP15ig7s8EwZMVlj0E8Nf5I=; b=rMMLRyWfcQz2kiW8MBgQt7VXv4sdHdPtuwFkvXaN5BsvF9e9XedYbUcFGbRXKSY9o6kQ+SEMBlkp9nMn7pnw1N+g+e6Hy8E8JmVpC4bmRgwvz+aAadkLleJqdS2itShkgHdQgI76NRHLkHFAcOkmcMNHh2BAKjCC/qxRUpJY7Kg=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=ttLPwM4wdMCj37hnmGl57RRN6uLD+LukLXBnuoBLyuoR2NpuMZCoEIdJKbTVuBzSTfkwZEVUPJIbAY7LIViiWMIvwqR5lGS2f++0Gn5/gjqLMD/o5GAaXE1c/eSUVJ5Ilqmtx6aJDlNaLxJaPfTvPyjnMlgyj6qa42gd8aKQQbI=
In-reply-to: <0BE974242D712B4B86B49792A69D789C02C37DF5@xxxxxxxxxxxxxxxxxxxxxxxx>
Mailing-list: contact users-help@xxxxxxxxxx; run by ezmlm
References: <751717.27922.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <0BE974242D712B4B86B49792A69D789C02C37DF5@xxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: esumerfd@xxxxxxxxxxxxxx
Sender: esumerfd@xxxxxxxxx
That is a difficult question to answer.

You say you are wrapping the C code with java data structures. Does this mean that you are using JNI to call C methods?

How much of the C do you have to "port" as opposed to "wrap"?

As a language C is as close to assembly as it gets so the biggest issues that you face are memory management. However, if you are not changing any of the original code then I don't see how your totals would be off.

The key to these things is writing tests before each change so that after wards you know it failed. Then make changes in small increments so you find out what failed as soon as possible. Certainly easier said that done.

My last port was a C++ to java and after a month and a half of trying to understand the original code and duplicate it in java I gave up, through the C++ away and spend the next 2 months with a customer re-writing it. I think this was much faster plus they were able to add features that were not in the original.

On 10/15/07, Hudson, Loren (GE Infra, Aviation, Non-GE, US) <loren.hudson@xxxxxx> wrote:
All,
 
I'm currently working on porting some C code over to Java.  The code opens a binary file, extracts the relevant data, and spits out a .csv file.  I'm getting some issues with the totals being off. 
 
The code was originally written by an engineer, not a programmer.  This is the fourth such program I've ported, and haven't had any real issues.  For the most part, I just wrap the already-written C code with some Java data structures, change the file i/o to use Java commands, and I'm done.  The program uses bit masking, bit shifting, and a whole host of global variables. 
 
My question is this:  Are there any pitfalls that you know of that I could be falling into with the C code that compiles as Java code?  I've never used C before, so this program is really the extent to which I know C. 
 
Thanks,
 
Mike Hudson
MDW - Military Data Warehouse
Java Developer/Solution Architect
Sogeti Consultant
loren.hudson@xxxxxx



--
Ed
<Prev in Thread] Current Thread [Next in Thread>