C # / Java Portability

In what main environments, templates and tools would you decide to simultaneously develop two projects: one in C #, one in Java, to minimize the overall effort. (Ignore the obvious cases of interchangeable or equivalent tools such as SCC, Unit Testing, etc. Also assume that there is general broad support for RDBMS.)

β€œMainstream” means that the market will not ignore the result at all, because it uses something untested that they never heard of, or secret skills are required to support it.

Imagine a widely applicable tactical business application.

+3
source share
5 answers

It's hard. Despite having good libraries available on both platforms, when it comes to frameworks, there doesn't seem to be much in common.

The drift I got here on SO is that there are not so many deviations from the company's line in the .NET world. It would be as if everyone in Java used only EJB, JSF, and JNDI and never met Guice, Struts, or Hibernate.

If I could, I would take a different approach: instead of simultaneously developing the same system, develop one system and put a wrapper around it to support other platforms. The disadvantage of this is that other platforms are doomed to lag behind the primary, for example, Mono. This flaw also applies to the ports of some libraries, such as Spring.net or Guice.net.

Or you could come up with your own Wasabi .

+1
source

db4o uses a built-in tool called sharpen to maintain a single source repository (I think, I think) and automatically convert it to C #.

As stated in a blog post:

Before you start dreaming: sharpen is not a magic wand. Do not expect to submit this arbitrary Java application and get a running version of .NET with the click of a button. The translation process will require some design compromises on the Java side, and parts of the .NET code must still be processed manually and integrated into the converted sources.

However, this is still a pretty cool project. In addition, I think it will work better for a new project. Released under the GPL, but you must register developer.db4o.com to download it.


Edit: Here is also an example blog.

+3
source

I read good things about Mainsoft applications, although I never had to use it myself.

+1
source

Why do you want to develop for Java and C # in parallel?

You can just use Java and J #. The only problem is that J # is stuck at Java 1.4 level, so you have two options:

  • do not use such fancy things as transfers, generics, for each
  • use a tool like retroweaver to convert 1.5 back to 1.4

I just finished creating a mid-sized application (about 80 classes / 30,000 lines) that works fine in Java and .NET this way.

As far as I know, Java classes compiled by J # are .NET bytecode that is similar to any other .NET bytecode and can be used in C #. But you do not need to specify your main classes twice.

0
source

Depending on the scale of the project, I would suggest the following technologies and approaches:

  • Since the UIs in Java and C # are so different, I would build an XML representation of the user interface for both projects ... And then choose one of two options a) Static and single generators of the original user interface classes for both projects based on common XML (this can be integrated in some way with your construction process so that the whole process starts automatically) b) Dynamic generation of the user interface in both cases (it may be more difficult to implement)

  • To make the architecture of both similar projects, I would use Spring and Spring.NET

  • Also, to attract as many acquaintances as possible, I would choose NHibernate and Hibernate
0
source

All Articles