Integration Watch: Java to C: No mean feat



Email    print   
September 15, 2008 —  (Page 1 of 3)

A few weeks ago, a client contacted me to see whether I would be interested in working on a project to convert a 150,000-line Java codebase to C. Before responding, I decided to see what tools were available. Given the nearly infinite variety of open-source projects and the fact that C and Java dominate OSS projects, I figured there would be the usual wealth of tool choices available to automate the conversion.

To my amazement, I discovered only a few resources—and those were mostly abandoned or dying projects; one-off commercial tools on rarely updated Web sites; and, in the case of GNU GCJ, a product that supports only Java 1.2. There’s no good, comprehensive solution. So, how to proceed?

One possible approach is to convert code semi-automatically: Put some pieces in place, use a set of filters (in AWK or Perl) to partially convert the Java, then finish the job by hand. The pieces you’d have to put in place are substantial but not overwhelming: A garbage collector (I’d use the Boehm-Demers-Weiser), implementation of basic Java classes (such as String, some collections and some File classes) to which new classes are added as needed and, finally, some kind of object model. The latter requirement is challenging; creating one from scratch requires lots of careful thinking.

One solution is to use the GObject model from Glib (part of the Gnome open-source project), which is written in C. This would solve the problem of an object model, but it’s an unforgiving path. First of all, it requires a long learning curve and a lot of boilerplate code. Second, it means you have to ship some of the Gnome libraries with your product. Gnome is a great project for Linux, but its support for other platforms, especially Windows, is weak.

The Vala project in Gnome seeks to produce a simple OO language that compiles to C and uses Glib. This would be an almost ideal solution, were it not for the fragility of the project, which is still early in its development cycle and, once again, is unfriendly to platforms other than Linux. Essentially, if you choose the source code translation path, you’ll need to write your own object model and develop your own quasi-OO syntax to match the Java you’re working with.



Related Search Term(s): Java, open source, software development

Pages 1 2 3 


Share this link: http://sdt.bz/32821
 
Most Read Latest News Blog Resources


Comments


02/12/2010 08:23:53 AM EST

Hi, Andrew! A bit belated comment but... Among GCJ and JC projects, I could mention a JCGO (www.ivmaisoft.com/jcgo) one, a Java source to C translator. Given the sources of the Java program, it translates all the sources at once producing readable platform-independent C code which could further be compiled to a binary executable for the targeted platform. The produced executable does not contain nor require a Java Virtual Machine to execute, so its resource requirements are smaller than that required by a typical Java VM.

Russia (Russian Federation)Ivan Maidanski


Add comment


Name*
Email*  
Country     


  • Comment
Loading




close
NEXT ARTICLE
News Briefs: July 15, 2008
Enea is named to the board of CP-TA, Teradata introduces a new version of its data warehousing tool and SOA Software upgraded its Repository Manager to accommodate its Policy Manager software Read More...
 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 

Download Current Issue
FEBRUARY 2012 PDF ISSUE

Need Back Issues?
DOWNLOAD HERE

Want to subscribe?


 
blogs tab
Are you at risk for burnout?
Burnout is a severe problem and it can strike at any time. Here's how to tell if you are nearing the edge.
02/09/2012 02:16 PM EST

Agility, mom, and apple pie
If we're to evaluate the state-of-the-art in software development, we should start with the values espoused in the Agile Manifesto.
02/07/2012 11:57 AM EST

RIM woos developers with free tablet
How do you get more apps ported to the BlackBerry PlayBook? By giving every developer a free tablet, of course!
02/04/2012 01:57 PM EST

GitHire: Use Headhunters to Find Your Perfect Programmer
Are you a hiring manager tired of scouring the job boards? Check out this new service that will find 5 people interested in your jobs.
02/03/2012 12:17 PM EST

Facebook claims hacker cred
Facebook's SEC S-1 filing form includes a short essay on the Hacker Way by Mark Zuckerberg himself.
02/02/2012 08:26 AM EST

Ryan Dahl steps down
Ryan Dahl, creator of Node.js, steps back from his position as gatekeeper for the project.
02/01/2012 04:58 PM EST

 
Events calendar tab
2/13/2012 to 2/16/2012
Santa Clara
TechWeb

2/26/2012 to 2/29/2012
San Francisco
BZ Media

2/27/2012 to 3/2/2012
San Francisco
RSA

3/4/2012 to 3/7/2012
Las Vegas
IBM Tivoli

3/5/2012 to 3/9/2012
San Francisco
TechWeb