Interview and Book Excerpt: Ola Bini, "Practical JRuby on Rails Web 2.0 Projects"
JRuby core developer Ola Bini sat down to talk with InfoQ about Ruby and how he came to be involved with JRuby. In the interview Bini talks about the challenges of developing JRuby and where it is headed in the future. In addition to the interview, InfoQ is also proud to present an excerpt from Bini's book Practical JRuby on Rails Web 2.0 Projects.
How did you get involved with Ruby and JRuby?
So, I've always - for certain values of always that pertain to someone 25 years old - been a LISP-head, but that never payed the bills so I ended up doing mostly Java work. Since I'm somewhat of a language/compiler geek too, I've always been shopping around for languages, and about 4-5 years back I found Ruby. I liked it immediately and started to get my then current workplace to switch from all our ugly Perl/AWK/Sed/bash-scripts to using Ruby instead. That didn't go over so well, but I started infiltrating and converting smaller system tasks to Ruby anyway. After a while people started noticing and seeing the benefits. And then Rails showed up... Java was our Web development platform for a long time, but Rails promised a better store. It took me 18 months and two applications to convince the workplace about that (and when I say convince, that means not only my boss, but the management too - that's the hard part). So that's my Ruby story. As far as I know, that employer is now doing 50/50 Ruby/Java depending on task, so I guess I managed to make an impression there.
During all those years with Java I always tried to find a better way of doing it. I slowly realized that my problem wasn't so much with the JVM or the libraries, but with the Java language itself. Seeing lots and lots of languages makes it very obvious how crippled Java is as a language. I know the reasons for it being crippled but that still doesn't fix my problem. So I thought about other languages on top of Java. I became committer to the Jatha project (a Common Lisp on top of Java), but for various reasons I felt that Lisp still wouldn't be allowed in most places, so I turned to Ruby (which is very LISP-like when you get down to it). In a nutshell, that's how I found JRuby and started contributing to it. And that was almost two years ago.
What is your favorite feature of the Ruby language?
I don't have one really large feature that I'm fond of really - the thing about Ruby is that it's all the small goodies that mesh together to a very enjoyable experience. But from a language stand point, the most important features are definitely modules as mix-ins, and unobtrusive blocks.
As JRuby makes its way into more dev shops and the enterprise, do you think there will still be a strong need for frameworks like there is in the Java realm?
I think frameworks is a part of life, no matter what language you use. The reason we're not seeing that many frameworks in Ruby yet is basically because most people aren't tackling large problems with it, so the demand for many frameworks for different things aren't there yet. Of course, stuff like DI frameworks or AspectJ lose their meaning when the language is more powerful.
In your book, you mention it took more than two years to convince your employer at the time to start using Ruby. What obstacles remain today which might get in the way of developers convincing their employs to embrace JRuby?
The obstacles to starting to use Ruby was caused by conservatism and the fact that even though Ruby had been along for a long time at that point, it was still considered a very new technology. Companies are usually quite conservative, and the same thing will happen with JRuby - the thing that really makes this better for JRuby though, is that it runs on Java. Just being able to add Java into the conversation makes JRuby more acceptable. The other problem for JRuby right now is lack of documentation - we have some, but it needs to be better. Hopefully my book will help with some of that.
There are ever increasing Ruby/JRuby IDEs becoming available. Are there features or tools not yet on the market that you feel are are still absent? Do you use an IDE for Ruby development?
That is kind of fun. I actually don't use any IDE at all. I'm an avid Emacs user. I can't really abandon all my thousands and thousands of E-lisp code that customize Emacs to be my environment of choice. That said, many things in NetBeans and IntelliJ's Ruby support looks incredibly cool. I know that all the other JRuby core developers use NetBeans all the time.
You've mentioned your frustrations working with database implementations of JDBC drivers during your work on AR-JDBC support. What other challenges have you had working as a JRuby contributor?
Yes, handling databases have never been the most fun part of my life. But actually, I think I exaggerate a little bit in my blog post. The things I find are quite minor if you know about them - but I like to write them up so that Google can find it for other people.
JRuby in itself has a few distinct problem areas, but these are mostly caused by some specific Ruby features. For example, ObjectSpace is such a pain and resource drain that we're considering turning it off by default. Also, there are many nice corner cases of Ruby that can cause weird behavior and even bugs. Sometimes we've had to cripple JRuby to emulate a Ruby behavior that seems totally wrong to everyone who sees it - we want JRuby to be totally 1.8 compatible, even if that means including the bugs.
Some say that dependency injection, and the accompanying frameworks such as Spring, is less important in the Ruby space. Do you think this holds true in the JRuby space?
I agree that Ruby in itself doesn't need DI frameworks at all. But JRuby can make good use of it, especially on the borderline where you mix Java and Ruby. As an example, you can script Ruby beans with Spring today. Using Spring to inject Ruby code into Java is used in several places (including Waffle, a new web framework by fellow ThoughtWorker Michael Ward). So there is absolutely a place for it with regard to JRuby.
There seem to be isolated examples of JRuby being used for publicly available, production software with the exception being the recently released Mingle product from Thoughtworks. Why do you think we haven't seen more examples of JRuby being used?
Right now most people are in the development phase of JRuby products. The fact that TW was so quick with getting a product based on JRuby out was that much of the code was written in MRI before that, and then ported to work with JRuby. Also, the Mingle team consists of incredibly talented programmers - without all of these factors, I don't think it would have been possible to get Mingle out that quickly.
Right now I know of several web sites and projects using JRuby - most in development, and most are not talking about it at all yet. But I expect there will come a few announcement in a few months time.
What kind of projects are a good fit for JRuby? What projects are not a good fit? Why?
Well, JRuby is a very good fit when we're talking about integrating with Java systems, when the deployment is dependent on an IS department that isn't used to Rails deployment. In fact, in all cases where Java is involved in any way, JRuby should be a good thing. It also helps to improve the general deployment story. The second part is harder to answer. If you're doing a simple CRUD Rails application, JRuby is probably overkill. You tend to get more benefits from JRuby when your application is medium to large sized.
In your mind, what's the most exciting things coming in the near future in the JRuby space?
1.1 is going to be really cool. A new market for JRuby will open up when we have total precompilation perfected. Also, once general Rails performance improves, I believe that many Rubyists will take more notice.
On a longer perspective, I think the Rubinius work is really important, and everything we can do to help each other is going to be exciting - using Ruby to implement most of the core libraries and so on.
Roy Rapoport Aug 28, 2014