Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

We will be starting a new project which will involve training all the .net developers in Java (frameworks/ECO system etc). We have a lot of code written in C# and it seems that all of this will be wasted as we have to re-write it all in Java. The problem I see is that the first year or so (probably 2 years) we will have nothing to deliver as we will spend most of the time reproducing what we had before but now in Java.

Since our team is distributed in different offices around the world and we have a large number of java developers (20 to 30) and 10 developers using .net, we want to get all the developers using the same language/platform so we can start to reuse components/modules. So I can understand managements point of view.

Yesterday I came across Scala and was wondering if it would be better to use this with the current product (which is written in C#) and then at least we will have a working product in a year. Also in a year we have modules that can be used in the Java world whilst we migrate other parts of the product.

Would Scala be a better choice than Java considering what we are trying to achieve?

share|improve this question
1  
Rewriting everything in another language? And 2 years with nothing to deliver? Sounds like a terrible management decision and like you might need a new job in half a year ;) –  zvrba Sep 20 '11 at 9:30
    
Yeah, that was considered. Not sure where I should start looking now and stick to C# :) –  JD01 Sep 20 '11 at 14:37
1  
That's sounds like your about to do a thing you should never do –  back2dos Sep 20 '11 at 17:01
add comment

4 Answers

up vote 12 down vote accepted

Some points to consider:

  • Scala is a great language - but it is worth noting that is it also quite a challenging language to learn and use correctly. Not just my opinion - even experienced Scala experts say so. Depending on the level of skills in your team, it is probably best suited as a tool for your most experienced / expert developers
  • Java and C# are pretty similar in many ways - it won't take long for developers trained in one to move across (the syntax is similar, it's mostly just a case of learning the quirks of each and getting an understanding of the different libraries, which often have similar functionality but are packaged differently and/or have different names). I've personally switched from Java to C# and back to Java again without any difficulty.
  • It's also worth noting that all the JVM languages (Java and Scala, but also JRuby and Clojure etc.) are very compatible - they share the same fundamental JVM platform and can share code / libraries very easily.

Given all this, you might want to hedge your bets and go for a mixed Java/Scala strategy - i.e. migrate to the JVM platform, and focus initially on Java, but keep open the option to use Scala when your developers are comfortable and/or it fits the problem at hand.

From a management perspective this has lots of advantages:

  • You can still share all the libraries so your investments will be safe
  • Your less experienced devs will be able to transfer C# -> Java pretty quicky
  • Your more experienced devs can take full advantage of the advanced features in Scala
  • All the tools are are compatible / can be shared (build systems, IDEs, deployment tools etc.)
  • You get free access to the very broad open source ecosystem of libraries on the JVM (alongside cross-platform portability, this is arguably the best reason to be on the JVM platform)
  • Your developers get to use the language that makes them most productive given their skills / the task at hand (Java in some cases, Scala in others, maybe other languages like Clojure in the future)

The downside is that you still have two primary languages to support. But you probably actually have many more than just two already (shell scripts? domain-specific XML formats? config files? rules engines? HTML? Javascript?) so you could argue that it isn't actually that much of a big deal.

share|improve this answer
    
Thanks for the information. I am just trying to find out what is the best way forward and you have given some excellent information. At the moment we have some good OO developers but no one familiar with functional programming. –  JD01 Sep 20 '11 at 14:54
1  
Glad to help! It's worth being aware that Scala is more of a multi-paradigm/OOP based language. While you can certainly do FP in Scala, if you want languages that are more clearly functional in focus then Haskell or Clojure are probably closer to the mark. –  mikera Sep 20 '11 at 15:56
    
As for code reuse, if I used Clojure or Scala from day one or even as you said in a mixed strategy, could I reuse Clojure/Scala code in both .net and Java? I am wondering if this is a good selling point to management. This way we could still get a product out (the old product with new features) and also be on the road to re-writing existing code in Java with code reuse of the clojure/scala modules. Am I correct in my thinking here or does this open up other problems? –  JD01 Sep 21 '11 at 8:53
1  
You could expose Clojure/Scala functionality as a web service or REST interface if you liked. That is somewhat higher overhead than just directly building a library (which would be the best option if you wanted to call the functionality from Java/another JVM language) but it would certainly give the flexibility to call the code from whatever client you liked (.Net, Java, Ruby, etc.) –  mikera Sep 21 '11 at 8:57
    
Thanks Mike. I think the code reuse path would at least show to management that a complete re-write is not necessary with the Scala/Clojure option. I do not want us to end up like Netscape :). Back to building a library, could I just not use it in .net and java without web services? –  JD01 Sep 21 '11 at 9:32
show 1 more comment

I'll add a 3rd option. Has anyone in your organisation looked at interop between your C# and Java modules? How are you exposing the C# functionality? Is SOAP or RESTFul web services an option?

A 2 year re-write can be a death knell for an organisation (just ask Netscape). However a gradual migration whilst existing code plays nicely with each other has potentially less business impact.

share|improve this answer
add comment

Rewriting C# to Scala will be just as hard as rewriting to Java. As for which language is "better", that point is moot, each language has its own plus and minus points.

I dont know how big your codebase is but 2 years for 30 developers seems huge for a simple rewrite. Picking up Java when you know C# is easy. It took me a day or two to get comfortable with it.

My advice would be to let managment get their way and enjoy the fact your getting paid to expand your skillset.

share|improve this answer
    
Only about 10 developers will be working on the new product. I am just trying to find out what the pros and cons of going with Scala would be. –  JD01 Sep 20 '11 at 8:30
1  
I dont know enough about the specifics of your project or Scala to give you a defiante answer. However it does seem to me that introducing a third language nobody knows would just complicate matters. –  Tom Squires Sep 20 '11 at 8:42
    
You might be right. I was thinking of it in terms of getting a product out in a year or so whilst at the same time being able to reuse code in .net and java. Your points are well noted :) –  JD01 Sep 20 '11 at 8:47
add comment

I think the easier option would be to get the java developers to learn C#. Both the languages are very similar in many ways and it doesn't take a long time for a java developer to pick up C#. I have worked with many java developers who learnt C# and it's usually a smooth transition. The one area where they might get stuck for a while is the WebForms programming model. Java developers adjust better to the MVC paradigm. This way, you need not wait for an year before you begin to develop new features. As regards Scala, I'm afraid that will introduce a whole new problem with all 30 developers trying to learn a new language.

share|improve this answer
    
There are so many products written in Java so getting them to learn C# would be difficult. I was hoping with Scala, once we have the new product, the java developers could use libraries as is without needing to learn Scala. –  JD01 Sep 20 '11 at 8:24
2  
Wouldn't it be ok if you exposed your existing .Net code as services that the java developers can invoke and develop all new features in java. –  Sriram Sep 20 '11 at 8:37
    
That had been suggested in the past but it has been decided that we move away from .net. –  JD01 Sep 20 '11 at 8:50
    
Wow! Then I would keep it simple and rewrite the code in java. I think Scala would introduce one more complexity to manage and it would be a hard-sell to the management. –  Sriram Sep 20 '11 at 9:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.