Converting Java Services to .NET 4.0 Services (WCF ) - java

We have to convert around 100+ services written in Java to .NET (C#) 4.0 . We are trying to estimate the efforts for this work. I am trying to find out if any tools are available for this conversion/ migration and any experiances of using these tools in real projects.
We need some pointer for evaluation of different possible ways of getting this job done.
Any converter tools or check lists for conversion of Java services to WCF services
With automation using the tools, how much of the codes gets converted ? Any stats like X % of the effort can be saved etc.
What will be the quality of code generated ? We are looking for .NET/C# 4.0 with WCF
Was the tool user friendly? How much learning curve?
If any experiances of doing the conversion manually , then please share any guidelines used for conversion and any tips for doing effort estimation.
I have googled to find out a list of conversion tools available. Please share any Experience of using any of the following Java to .NET/ C# Conversion
Java Language Conversion Assistant 2.0 -
Java Language Conversion Assistant is a tool that automatically converts existing Java-language code into Visual C#
Janett - Java to .Net Translator -
Janett translates Java syntax, constructs and calls to Java libraries to C# / .Net counterparts.
CSharpJavaMerger Framework -
Free and open source C# and Java conversion tool
Java 2 CSharp Translator for Eclipse -
That tool makes it possible to automatic translate Eclipse java projects into Visual Studio projects. Generated code can be directly compiled and executed whitout any user modification.
Tangible Softwaresolutions - Not a free one but looks to be useful.
Sharpen - A guide to Sharpen - a great tool for converting Java to C# ( http://www.pauldb.me/post/14916717048/a-guide-to-sharpen-a-great-tool-for-converting-java )

Of the Java to C# converters listed in the comprehensive summary above, several projects have not been actively maintained for several years.
Java Language Conversion Assistant was provided with Visual Studio 2003 and 2005 and has since then been discontinued
The latest release of Janett that I could find was from 2007.
CSharpJavaMerger Framework is a more recent project, but with limited documentation to support it.
Java 2 CSharp Translator for Eclipse was actively developed as late as 2011. Limited documentation to support it though, and requires integration with Eclipse.
The two most promising projects are thus probably Tangible Software Solutions' commercial Java to C# Converter and the open-source alternative Sharpen (originally developed by Versant). Both these products do a fairly good job at converting Java to C# code, but in either case you should expect to have to do substantial manual reviewing and correction of the converted code.
Sharpen needs to be plugged-in to Eclipse, and there is also some manual pre-configuration involved to get the conversion running. Configuration is described in more detail here. The easiest way to get started with Sharpen is to obtain a prebuilt Eclipse plug-in from the NGit Github repository. Sharpen has been proven to do quite impressive conversion work; it is for example used in converting JGit to NGit. A Sharpen "on steriods" is also used to convert the Android/Dalvik JVM source code into C# in the XobotOS project. Unfortunately, the XobotOS Sharpen version is not easily applicable to other conversion projects.
I have also tried the Tangible demo converter and it seems to do a fairly good conversion job as well. In particular I appreciated the easy-to-use GUI with good conversion reporting. Another advantage is that it can be run standalone, i.e. there is no Eclipse or other IDE dependency. The product is also actively maintained (most recent release in July 2012) and with a commercial product you should also expect to have at least some technical support.
Whatever your choice, though, you have to be prepared for substantial code review and correction. My recommendation is that you start off by testing both these products on a few of the services subject to conversion to get a rough estimate of whether (semi-) automated Java-to-C# conversion is really worth the effort and investment.

Related

Is Java Cross-IDE plugin development possible?

This is a simple yes or no answer out of curiosity.
I've seen some pretty decent cross-platform java tools such as Codemane One (capable of generating applications for multiple mobile platforms out of a sigle Java codebase). They handle major API differences and are able to generate cross-platform UI layers.
I am wondering if anyone is trying to accomplish the same thing for IDE plugin development? IDEs underlying platforms and development models are so complex that, even when they are written in the same language (such as Java), you end up developing separate plugins for each IDE.
So, is there a equivalent of Codename One targeting IDE plugin development? Is anyone working on that? (Obscure academic research is ok if they have developed something useful).
The Java Specification Request 198 "A Standard Extension API for Integrated Development Environments" was released in 2006. However, nothing major seems to have happened from then. So, basically the answer is no.

Scala or Java based on IDE and Memory footprint

We have huge stack of xml files (around 5000+ files) possibly about 80 MB when not compressed) all of them are device configurations used for read & write data & build user interfaces without any language dependencies. These XML files can be ported to any technologies like Android and Apple world. Not all the 5000+ are loaded at one shot to memory, we might load 200 files into memory based on 1 device connected. We have a .NET/WPF based application which is using those XML files to build the UI and access the device information through protocols like Modbus & Hart (Don't bother protocols now). Anywhere we need custom logic, we have written them in DLL's (in .NET) and we use the reflection & IoC to load those DLLs, create object and access them through interfaces at runtime to complete the XML configuration. On desktop, then we build UI and load configuration
Now We need to develop Android app which runs on Phone and tablet as well. I have 1 year experience working lightly in Java. We could write a core modules which can be used for both phone and tablet and UI layer which is just to render our XML as a UI elements. We know to use Java's Class Loader to create instance so that instead of DLL's we could build .jar file in Android world and load them (if possible?) and access via interfaces. When we load our XML, it will consume nearly 80 to 100 MB of RAM (in WPF & .NET).
When looking into Android world, I could not decide whether to go with Scala or Java. We do not have any Java expert to advise us. Having worked on Python, I feel like Scala is modern & good choice. Also I read that Android apps compiled using Scala is fat(big), take long time to boot up.
But coming from Visual Studio background, we are much sophisticated development team expect everything to run through IDE. Also team has to learn Java/Scala whatever our choice from start.
If we choose to work on Scala on Android, do we except the memory efficiency is near to Java? Also do we have sufficient IDE support (Eclipse or NetBeans or IdeaJ) for Scala?
I am specifically looking for Memory footprint (internals) and IDE support for building Android application. No discussion on performance or productivity..
My Scala IDE is Maven in one terminal window and Vim in another. The browser serves up help documentation. If you can base your build process on Maven, then any IDE should do fine. And since you are working a lot with XML files, I suggest that you do base your build process on Maven rather than SBT.
Of course, there is Eclipse support for Scala, Intellij supports it, there is a Netbeans plugin for Scala, even a Komodo language extension for Scala. Lots of IDE choices to try out. Only the developer knows what works for them.
Make half a dozen identical VMs. Install one IDE on each one of them. Get the developers (end users of the IDE) to test them and choose the one that they want. Do all of the build and continuous integration with SVN and Maven. Make that the boundary between the developers'personal toolset (the IDE or Emacs or Vim) and the supported development tools.
If you're coming from C#, I'd advice choosing Scala. That way you could actually preserve some of your business logic, because good C# code might probably look a bit like things are done in Scala, too. E. g. LINQ in C# and Scala's collection classes (v.s Java collections).
The syntax is a bit different compared to Java/C#, but syntax is hardly a real problem these days.
Java's IDE support is pretty good, but if you're coming from Visual Studio, Intellij (or Eclipse) + Scala plugin might be good enough for you.
If you program the same code in Java and Scala, memory consumption should be pretty the same.
You should keep in mind that you should use ProGuard to keep the size of the Android application manageable.

Starting with Android: Java or Python (SL4A)

I just ordered an Android smartphone and want to start playing around with creating my own applications. Now the question is which language to use, the native Java or Python using SL4A (former ASE).
I tend to Python, as I know it much better than Java, but I'm wondering what I would be missing using a "second class" language on Android. On the SL4A website it is also stated to be alpha quality software, which is not exactly encouraging.
I'm also not quite sure what the limitations of the scripting environment are and if they would be problematic.
At the moment you cannot create a releasable program with Python (or any other scripting language) using SL4A. I have heard rumours that this is something Google is working on, but even if they do enable it Python apps are likely to be slow and power-hungry compared to Java. Also the scripting API only gives you access to a limited subset of the native Java API. I would not consider using SL4A for serious development work at the moment, only for one-off scripts and prototyping.
Take a look at Scala. It is a statically typed language on the JVM, but uses type inference to remove most of the noise that you get in Java. It also fully supports functional programming, and has a lot of pythonish features. Because it is statically typed it is as efficient as straight Java with none of the disadvantages. IMHO it is the language that Java should have been in the first place.
A lot of people are blogging about using Scala on Android, so Google around for more information.
More likely will depend what type of applications you will develop.
I would start with Java to become familiar with Android SDK. Anyway first you need to look into some examples, tutorials. Most of them are done in Java, and only a few, probably on the dev site of SL4A for that.
Also there is native development Android NDK, that can be programmed with C++.
But anyway Java rules for general applications.
Adding an update to Dave Kirby's answer:
Issue 55, Distribute scripts as APKs, in the issue tracker at SL4A deals specifically with that.
There is a solution being worked out (may be complete by now) described at SharingScripts. The only issue seems to be that you need to have a interpreter APK already installed.
you may want to check out Ruboto it is a framework for developing Android apps based on JRuby which means your JRuby code can call Android APIs and can also be called back from the Android Java side.
Here is an introduction article .
Consider ising Kivy, if you want to write Android apps with Python. The process of packing script to .apk file is described here.
The problem is, resulting .apk will be big (~7Mb for 300Kb data). It is obvious, because you need to pack there Python runtime and all libraries.
Another solution I have heard of, is Pygame for Android, but it works on lower lewel, so you need to draw graphics manually.
Unfortunately, I have not tried any of this ways yet, but it looks, that I'm going to start using kivy soon.

Open source projects with Java and Scala interaction

I'm going to give a talk about using Java and Scala together and I want to investigate some projects (large and small) which contains Java and Scala code.
If you know links to correspondent projects post them here.
This page on the Scala wiki is a good starting point...
The various scala testing frameworks come to mind. They all have some integration with JUnit or TestNG
Gimd is one example of small project: http://code.google.com/p/gimd/
Although development stalled for a while because I'm busy with other duties it already contains some examples of Scala<->Java integration. Notably:
unit tests are written using junit
Gimd is using JGit (library in Java) as underlying layer
While working on Gimd I found that using Java from Scala is mostly easy and seamless the contrary is not always true. It's not really a fault of Scala as it's simple manifestation that Java is a less expressive language.
Unfortunately I don't know any open source project but I have worked on very large projects over the last few years that have java and scala interacting and my experience has been mostly very positive. If I had one piece of advice it would be to use scala-javautils. It's a life saver and is far better than the scala jcl code. Before we started using it trying to get some interactions involving collections was heart-breaking. However I'm led to believe 2.8 will solve this.
In general I find the interactions between scala and java very close to using one language.

How can Java code be quickly converted to .NET (specifically, ASP.NET)?

Are there any tools available to simplify the conversion?
What percentage of Java code is converted exactly to .NET code by these tools?
You can try IKVM. Saxon, an extremely popular Java XQuery/XSLT engine by Michael Kay, uses IKVM.
IKVM.NET is an implementation of Java
for Mono and the Microsoft .NET
Framework. It includes the following
components:
* A Java Virtual Machine implemented in .NET
* A .NET implementation of the Java class libraries
* Tools that enable Java and .NET interoperability
http://www.ikvm.net/
You could try this one
http://mayaf.org/janett/
Janett translates Java syntax, constructs and calls to Java libraries to C# / .Net counterparts.
Java is roughly equivalent to c#, so translating to c# should be relatively straightforward.
The path from a Java webserver to ASP.NET is less clear.
You might try to the Java Language Conversion Assistant from Microsoft. I think they may have dropped support, but now ArtInSoft seems to have a related product:
http://www.artinsoft.com/pr_jlca.aspx
There's also Octopus from Remotesoft:
http://www.remotesoft.com/octopus/
The issue with porting from Java is usually not so much the language itself, which is pretty similar to C#, as it is the libraries.
Of course, a web app will present an additional layer of complexity. If the app doesn't have too much code at the page rendering phase, it shouldn't be very difficult. If the page is riddled with code, then you may be better off re-writing it than trying to port directly.
Have you considered using J#? It's no longer supported but if you're just trying to get onto a .NET language, that might be the fastest path.

Categories