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.

I've had some discussion with colleagues who chose to go with JRuby along the following line of argumentation:

JRuby can make use of anything that is available in Java, ergo such programs are more portable bc Java is more portable.

Arguably, the breadth, capability and speed of C/C++ libraries that have been wrapped for Python is still better than what is available in Java. But since this is C/C++, all the problems with portability reappear this way - or so their argument went.

Have you ever had such a problem? that is, problem with portability of Python's extensions?

Personally, I have never found this to be a problem, but YMMV, while theoretically and potentially this is a problem. I'm curious of your experiences.

share|improve this question
    
you can use C libraries in java as well (look up JNI) –  ratchet freak Feb 5 '13 at 12:17
4  
C and C++ are the most portable languages out there to this day. Unlike Java you have to carefully design C/C++ code to be portable, but all platforms need C and C++ compiler (you can't build JVM without one) while some mobile platforms don't have JVM at all or only have one with poor performance. –  Jan Hudec Feb 5 '13 at 12:45
2  
I'm not sure this is a valid comparison. JRuby is an alternate version of Ruby that uses the JVM and can thus use Java libraries. Jython is the python equivalent. Standard Ruby uses native C or C++ libraries, like Python. If you want the Java libraries but would rather use Python than Ruby, you could look into Jython. –  KChaloux Feb 5 '13 at 14:04
    
@JanHudec: sure, but imagine the following scenario: there are Python wrappers for C/C++ libraries A, B and C. A and B are available say on Windows, B and C on Linux and only C is available (ported) to AIX. I have not encountered such scenario in practice apart from trouble of compiling mod_python on AIX (even then this is debatable as mod_python is extension to Apache not Python as such). The question is, is such scenario a real problem, which is my RoR/JRuby colleagues asserted? –  mrkafk Feb 5 '13 at 15:10
3  
If you're calling lower-level libraries from higher-level languages chances are you are doing something that invovles system-level calls, and that's when you realize that Java is only 100% portable in theory rather than practice. –  MrFox Feb 5 '13 at 15:19

1 Answer 1

This is almost an impossible question to answer in the abstract. It depends on what type of programming your doing (systems, enterprise, application) and your definition of portability.

At my current job they did try JRuby precisely because it had the promise of playing nicely with the JVM (before I got there). They ditched because, practically speaking, they found coding calls to Java somewhat cumbersome and switched to Groovy. I've also, anecdotally, had problems running pure Ruby libraries in JRuby - for whatever reason. But writing portable C is not easy. I used to run MRI Ruby on Solaris and there were some native libraries that required a lot of tweaking before they compiled.

You might find more libraries for interfacing with "enterprise" software and "enterprise" crap... err... systems in Java than in C/C++. But as @MrFox pointed out - Java ain't no systems language. If your definition of portable is runs on Linux and Mac OSX, a lot of Python wrappers have worked for me with little or no problem (except for some SciPy related stuff). (I will admit I am a python dilettante and if I were more hard core I might run into more edge cases). If your definition of portable includes OpenVMS and zVM, then Java is your best bet.

share|improve this answer

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.