My team has been doing Java for a long time. We are switching to Ruby. We are finding that Ruby has limitations and that we have to do certain things in Java. I’m trying to find a way to call Java code from Ruby. I’m searching Google and such, and I always end up on a page describing how to call Java code from JRuby. That’s not what I want.
Then I start to wonder why we’re NOT using JRuby?! Instinctively, I’m thinking Java and Ruby is what we’re doing. JRuby is the best of both worlds. What am I missing?
I’ve asked around a little bit and I’ve heard a few negative things about JRuby, such as memory issues or diminishing oracle/community support, or whatever. Is JRuby a dud? Or is it viable for real-world, large-scale, mission critical apps, the way Ruby/Rails supposedly is? Is there a reason that we should be coding in Ruby AND Java instead of just going with JRuby? Can we not use Rails if we do JRuby? I mean, why wouldn’t you want access to all the comprehensive features in Java, combined with the ease/fun of Ruby?!
Check out this railscast if you’re competely new to JRuby.
I haven’t used JRuby myself but I know people who have used it in production and it does seem to work well. A couple of things
I’ve heard because of the way the JVM works the startup time is quite slow as it optimizes things. And, you might run into compatibility issues with certain gems.
Can we not use Rails if we do JRuby?
You can use Rails in it’s entirety, you just also have access to all of the Java libraries should you need them from Ruby.
I’d seriously question why you need to access Java from Ruby though. Obviously, including Java in your stack is adding complexity you might be better off avoiding. You say Ruby has limitations, and that may be true but what in particular are you referring to?
Working with services / api’s might be a better option, you’ll need to do some research.
I am forced to use Java because we have legacy systems that we must communicate with using CORBA. So far, all attempts to do CORBA calls directly from Ruby have failed. Support is weak, options are limited, everything I’ve tried hasn’t worked, etc. Given that I have already implenented this in Java and it works great, I figure I’d just reuse that module. I would of course rather do this from within Ruby. It’s ridiculous to have to run a JVM on top of my Ruby runtime JUST to do a CORBA call here and there. So please let me know if you think I should keep trying to make these calls from Ruby. I just wasn’t feeling the love from Ruby and wasn’t getting anywhere.
We use JRuby in conjunction with java and it work great on a JBoss cluster in production.
Legacyworld we connect with soap (no toolbox, just posts).
Inernally we communicate rest and with java assync via hornetqueue. Functions like jndi we just call java from jruby …
Result : great !
I really don’t see a reason why would go from Java -> Ruby or vice versa. The hybrid seems absolutely horrible solution. Stay with 1 platform languages.
Also, don’t buy into the hype of Ruby “Look Ma! I auto-gen the code for database tier with no hands!”. If you write QUALITY code, 60% of your code should be in TESTING and 40% on application code. Of course, it is hard to maintain these ratio when there are hard deadlines and your customer give rat ass about the quality. Anyways, to me I would use a language that provides me the BEST way to test my code and not the FASTest way to write the code. Yes, it’s great to write code fast that actually works but I rather have slow coding with awesome test cases. So, if there are any new codes merging in then I can easily detect problems early. I pray that I’d never join another project where the developer’s test manually and say “I’m done!”. No no no… Choose your weapons wisely and I can definitely say Java has GREAT way of testing your code.
Because of the fact that ruby is a non typed language testdriven is a philosophyIn the ruby way it is recommended to write the test first (OK I not always do this but most times) . Your right when you say choosing the best language for the problem. But if you consider to bring cobol programmers in the web world You have also to take into account the learning curve. And the learning curve is very short in ruby. In our team it is very intresting to compare a character who programms java and a chrarcter who programms ruby.