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.

Since now there are several good languages that target the JVM and can interop with Java with varying degrees of painlessness, and likewise for the CLR (especially with the recent addition of F# as an "official" language for the platform), it seems to me like more places could take advantage of this but are afraid to.

In my own workplace, we can only write our components in C#. It's a good language, and I don't mind programming in it, but I'd really prefer to be able to use F# sometimes. I'm sure if we were in Java-land things would be similar, where I'd prefer Clojure or Scala. This is probably selfish of me, as I'm sure it's safer to stick with a lowest-common-denominator.

What are your thoughts on this issue? Should more people take advantage of the great interoperability on these platforms?

share|improve this question

10 Answers 10

We use C# and VB.Net here. We don't normally mix languages on the same project, but are doing so on my present (fairly large) project.

The reason using both is that we decided to move from VB.Net to C# as our standard language, so we've still got a lot of VB.Net code to maintain. However, we do try to cut new code in C#.

Mixing languages does cause minor problems on the current project. During refactoring, for example, we occasionally need to move code between classes whose language is different. On the whole, however, these issues are rare and relatively easy to overcome. To a large extent, this is because (1) both languages are very similar, and (2) the project is fairly modular, and we tend to stick to a single language in each module. Occasionally, I've bulk-converted a module from C# to VB.Net, which has proven fairly easy in practice.

Personally, I'd like start using F# as well - but don't think that would be sanctioned any time soon, as there is little business justification.

share|improve this answer

Take a typical web project. It usually mixes:

  • a general-purpose language (e.g. Java or PHP or Python or...),
  • SQL: even if you use ORM, you have to read SQL well,
  • a templating language, usually not exactly dumb, e.g. XSLT or Smarty or Jinja,
  • HTML + CSS in which you usually initially code your pages and then translate it to the templating language,
  • Javascript, which can grow fairly complex in certain projects.

Here we omit build and deployment scripts which are usually 'too simple'.

Of course, usually people that deal with SQL are not the same people that deal with HTML. But usually all team members need at least an ability to read each other's code and understand it at least superficially.

share|improve this answer
    
+1 in a small web company like the place I work, the devs will often do the lot, .NET with C#, JavaScript, SQL... –  RYFN Feb 25 '11 at 16:13

We mix Java and Groovy code in our projects. Groovy has been chosen over JRuby or Scala as it accepts normal Java syntax and has the usual benefits from dynamic languages. Usually we use Groovy for web-near stuff, sometimes using Grails to do the hard work for us that will take a lot of code to do in Java.

I would really like to see the use of more "modern" languages like Scala or Clojure, but that would take a lot of expensive and potentially unproductive retraining.

share|improve this answer

There is no problem in mixing languages. Any decent project is a way much more complicated than any programming language, so adding new languages won't affect a newcomers' learning curve. And if a particular language allows to reduce the complexity of a part of a project, it must be used. The common paranoia about using heterogeneous set of languages is absolutely unjustified and destructive.

share|improve this answer
    
I was thinking the same thing, personally. But it seems there are definitely supporters for both sides! –  J Cooper Feb 25 '11 at 13:28
    
the issue isn't the learning curve of the language, but the langauge's ecosystem which must also be learned. –  jshen May 23 '11 at 21:34
    
@jshen, in most cases those languages form a single larger ecosystem anyway (e.g., a unix ecosystem, or .NET ecosystem, or whatever) –  SK-logic May 24 '11 at 10:09
    
I wish that were most cases in my experience :) I've worked at a number of places that are all over the map. I agree though, if you stick to an ecosystem, there's lot's of benefit in using a few languages within that ecosystem. –  jshen May 24 '11 at 16:34

@Digger: What kind of interop issues? Is it the pure "don't CTS stuff that's not in the CLS" (which is already restricting you quite much), or are there more issues?

(Sorry, I wanted to comment, but have no permission to do that yet)

share|improve this answer
    
COM Interop mostly. This article (blogs.msdn.com/b/netcfteam/archive/2005/07/24/442612.aspx) details the most common issues (old article for .NET 2.0 I think), most of which I have encountered at one time or another, interesting stuff tho! (+1 BTW to allow you to comment, as I think you need 50 rep) –  Scott Sellers Feb 25 '11 at 9:42
    
YES - I can comment now ;-). Thanks for explanation too - interesting stuff for sure! So the "general" problem is communication without the CLR - didn't catch that the first time. –  vstrien Feb 25 '11 at 9:45

Not good for business, But certainly interesting to personnel.

share|improve this answer
3  
Please expand your answer to include why you think it's not good for business. –  Anna Lear Feb 25 '11 at 18:36

We use a mix of C#, C++ and VB at work, in the same product.

This does lead to some interesting interop issues! It keeps my work interesting and challenging, which I think is a good thing, others may disagree?

This also means I gain experience in various languages and styles. Which can only be a good thing?

share|improve this answer

We use both Java and C#, but in different departments, and never on the same projects.

share|improve this answer

We have same restriction here, C# only; but we have the privilege to learn and develop hobby projects in any language we like, in free time.

From company perspective, it is the right decision. There are so many factors to consider like maintenance, knowledge transfer etc, and attrition level went up after recovering of recent financial crisis.

share|improve this answer
    
In your free time you're free to do what you want :P –  graffic Oct 5 '11 at 14:52
    
@graffic - really?! :p –  Coder Hawk Oct 11 '11 at 5:22

For technical reasons, we mix Groovy and Java here. But I think that you should rather avoid such a mixture unless you have really good reasons. Maintenance becomes much harder when you have to know 5 different languages.

share|improve this answer
    
We mix high level and low level languages but only do so when there is some benefit to do so i.e. performance gain in the low level language offsets the complexity added to the project. Having similar components on the same runtime written in multiple languages seems like something that would add to complexity and overhead in a number of ways. –  AlexC Feb 25 '11 at 9:18

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.