CS2J

SCORM Explained

Convert C# Source Code to Java Source Code

Rustici Software recently completed development of a tool which automatically converts C# to Java (which we geeks are calling “CS2J” for now). CS2J operates at the source code level to provide a full and faithful representation of the original C# source code in Java. To our knowledge, CS2J is the only fully functional source code level tool for C# / Java conversion. The resultant Java source code is human readable with a style that mimics the original C# code.

Why this Tool?

Rustici Software sells its SCORM Engine component to Learning Management System software vendors. While most of these clients use the Microsoft platform, many of our customers also run on Linux or other non-Microsoft platforms. Since the SCORM Engine is an integral component in our customers’ software, tight integration, transparent source code access, optimal performance and unencumbered distribution are all very important. CS2J allows us to:

  • Maintain a single set of C# source code for our application but support deployment on any platform
  • Produce professional, clean and accurate Java code that mimics the style of the original C# code
  • Continue to develop using Microsoft Visual Studio and the rest of our existing development environment
  • Provide full source code to our customers on both the .Net and Java platforms
  • Customize the translation from C# to Java to meet our application’s particular needs
  • Optimize the resultant Java source code to achieve highly performant solutions (and include those optimizations in future conversions)
  • Automatically run source code conversion in our nightly build script
  • Distribute our application with no per server royalties on the translated code (as other vendors expect)
How it Works

The tool works by parsing the C# source code into a generic syntax tree. The .Net library calls are then extracted from the syntax tree and converted into their Java equivalent. Where equivalent Java translations are not available, custom methods may be inserted. The translator provides full access to provide custom library translations to optimize the conversion of individual applications. After the syntax tree has been fully translated, a pretty printer outputs the resultant Java source code.
How CS2J Works

Interested in Using CS2J?

We’re currently throwing around ideas for releasing CS2J to the public. We are considering licensing it, offering conversion as a service and releasing it as an open source product. If you have a need to convert C# to Java, please introduce yourself. We’d love to hear from you and discuss how we might be able to help.

CS2J isn’t perfect yet, it is precisely good enough to translate our product. It handles the translation of the C# grammar quite well providing a solid foundation for all translations and removing a large chunk of grunt work. However there are still many, many, many library calls still to be translated. Fortunately, adding new library calls is a straightforward process that simply requires adding new entries into XML configuration files. We have licensed the technology in this state to a few organizations, if you could benefit from a similar arrangement, please let us know.