There's an interesting thread taking place over on the IKVM.NET mailing list. It starts with a post from Alberto Diez:
Dear all,
I have tried the IKVM tool with the Java library weka.jar; I have generatedthe corresponding weka.dll and I have tried out some algorithms under .NETframework (C#, Visual Studio 2005) with really surprising results: it worksbetter (it builds models faster and with less-consuming memory) than underJava (Eclipse framework and directly under command prompt, with the jdk-jre1.6.03 installed)!
I wonder if this is normal or I am doing something wrong...
Thanks in advance.
Kind regards,Alberto.
Dr. Michael Kay then follows-up with:
Sounds good to me!
For Saxon I generally reckon the .NET code is slower than the native Javaequivalent by a factor of 1.2 to 1.5 - but that's on a fairly limitedsample. The .NET code has much faster warm-up time, so it's faster overallfor small jobs.
Michael Kayhttp://www.saxonica.com/
Interesting, though not really all that surprising. Given the fact that:
Java is now open source
The IKVM.NET library is built on top of that source
The Java libraries are compiled to CIL just like any other .NET library
You've got a world class developer in Jeroen Frijters finding every possible way to tweak as much performance into the IKVM.NET VM and compiler
The .NET platform performs better under various circumstances and scenarios
... why wouldn't Java code run faster on the .NET platform, at least under these same circumstances and scenarios?
Oh, and BTW: Interested in running your Java code on Windows Azure? That's now possible too. :-)
2009年3月10日星期二
A Conversation with the Authors of JRuby Cookbook
Henry Liu and Justin Edelson wrote the just released JRuby Cookbook which is available from O'Reilly in both Print and Electronic formats. I spoke with both Henry and Justin about the book, JRuby, and the current state of the Java platform. Here's the transcript of our interview.
Interview Transcript
Tim O'Brien: Let's just dive in. You wrote the JRuby Cookbook - the two of you wrote this book. Could you talk to me a little bit about what's in the book and who you think should buy it?
Justin Edelson: So I'll start. The book really covers a variety of facets of using JRuby. I think it was important to us that this not just be a "JRuby on Rails" book. Ola's book is really good and covers that subject in a fair bit of depth, so we wanted to cover - we certainly talk about rails, but we wanted to look at the whole JRuby ecosystem and the various things that you can do with it. So those range from just using JRuby as a scripting language inside a Java application - there's a whole chapter about GUI applications.
We talk about build/deployment/testing, that sort of stuff, as well as obviously covering Rails, which you couldn't write a Ruby book and not touch on Rails. So we really try to cover a wide gamut of different application types.
Henry Liu: Yeah, and just to add something, I think that the general philosophy or the idea behind the book is sort of taking the practices that happen in the Ruby community, like continuous integration and sort of exploring that intersection with a lot of the common Java practices and a lot of the common Java software. I think that's where you're trying - I think that was the sort of voice they we trying to project out of the book. At least that was what I was trying to project.
Tim O'Brien: So it's more than just JRuby on Rails book. It talks about how to use JRuby inside of a Java application that already exists?
Justin Edelson: Yeah. I think we touch on a few different ways of doing that from using just the JRuby interpreter directly. We talk a little bit about the enscripting framework as well as the newer Javax scripting package to really do language-level integration. And then we have a number of recipes that are focused around using JRuby to define beans in a Spring container, which is a really nice way of making other parts of your application use JRuby, but they don't necessarily need to know they're interacting with JRuby. So using Spring is sort of a mediator there.
Tim O'Brien: I was talking to the Spring Source CEO, Rod Johnson, although I'm not sure if it was the CEO or not. He's definitely one of the primary forces behind the company, and we were talking about Groovy and Gr ails and Spring, and he said that there was less of an impedance mismatch between Groovy and Java, and that there was something of an impedance mismatch between JRuby and Java. Could you talk about that?
Justin Edelson: Well, I'm not sure exactly what he means. I'll say that I think Henry and I both found that the lack of annotation support in JRuby led to a few problems, and so I could definitely see that if - because so much of what Spring has been doing in the 2.0, especially in the 2.5 release, has been annotation-driven, I could see that being an area of mismatch, whereas Groovy as of 1.5 has support for annotations. But on the whole I'm not quite sure what he's referring to.
Justin Edelson: So there's nothing preventing you - from JRuby you have access to the whole of any API in Java, and so there's no real conceptual reason why you can't just "new" up a Spring application context that actually you could have it be a JRuby initializing a Spring application context in which all of the beans are defined in Groovy. That's certainly possible, although we don't go into detail on that in the book.
Henry Liu: I think it actually gets more interesting though when you look at some of the sort of flip side is when you have a Spring container, you're in Spring, and then you can use Ruby to define your controllers. I think that's sort of the angle that we really explore in the book, and that's really where we see the benefit because you get that benefit of not having the benefit of descriptive language, where you don't have to compile things. You can just deploy the scripts up into your production environment and it'll just pick them up right on the fly.
So that's sort of - we sort of look at that aspect of the problem more and not really the given a Ruby application using like an inversion of control container like Spring in your applications.
Tim O'Brien:So if I were working on a Spring-MVC front end for a (Audio Glitch) application I could write one of my controllers in Ruby, and I could (Audio Glitch) right. What is involved there? One of the things that I have always thought is the reason why people don't get into JRuby is what has to be on a class path? Is it just a Jar file for JRuby? Okay, how do I gain access to say something like a gem? Could you talk about that, just the basic process of integrating JRuby and all of the things that come with Ruby into a JVM.
Justin Edelson: Yeah, so from a base standpoint you really just need the JRuby JAR, and this is an area where I think Maven becomes very helpful as a build tool in that you can just add a dependency to JRuby and it's on your class path bundled in your WAR or whatever the deployable unit is. From a gem perspective the primary way of integrating that is you basically set some system properties that let the JRuby runtime know where the gem path is, and we talk a lot in the book about different gem manipulation or management techniques, I should say. There's one use case where if you're using both CRuby and JRuby you might wanna point them to the same gem path.
In another context maybe you want those to be totally separate, and through just manipulation of the command line you can say install these gems to a shared location or to a sort of private location. And then when you run your Spring application in this case you would just make sure that you're setting the JRuby home environment variable correctly to point to your gem install location. And for pure Ruby gems that don't have any need of code, the same gem works in either environment. Obviously native code is a different story.
Tim O'Brien: What is the general sense in terms of gems? So if you look at something like Ferret - is Ferret all Ruby or does Ferret have some C components to it?
Henry Liu: Ferret? That's the search engine, the Ruby search engine.
Tim O'Brien: Yeah.
Henry Liu: I think it actually does have C bindings to it, last time I - at least when you - yes, go ahead.
Tim O'Brien: So how do you find a way around that? I mean, is it just the case that there are certain gems that you just aren't gonna be using from JRuby, and if so, what's the percentage?
Henry Liu: So basically, yeah. If you have gems that have native parts to it that'll compile in C then you have a couple options. The most common gems, like for example RMagick or Hpricot or even Mongrel, they all have JRuby implementations of it, so the parts that are done in native code have been implemented in Java. So you can install this alternative version of the gem when you're in a JRuby environment. The other option obviously is to just do your own porting. You can dig down in and sort of go through the same task. But yeah, those are probably the few main approaches that you'd take if you had a gem that - and in terms of percentage, I can't quantify that.
I have no idea. But the most popular gems at least have been moved across and/or are in the process of being moved across.
Justin Edelson: And there are also a couple of examples where - you know, Henry mentioned some of the image manipulation stuff where I think it's primarily the JRuby team or other volunteers have created API-compatible versions of those gems that instead of using a native layer use a Java layer. And especially I think we found that to be the case around image manipulation, but there's a lot of stuff now in the JRE to handle image manipulation. So all the team has done is really write a wrapper around that that emulates the image science Ruby gem API for example.
Tim O'Brien: For the record, I'd just like to say that installing RMagick in CRuby is something of a pain in the neck, so would you say that it's more or less easy to use the JRuby version?
Justin Edelson: I think there are some font issues that sort of get in the way of doing a -
Henry Liu: Yeah, I think in general it's easier because obviously you don't have to install the RMagick, which depending on your platform can be difficult. But I think the one problem right now is that they have a lot of the library, and every time they release it they have more compatibility with the C version of RMagick, but it's still lacking a little bit in terms of complete compatibility. So I'm sure that there are a lot of fringe cases out there where there may not be 100 percent compatibility. But it's definitely improving, and with every version it gets closer and closer. And it's something I think they're obviously working on.
Tim O'Brien: One of the old JRuby blog posts I think was by Ola Bini, and he talked about how you could use JRuby to sort of launch up the JConsole, and you had more transparency as to what was going on in your application. Could you talk to me about some of the things that are possible in a JRuby app that are not possible in a plain old Ruby app?
Justin Edelson: I think the stuff that Ola's talking about there in monitoring and manageability is really key. JMX in the Java space is pretty well established and there's a solid maturity of the ecosystem; things like Hyperic or even just JConsole and Visual VM, which are now included in the JRE, and the ability to expose arbitrary parts of your application for management is a really nice thing that the Java platform just provides now. I know in the work that Henry and I do there's historically we've done a lot of monitoring at the system level - free memory, thread use, things like that. And being able to bring monitoring up the application stack and say how's this cache doing, how many times are people ordering something?
And then using off-the-shelf tools that know how to speak JMX to graph that is a big win, and something that I think the CRuby community is a little lagging behind the Java community, just because Java has been sort of enterprise focused.
Henry Liu: I just wanted to add one more point about the differences. I'm not an expert in this field, and I haven't really tracked the newest developments, but a lot of people sort of look to the threading support, and that's one main difference. Right now with Java you have the VM has evolved so far in ten plus years or even more in its life, and you have support for running on multiple cores, and you have the threading model is just a little bit better implemented and a little bit more robust. You have real preemptive multithreading as opposed to a lot of the earlier Ruby implementations. I think, I'm not sure, with 1.9 there may be better support, but I don't know for sure.
Tim O'Brien: Question about the Ruby community - the Ruby community - oh, I should be more specific. The Rails community was sort of founded with this ethos of anti-Java bigotry. Now, that might be an unfair word to use. Let's just say they had strong feelings against the Java language specifically. How has that changed? Has it changed? Can you talk about some of the places where the communities don't see eye-to-eye and some of the places where they do?
Henry Liu: I guess when I used to go to the early NYC Ruby meetings, yeah, it was definitely a really interesting crowd, because you had this one side of people in the room who were hard-core Ruby people and never wanted to know Java or learn it ever. And then you had people like myself who had years and years of Java experience, dying to learn some new technology. And I think it's always been kind of an awkward match to not necessarily a perfect kind of marriage in any way, but I don't know. I think JRuby is sort of that attempt to bridge that gap a little bit and try to have these kind of groups see eye-to-eye a little bit, but I can't honestly say that I see that much.
There isn't like this Kum Ba Yah moment where people are just holding hands and coming together. I think that the Ruby people still tend to look for their solutions using the Ruby technology and writing their technologies in the Ruby code; using Java when absolutely necessary, but generally still looking toward Ruby-oriented solutions. I don't know exactly how many Java developers are crossing over to Ruby, but probably more and more hopefully with the book.
Tim O'Brien: Do you want to comment on this, Justin?
Justin Edelson: I think what JRuby does is it actually broadens the playing field a little bit for Ruby in that as Henry said, especially around Rails. The audience for that has been people who frankly in a lot of cases were just burnt out on Java, and what JRuby has allowed is to bring more Java people into Ruby and create more deployment opportunities. To me that's really the biggest area which JRuby brings to the Ruby language is more deployment opportunities, especially within the enterprise where things like JBoss or BA are well-established technologies.
And we really aren't - systems people aren't particularly interested in running Mongrel or other Rails-oriented containers - or Ruby-oriented containers, I should say. And JRuby really allows the broadening of that playing field for them.
Tim O'Brien: So one thing I just have to ask you is both of you are Java programmers. You would call yourselves Java programmers, I guess, if I forced you to choose a language?
Henry Liu: Yeah, I would have to say that. I mean, I do a lot of Ruby development but I think in terms of the mindset, yeah, I'm definitely more of a Java developer.
Tim O'Brien: And Justin?
Justin Edelson: I disagree with the question a little bit. I think we're not - well, in all seriousness, I don't think that we're language - I don't think of myself and I frankly don't think of Henry as a particularly language-oriented developer. I think we're software developers, systems architects, at the core, and we're really interested in finding the right tools for the job. There are certainly people who are Java developers, and when all you have is a hammer everything looks like a nail. But I think especially in this environment you need to be really picky about which tools you use for which job, and find solutions to problems.
And I think that's what I've tried to do, and in working with Henry that's what I can see that he's tried to do. So I would disagree a little bit with the characterization that we have to be one or the other. I spend I feel most of my time in the build and deployment world now, but that's not how I would define myself.
Tim O'Brien: Well, if that were a trick question I think Justin just got an A+. But the reason I ask is because it seems like Java has been having an identity crisis for years and years and years, the platform. Some could argue that it's healthier than ever; some could argue that it's on its last legs. But it's clear that Sun has had a problem devoting resources to it, or at least if you look at something like JavaFX, there have been a series of failed efforts to sort of inject more energy into the platform. Could you talk to me a little bit about whether or not your interest in Ruby is something that is a reaction to that, or is it something that you think would've arose naturally despite what's happened to the platform?
Justin Edelson: It's a little hard to say. I think especially what's happened with Rails has been a recognition that the way that we have been doing development - divorce it from any particular language. But the way that we've been doing development needs to be shooken up a little bit, and that to me is what Rails ultimately did because at the core of Rails all of the MVC stuff is nothing particularly new. The big thing at least that I took away from working with Rails is the fast turnaround development, and that's what - looking at that you said, "Wow, I really understand how this changes the game." The controllers and all that sort of stuff, that's nothing new - it's the process changes. So I think Sun is in a position where they need to try to make the language and the platform more agile and more easily adaptable to change.
Tim O'Brien: Do you think that they're succeeding in doing that?
Justin Edelson: Well, they employ Nutter. I know Henry - and maybe Henry can speak more to this - was really impressed with NetBeans. Not a thing - I have not used NetBeans a lot; historically I'm an Eclipse person, and that I will characterize myself as an Eclipse person there. But I think they are making some strides in that direction. I don't really understand JavaFX - I'm not sure where it fits in. I understand the language; I'm not clear what the strategy is behind that, but they're trying.
Henry Liu: Yeah, and like Justin mentioned, I think that they're doing - I think it's sort of they got a couple hits, but they also have some misses or some half-assed work, I guess. The NetBeans I think is one of the definite better areas. The idea is really good. The feature set is comparable in a lot of ways to Eclipse and to the other popular IDEs. Actually in some things they do better in terms of completion of Ruby code, especially for JRuby developers. JavaFX - I don't know. I worked on a lot of the GUI chapter so I looked at JavaFX a lot and thought about it in comparison to a lot of the technologies that we talk about in the book.
My take-away was that what I thought was interesting was the scripting language itself, ultimately; the JavaFX language that you use to sort of create all the logic and define all the actual components. I just thought compared to Ruby or to JRuby at the end of the day it was just second-rate, and if that's really all that the technology is bringing to the table, this sort of scripting language, I think a lot of the ideal alternative techniques that we talk about in the book are much better. I mean, the only issue is a lot of it is tied into Swing, or a lot of the examples we talk about Swing, but there are also newer GUI technologies that are emerging that are using their own drawing toolkits.
And accessing them through JRuby can be as good as any JavaFX stack, in my opinion - not that I have done that much development, but just what I've looked at and a lot of the examples that I've looked at, it seemed to me that you could do as much or more over in the JRuby plus a toolkit world.
Justin Edelson: The other big win I should mention is GlassFish, which I think especially in the v3, Sun and the GlassFish team have really taken the bloated nature of the J2EE container, the Java EE container and taken that into account and tried to redefine it, which is why you see things like the GlassFish gem, which will allow you to run a Rails application in GlassFish using basically an identical mechanism to the way you would run it with WEBrick or Mongrel. And I know that the Grails team has actually done something similar recently where they're starting to use GlassFish in lieu of Jetty as a low-impact servlet container.
Tim O'Brien: I saw an exchange on Twitter between Tim Bray and someone who works for G21 yesterday. I think Tim Bray was asking, "Why did you switch to GlassFish from Jetty?" I didn't hear what the answer is. It seems to be bucking a trend, though. It seems like a lot of people have embraced Jetty over something like Tomcat. Is it just that they need more of the J2EE features?
Justin Edelson: I can't speak for everyone, but I can say that my perception is that Jetty is used much more in development than in production. And so that may be part of it is that you desire a development environment that's as close as possible to your production environment. So using something like JBoss or even Tomcat, which is obviously lower impact than say JBoss or BEA in development, if you're going for a rapid turnaround, quick reload of the container, doesn't quite work as well. Whereas I think the Maven Jetty plug-in has done a great job of really speeding up Java development.
So I would assume that that's part of it, is that more Grails applications or more JRuby applications are going to be deployed on GlassFish than they would on Jetty.
Tim O'Brien: How did the two of you meet - how did you start working on the book?
Justin Edelson: I've known Henry for I think five years now?
Henry Liu: Something like that, yeah; time goes by fast.
Justin Edelson: Exactly. We worked together at MTV Networks, where we both still work, and I'd come in as a software developer and met Henry pretty quickly, and we just worked on and off together over that span of time.
Henry Liu: Yeah, and I don't think that we've - sorry, go ahead.
Justin Edelson: Well, I was just gonna say that I was thinking about an anecdote, and I'll say that the first thing I can really remember talking to Henry about was telling him that the author of the Lemony Snicket books was a member of the Magnetic Fields, and Henry was unaware of that.
Tim O'Brien: I didn't know that either.
Justin Edelson: That's the first thing that I - I think he isn't actually a full member, but sort of a mostly member. I'm not -
Tim O'Brien: And that was sort of a key pivotal moment that was sort of like a -
Henry Liu: Eureka!
Henry Liu: No, I don't know. I think that we've just always worked closely, but not ever directly on the same project, I guess. But I don't know. Our technology department's pretty small and we work pretty closely together, so I've always been aware of Justin and I've always respected everything that he's ever - you know, if I've heard him speak about something he always sounded very intelligent, so I didn't think twice about working with him. And I did over the years I've kind of peeked through some of his code, and I saw that his philosophy of design and architecture was very consistent with things that I would work on.
I kind of knew based on what I'd seen in the past that we'd be a good fit for trying something like this.
Tim O'Brien: How did you write the book? Was it in DocBook? Was it in the Wiki?
Justin Edelson: We did it in Word, which I'm not sure I will do again.
Tim O'Brien: And who was the editor - was it Mike Loukides?
Justin Edelson: Yeah.
Tim O'Brien: And how is he to work with?
Justin Edelson: I like Mike a lot; it worked really well. Mike is a great guy to work with from my perspective on a technology book because he actually knows the technology. So he was always willing to push us to say what about this, what about that? I can see from a developer's perspective why this is important or why this isn't. So he had some really valuable feedback.
Tim O'Brien: Is this a Java book or is this a Ruby book?
Justin Edelson: That's the million-dollar question.
Henry Liu: I think it goes back to what I was saying - I think it's a little - I don't know. I think we're trying to be a little bit of both but trying to be its own thing. I think it's useful for both. It's the obvious answer, but I think that Ruby developers who want to learn how to leverage some Java technology to make their jobs easier, I think they can take a lot away from it. And I think that obviously Java developers who want to look at what's going on in the Ruby world and learn some of the agile practices that are happening there and learn some new ways of using their old technology, I think that they'll find that really valuable too.
Justin Edelson: Yeah, I think - and this may not be a popular statement - but I actually think at the end of the day the two languages as languages - they're not that different. And so my perspective is that somebody who's a Ruby developer is gonna get the Java parts. Somebody who's a Java developer is gonna get the Ruby parts pretty easily.
Interview Transcript
Tim O'Brien: Let's just dive in. You wrote the JRuby Cookbook - the two of you wrote this book. Could you talk to me a little bit about what's in the book and who you think should buy it?
Justin Edelson: So I'll start. The book really covers a variety of facets of using JRuby. I think it was important to us that this not just be a "JRuby on Rails" book. Ola's book is really good and covers that subject in a fair bit of depth, so we wanted to cover - we certainly talk about rails, but we wanted to look at the whole JRuby ecosystem and the various things that you can do with it. So those range from just using JRuby as a scripting language inside a Java application - there's a whole chapter about GUI applications.
We talk about build/deployment/testing, that sort of stuff, as well as obviously covering Rails, which you couldn't write a Ruby book and not touch on Rails. So we really try to cover a wide gamut of different application types.
Henry Liu: Yeah, and just to add something, I think that the general philosophy or the idea behind the book is sort of taking the practices that happen in the Ruby community, like continuous integration and sort of exploring that intersection with a lot of the common Java practices and a lot of the common Java software. I think that's where you're trying - I think that was the sort of voice they we trying to project out of the book. At least that was what I was trying to project.
Tim O'Brien: So it's more than just JRuby on Rails book. It talks about how to use JRuby inside of a Java application that already exists?
Justin Edelson: Yeah. I think we touch on a few different ways of doing that from using just the JRuby interpreter directly. We talk a little bit about the enscripting framework as well as the newer Javax scripting package to really do language-level integration. And then we have a number of recipes that are focused around using JRuby to define beans in a Spring container, which is a really nice way of making other parts of your application use JRuby, but they don't necessarily need to know they're interacting with JRuby. So using Spring is sort of a mediator there.
Tim O'Brien: I was talking to the Spring Source CEO, Rod Johnson, although I'm not sure if it was the CEO or not. He's definitely one of the primary forces behind the company, and we were talking about Groovy and Gr ails and Spring, and he said that there was less of an impedance mismatch between Groovy and Java, and that there was something of an impedance mismatch between JRuby and Java. Could you talk about that?
Justin Edelson: Well, I'm not sure exactly what he means. I'll say that I think Henry and I both found that the lack of annotation support in JRuby led to a few problems, and so I could definitely see that if - because so much of what Spring has been doing in the 2.0, especially in the 2.5 release, has been annotation-driven, I could see that being an area of mismatch, whereas Groovy as of 1.5 has support for annotations. But on the whole I'm not quite sure what he's referring to.
Justin Edelson: So there's nothing preventing you - from JRuby you have access to the whole of any API in Java, and so there's no real conceptual reason why you can't just "new" up a Spring application context that actually you could have it be a JRuby initializing a Spring application context in which all of the beans are defined in Groovy. That's certainly possible, although we don't go into detail on that in the book.
Henry Liu: I think it actually gets more interesting though when you look at some of the sort of flip side is when you have a Spring container, you're in Spring, and then you can use Ruby to define your controllers. I think that's sort of the angle that we really explore in the book, and that's really where we see the benefit because you get that benefit of not having the benefit of descriptive language, where you don't have to compile things. You can just deploy the scripts up into your production environment and it'll just pick them up right on the fly.
So that's sort of - we sort of look at that aspect of the problem more and not really the given a Ruby application using like an inversion of control container like Spring in your applications.
Tim O'Brien:So if I were working on a Spring-MVC front end for a (Audio Glitch) application I could write one of my controllers in Ruby, and I could (Audio Glitch) right. What is involved there? One of the things that I have always thought is the reason why people don't get into JRuby is what has to be on a class path? Is it just a Jar file for JRuby? Okay, how do I gain access to say something like a gem? Could you talk about that, just the basic process of integrating JRuby and all of the things that come with Ruby into a JVM.
Justin Edelson: Yeah, so from a base standpoint you really just need the JRuby JAR, and this is an area where I think Maven becomes very helpful as a build tool in that you can just add a dependency to JRuby and it's on your class path bundled in your WAR or whatever the deployable unit is. From a gem perspective the primary way of integrating that is you basically set some system properties that let the JRuby runtime know where the gem path is, and we talk a lot in the book about different gem manipulation or management techniques, I should say. There's one use case where if you're using both CRuby and JRuby you might wanna point them to the same gem path.
In another context maybe you want those to be totally separate, and through just manipulation of the command line you can say install these gems to a shared location or to a sort of private location. And then when you run your Spring application in this case you would just make sure that you're setting the JRuby home environment variable correctly to point to your gem install location. And for pure Ruby gems that don't have any need of code, the same gem works in either environment. Obviously native code is a different story.
Tim O'Brien: What is the general sense in terms of gems? So if you look at something like Ferret - is Ferret all Ruby or does Ferret have some C components to it?
Henry Liu: Ferret? That's the search engine, the Ruby search engine.
Tim O'Brien: Yeah.
Henry Liu: I think it actually does have C bindings to it, last time I - at least when you - yes, go ahead.
Tim O'Brien: So how do you find a way around that? I mean, is it just the case that there are certain gems that you just aren't gonna be using from JRuby, and if so, what's the percentage?
Henry Liu: So basically, yeah. If you have gems that have native parts to it that'll compile in C then you have a couple options. The most common gems, like for example RMagick or Hpricot or even Mongrel, they all have JRuby implementations of it, so the parts that are done in native code have been implemented in Java. So you can install this alternative version of the gem when you're in a JRuby environment. The other option obviously is to just do your own porting. You can dig down in and sort of go through the same task. But yeah, those are probably the few main approaches that you'd take if you had a gem that - and in terms of percentage, I can't quantify that.
I have no idea. But the most popular gems at least have been moved across and/or are in the process of being moved across.
Justin Edelson: And there are also a couple of examples where - you know, Henry mentioned some of the image manipulation stuff where I think it's primarily the JRuby team or other volunteers have created API-compatible versions of those gems that instead of using a native layer use a Java layer. And especially I think we found that to be the case around image manipulation, but there's a lot of stuff now in the JRE to handle image manipulation. So all the team has done is really write a wrapper around that that emulates the image science Ruby gem API for example.
Tim O'Brien: For the record, I'd just like to say that installing RMagick in CRuby is something of a pain in the neck, so would you say that it's more or less easy to use the JRuby version?
Justin Edelson: I think there are some font issues that sort of get in the way of doing a -
Henry Liu: Yeah, I think in general it's easier because obviously you don't have to install the RMagick, which depending on your platform can be difficult. But I think the one problem right now is that they have a lot of the library, and every time they release it they have more compatibility with the C version of RMagick, but it's still lacking a little bit in terms of complete compatibility. So I'm sure that there are a lot of fringe cases out there where there may not be 100 percent compatibility. But it's definitely improving, and with every version it gets closer and closer. And it's something I think they're obviously working on.
Tim O'Brien: One of the old JRuby blog posts I think was by Ola Bini, and he talked about how you could use JRuby to sort of launch up the JConsole, and you had more transparency as to what was going on in your application. Could you talk to me about some of the things that are possible in a JRuby app that are not possible in a plain old Ruby app?
Justin Edelson: I think the stuff that Ola's talking about there in monitoring and manageability is really key. JMX in the Java space is pretty well established and there's a solid maturity of the ecosystem; things like Hyperic or even just JConsole and Visual VM, which are now included in the JRE, and the ability to expose arbitrary parts of your application for management is a really nice thing that the Java platform just provides now. I know in the work that Henry and I do there's historically we've done a lot of monitoring at the system level - free memory, thread use, things like that. And being able to bring monitoring up the application stack and say how's this cache doing, how many times are people ordering something?
And then using off-the-shelf tools that know how to speak JMX to graph that is a big win, and something that I think the CRuby community is a little lagging behind the Java community, just because Java has been sort of enterprise focused.
Henry Liu: I just wanted to add one more point about the differences. I'm not an expert in this field, and I haven't really tracked the newest developments, but a lot of people sort of look to the threading support, and that's one main difference. Right now with Java you have the VM has evolved so far in ten plus years or even more in its life, and you have support for running on multiple cores, and you have the threading model is just a little bit better implemented and a little bit more robust. You have real preemptive multithreading as opposed to a lot of the earlier Ruby implementations. I think, I'm not sure, with 1.9 there may be better support, but I don't know for sure.
Tim O'Brien: Question about the Ruby community - the Ruby community - oh, I should be more specific. The Rails community was sort of founded with this ethos of anti-Java bigotry. Now, that might be an unfair word to use. Let's just say they had strong feelings against the Java language specifically. How has that changed? Has it changed? Can you talk about some of the places where the communities don't see eye-to-eye and some of the places where they do?
Henry Liu: I guess when I used to go to the early NYC Ruby meetings, yeah, it was definitely a really interesting crowd, because you had this one side of people in the room who were hard-core Ruby people and never wanted to know Java or learn it ever. And then you had people like myself who had years and years of Java experience, dying to learn some new technology. And I think it's always been kind of an awkward match to not necessarily a perfect kind of marriage in any way, but I don't know. I think JRuby is sort of that attempt to bridge that gap a little bit and try to have these kind of groups see eye-to-eye a little bit, but I can't honestly say that I see that much.
There isn't like this Kum Ba Yah moment where people are just holding hands and coming together. I think that the Ruby people still tend to look for their solutions using the Ruby technology and writing their technologies in the Ruby code; using Java when absolutely necessary, but generally still looking toward Ruby-oriented solutions. I don't know exactly how many Java developers are crossing over to Ruby, but probably more and more hopefully with the book.
Tim O'Brien: Do you want to comment on this, Justin?
Justin Edelson: I think what JRuby does is it actually broadens the playing field a little bit for Ruby in that as Henry said, especially around Rails. The audience for that has been people who frankly in a lot of cases were just burnt out on Java, and what JRuby has allowed is to bring more Java people into Ruby and create more deployment opportunities. To me that's really the biggest area which JRuby brings to the Ruby language is more deployment opportunities, especially within the enterprise where things like JBoss or BA are well-established technologies.
And we really aren't - systems people aren't particularly interested in running Mongrel or other Rails-oriented containers - or Ruby-oriented containers, I should say. And JRuby really allows the broadening of that playing field for them.
Tim O'Brien: So one thing I just have to ask you is both of you are Java programmers. You would call yourselves Java programmers, I guess, if I forced you to choose a language?
Henry Liu: Yeah, I would have to say that. I mean, I do a lot of Ruby development but I think in terms of the mindset, yeah, I'm definitely more of a Java developer.
Tim O'Brien: And Justin?
Justin Edelson: I disagree with the question a little bit. I think we're not - well, in all seriousness, I don't think that we're language - I don't think of myself and I frankly don't think of Henry as a particularly language-oriented developer. I think we're software developers, systems architects, at the core, and we're really interested in finding the right tools for the job. There are certainly people who are Java developers, and when all you have is a hammer everything looks like a nail. But I think especially in this environment you need to be really picky about which tools you use for which job, and find solutions to problems.
And I think that's what I've tried to do, and in working with Henry that's what I can see that he's tried to do. So I would disagree a little bit with the characterization that we have to be one or the other. I spend I feel most of my time in the build and deployment world now, but that's not how I would define myself.
Tim O'Brien: Well, if that were a trick question I think Justin just got an A+. But the reason I ask is because it seems like Java has been having an identity crisis for years and years and years, the platform. Some could argue that it's healthier than ever; some could argue that it's on its last legs. But it's clear that Sun has had a problem devoting resources to it, or at least if you look at something like JavaFX, there have been a series of failed efforts to sort of inject more energy into the platform. Could you talk to me a little bit about whether or not your interest in Ruby is something that is a reaction to that, or is it something that you think would've arose naturally despite what's happened to the platform?
Justin Edelson: It's a little hard to say. I think especially what's happened with Rails has been a recognition that the way that we have been doing development - divorce it from any particular language. But the way that we've been doing development needs to be shooken up a little bit, and that to me is what Rails ultimately did because at the core of Rails all of the MVC stuff is nothing particularly new. The big thing at least that I took away from working with Rails is the fast turnaround development, and that's what - looking at that you said, "Wow, I really understand how this changes the game." The controllers and all that sort of stuff, that's nothing new - it's the process changes. So I think Sun is in a position where they need to try to make the language and the platform more agile and more easily adaptable to change.
Tim O'Brien: Do you think that they're succeeding in doing that?
Justin Edelson: Well, they employ Nutter. I know Henry - and maybe Henry can speak more to this - was really impressed with NetBeans. Not a thing - I have not used NetBeans a lot; historically I'm an Eclipse person, and that I will characterize myself as an Eclipse person there. But I think they are making some strides in that direction. I don't really understand JavaFX - I'm not sure where it fits in. I understand the language; I'm not clear what the strategy is behind that, but they're trying.
Henry Liu: Yeah, and like Justin mentioned, I think that they're doing - I think it's sort of they got a couple hits, but they also have some misses or some half-assed work, I guess. The NetBeans I think is one of the definite better areas. The idea is really good. The feature set is comparable in a lot of ways to Eclipse and to the other popular IDEs. Actually in some things they do better in terms of completion of Ruby code, especially for JRuby developers. JavaFX - I don't know. I worked on a lot of the GUI chapter so I looked at JavaFX a lot and thought about it in comparison to a lot of the technologies that we talk about in the book.
My take-away was that what I thought was interesting was the scripting language itself, ultimately; the JavaFX language that you use to sort of create all the logic and define all the actual components. I just thought compared to Ruby or to JRuby at the end of the day it was just second-rate, and if that's really all that the technology is bringing to the table, this sort of scripting language, I think a lot of the ideal alternative techniques that we talk about in the book are much better. I mean, the only issue is a lot of it is tied into Swing, or a lot of the examples we talk about Swing, but there are also newer GUI technologies that are emerging that are using their own drawing toolkits.
And accessing them through JRuby can be as good as any JavaFX stack, in my opinion - not that I have done that much development, but just what I've looked at and a lot of the examples that I've looked at, it seemed to me that you could do as much or more over in the JRuby plus a toolkit world.
Justin Edelson: The other big win I should mention is GlassFish, which I think especially in the v3, Sun and the GlassFish team have really taken the bloated nature of the J2EE container, the Java EE container and taken that into account and tried to redefine it, which is why you see things like the GlassFish gem, which will allow you to run a Rails application in GlassFish using basically an identical mechanism to the way you would run it with WEBrick or Mongrel. And I know that the Grails team has actually done something similar recently where they're starting to use GlassFish in lieu of Jetty as a low-impact servlet container.
Tim O'Brien: I saw an exchange on Twitter between Tim Bray and someone who works for G21 yesterday. I think Tim Bray was asking, "Why did you switch to GlassFish from Jetty?" I didn't hear what the answer is. It seems to be bucking a trend, though. It seems like a lot of people have embraced Jetty over something like Tomcat. Is it just that they need more of the J2EE features?
Justin Edelson: I can't speak for everyone, but I can say that my perception is that Jetty is used much more in development than in production. And so that may be part of it is that you desire a development environment that's as close as possible to your production environment. So using something like JBoss or even Tomcat, which is obviously lower impact than say JBoss or BEA in development, if you're going for a rapid turnaround, quick reload of the container, doesn't quite work as well. Whereas I think the Maven Jetty plug-in has done a great job of really speeding up Java development.
So I would assume that that's part of it, is that more Grails applications or more JRuby applications are going to be deployed on GlassFish than they would on Jetty.
Tim O'Brien: How did the two of you meet - how did you start working on the book?
Justin Edelson: I've known Henry for I think five years now?
Henry Liu: Something like that, yeah; time goes by fast.
Justin Edelson: Exactly. We worked together at MTV Networks, where we both still work, and I'd come in as a software developer and met Henry pretty quickly, and we just worked on and off together over that span of time.
Henry Liu: Yeah, and I don't think that we've - sorry, go ahead.
Justin Edelson: Well, I was just gonna say that I was thinking about an anecdote, and I'll say that the first thing I can really remember talking to Henry about was telling him that the author of the Lemony Snicket books was a member of the Magnetic Fields, and Henry was unaware of that.
Tim O'Brien: I didn't know that either.
Justin Edelson: That's the first thing that I - I think he isn't actually a full member, but sort of a mostly member. I'm not -
Tim O'Brien: And that was sort of a key pivotal moment that was sort of like a -
Henry Liu: Eureka!
Henry Liu: No, I don't know. I think that we've just always worked closely, but not ever directly on the same project, I guess. But I don't know. Our technology department's pretty small and we work pretty closely together, so I've always been aware of Justin and I've always respected everything that he's ever - you know, if I've heard him speak about something he always sounded very intelligent, so I didn't think twice about working with him. And I did over the years I've kind of peeked through some of his code, and I saw that his philosophy of design and architecture was very consistent with things that I would work on.
I kind of knew based on what I'd seen in the past that we'd be a good fit for trying something like this.
Tim O'Brien: How did you write the book? Was it in DocBook? Was it in the Wiki?
Justin Edelson: We did it in Word, which I'm not sure I will do again.
Tim O'Brien: And who was the editor - was it Mike Loukides?
Justin Edelson: Yeah.
Tim O'Brien: And how is he to work with?
Justin Edelson: I like Mike a lot; it worked really well. Mike is a great guy to work with from my perspective on a technology book because he actually knows the technology. So he was always willing to push us to say what about this, what about that? I can see from a developer's perspective why this is important or why this isn't. So he had some really valuable feedback.
Tim O'Brien: Is this a Java book or is this a Ruby book?
Justin Edelson: That's the million-dollar question.
Henry Liu: I think it goes back to what I was saying - I think it's a little - I don't know. I think we're trying to be a little bit of both but trying to be its own thing. I think it's useful for both. It's the obvious answer, but I think that Ruby developers who want to learn how to leverage some Java technology to make their jobs easier, I think they can take a lot away from it. And I think that obviously Java developers who want to look at what's going on in the Ruby world and learn some of the agile practices that are happening there and learn some new ways of using their old technology, I think that they'll find that really valuable too.
Justin Edelson: Yeah, I think - and this may not be a popular statement - but I actually think at the end of the day the two languages as languages - they're not that different. And so my perspective is that somebody who's a Ruby developer is gonna get the Java parts. Somebody who's a Java developer is gonna get the Ruby parts pretty easily.
Sun's Layoffs, Anil Gadre, and What happens to Java now?
Sun is all about JAVA. While they might try to tell you that they have a diversified portfolio of strong products in the server market, you should also know that the server market evaporated along with the economy. Sun realizes this and has expanded the software division into three components. I'm most interested in the Application Platform Software division, which will oversee Java, MySQL, and Glassfish.
Sun announced massive layoffs today, and shuffled some executives around to new positions. Most relevant to the Java platform is the selection Anil Gadre to head the Application Platform Software division. Before serving as Chief Marketing Officer, Anil Gadre was general manager of the Solaris effort. Anil Gadre is also named as co-inventor on a Sun patent for the per-employee pricing model Sun uses for Java Enterprise support. Gadre is also largely responsible for repositioning Solaris to compete with Linux, most notably managing Solaris' transition from proprietary to open source.
Time to Refocus the Java Platform?
Sun has also announced that Rich Green is leaving the organization. This year's JavaOne was noticeably downbeat and Schwartz's mood at the blogger press conference was noticably glum as the conference happened to coincide with the announcement of layoffs. It is certainly no surprise that Green is leaving the organization, but one has the question why it didn't happen much sooner. Sun has hemorrhaged GUI experts to Adobe ever since it decided to start pushing JavaFX as the answer to everything interactive; I wonder if it is time for Sun Microsystems to disengage from the JavaFX effort. The PR team continues to trumpet the technology as the next big thing, but the demonstrations are underwhelming at best. With Green's departure, Gadre has an opportunity to refocus on the core platform and reconnect with the developer audience. The center of this community is still server-side development, not mobile GUI or Bluray.
While Java retains a large developer base, the Java brand has been in a free fall for a few years, and I'm constantly surprised to keep on seeing the same marketing executives in the briefing rooms year after year. To the Sun employees who find themselves jobless, good luck. Know that the magnitude of this layoff would have been smaller if your management team had been making more rational decisions about direction over the past few years. To the employees who remain, you should take no solace that you remain in the employment of a company that has so badly mismanaged the Java platform. Gadre might be just what the doctor ordered, but it will take bold strokes to resuscitate this platform.
Opportunity to Break a Log Jam
The transition to open source Java was prolonged and rocky, and the JCP is currently paralyzed over the continuing disagreement over the TCK. Sun has preached openness while using TCK licensing as a lever to protect its revenue from licensing Java on mobile platforms. Open source communities see the restructuring as an opportunity to reengage Sun to see if they are ready to break this log jam. It will be interesting to see if there is any shift in TCK licensing strategy with the management change. If Sun wants to protect the Mobile revenue by precluding a JVM implementation under a BSD-style license, they will not budge. If Sun realizes that the viability of the platform is more important than the Mobile revenue, they will capitulate and remove conditions from the TCK license. (I predict no progress.)
What Happens to Java When...
Although the press release positions this as an "opportunity" for Sun to align itself with the market. This isn't a restructuring to take advantage of favorable market conditions, this is a round of layoffs precipitated by the worst economic conditions in decades and serious talk of a multi-year recession. This could very well be the last gasp of a company trying to rearrange business units for a sale. The coming multi-year recession will claim a few large companies, and Sun's operating costs were already very high before the current global crisis. Maybe they will survive the coming storm, maybe they won't...
...but if they don't, what happens to Java?
PHOTO CREDITS: Tim O'Brien
Sun announced massive layoffs today, and shuffled some executives around to new positions. Most relevant to the Java platform is the selection Anil Gadre to head the Application Platform Software division. Before serving as Chief Marketing Officer, Anil Gadre was general manager of the Solaris effort. Anil Gadre is also named as co-inventor on a Sun patent for the per-employee pricing model Sun uses for Java Enterprise support. Gadre is also largely responsible for repositioning Solaris to compete with Linux, most notably managing Solaris' transition from proprietary to open source.
Time to Refocus the Java Platform?
Sun has also announced that Rich Green is leaving the organization. This year's JavaOne was noticeably downbeat and Schwartz's mood at the blogger press conference was noticably glum as the conference happened to coincide with the announcement of layoffs. It is certainly no surprise that Green is leaving the organization, but one has the question why it didn't happen much sooner. Sun has hemorrhaged GUI experts to Adobe ever since it decided to start pushing JavaFX as the answer to everything interactive; I wonder if it is time for Sun Microsystems to disengage from the JavaFX effort. The PR team continues to trumpet the technology as the next big thing, but the demonstrations are underwhelming at best. With Green's departure, Gadre has an opportunity to refocus on the core platform and reconnect with the developer audience. The center of this community is still server-side development, not mobile GUI or Bluray.
While Java retains a large developer base, the Java brand has been in a free fall for a few years, and I'm constantly surprised to keep on seeing the same marketing executives in the briefing rooms year after year. To the Sun employees who find themselves jobless, good luck. Know that the magnitude of this layoff would have been smaller if your management team had been making more rational decisions about direction over the past few years. To the employees who remain, you should take no solace that you remain in the employment of a company that has so badly mismanaged the Java platform. Gadre might be just what the doctor ordered, but it will take bold strokes to resuscitate this platform.
Opportunity to Break a Log Jam
The transition to open source Java was prolonged and rocky, and the JCP is currently paralyzed over the continuing disagreement over the TCK. Sun has preached openness while using TCK licensing as a lever to protect its revenue from licensing Java on mobile platforms. Open source communities see the restructuring as an opportunity to reengage Sun to see if they are ready to break this log jam. It will be interesting to see if there is any shift in TCK licensing strategy with the management change. If Sun wants to protect the Mobile revenue by precluding a JVM implementation under a BSD-style license, they will not budge. If Sun realizes that the viability of the platform is more important than the Mobile revenue, they will capitulate and remove conditions from the TCK license. (I predict no progress.)
What Happens to Java When...
Although the press release positions this as an "opportunity" for Sun to align itself with the market. This isn't a restructuring to take advantage of favorable market conditions, this is a round of layoffs precipitated by the worst economic conditions in decades and serious talk of a multi-year recession. This could very well be the last gasp of a company trying to rearrange business units for a sale. The coming multi-year recession will claim a few large companies, and Sun's operating costs were already very high before the current global crisis. Maybe they will survive the coming storm, maybe they won't...
...but if they don't, what happens to Java?
PHOTO CREDITS: Tim O'Brien
Spring Getting into a Groove with Groovy: SpringSource Acquires G2One
You may also download this file. Running time: 00:20:04
On November 11, 2008, Springsource announced the acquisition of G2One, Inc. Spring has been a significant force in Java since Rod Johnson wrote Expert One-on-One J2EE Design and Development in 2002. This book was a rallying call for Java developers who were fed up with the overly complex EJB specifications emerging from Sun Microsystems in the early part of this decade. Since 2002, Spring has become the center of Java innovation, and whenever you attend a conference like JavaOne, it is clear that most server-side Java developers look to technologies like Spring and Hibernate before they look to many of the standards emerging from the JCP or from Sun.
Graeme Rocher is a co-founder of the Grails web application framework and a member of the JSR-241 (Groovy) Expert Group. As the CTO of G2One, he works closely with people like Guillaume Laforge, also with G2One, to support and implement both the Groovy language and Groovy on Grails. In this interview, I wanted to give Rod and Graeme a chance to talk about the differences between Groovy and JRuby, and the reasons why someone would develop in Grails over running Rails in JRuby.
Interview Transcript
Rod Johnson: The news is that SpringSource is announcing the acquisition of G2One, the company behind Grails and Groovy. The motivations for this are firstly that we think that Grails is a very interesting technology in the Enterprise Java space.
Secondly, that we do see a growth of interest in dynamic languages. We think that's a pretty broad movement across the IT industry. You are seeing a significant number of people who like dynamic languages. We are still, of course, completely committed to providing excellent solutions around Java but we want to make sure that we can reach out to those - that audience and let them rate the full benefits of Spring.
Thirdly, Grails is a technology that is built on Spring. Grails is built on Spring, it is a technology that really enables people who prefer dynamic languages to enjoy that experience but do so in a way that gives me full access to the benefits of the Spring component model and all that Enterprise Java has to offer.
And also we're very excited by the style and explosive growth of the Grails community. I tend to avoid words like explosive. In this case I feel that it's very appropriate. Twelve months ago Grail's downloads were running around 7,000 per month, this month they've been steadily growing to an excess of 70,000 per month. That not only is truly explosive growth but it means that Grails has one of the largest communities out there in terms of Enterprise Java. There's really only a handful of projects, of course, including Spring itself, that have more downloads than that.
So we're very excited about the scale of the community and also I think that's a massive validation is the importance of Grails as a technology. SpringSource has over time been steadily broadening what it has to offer to its users and customers. We've been doing that though enhancements to the Spring framework though steadily increasing the scope of what we have to offer, in Spring projects though the introduction of the dm Server, application server though our acquisition of Covalent and now with our acquisition of G2One we're reaching out to a new audience that is very interested in dynamic language technologies.
We see this as a very natural and evolutionary part of SpringSource's mission to be the leading provider of Enterprise Java software.
Tim O'Brien: So in terms of your existing customer base, how many customers that use Spring products are already using Grails?
RJ: We do have some shared customers. One example of the shared customer is LinkedIn. LinkedIn is a very heavy Spring user. Their whole system is built on Spring by our SpringSource Enterprise customers. So, you know, they subscribe to our Enterprise value ads above Spring. They also value their 24/7 support experience that they can get and they also use Grails and are a G2One customer. So that's an example of a shared customer.
We are seeing an increasing number of SpringSource customers that are asking about Grails and are very interested in looking at whether or not Grails can help them. Of course, if you look at the G2One customer base every G2One customer was obviously already using Spring because Grails is built on Spring.
TO: ...about the difference between something like Grails and something like Rails, Rails has been very popular and there's also JRuby from Charles Oliver Nutter, but there is something of an impedance mismatch between the Java platform and the framework. Talk to me about the differences. What makes Grails different from Rails, you know, at a very shallow level?
Graeme Rocher: So essentially the difference is already two-fold. One relates to the fact that it's built on the Groovy language. The Groovy language itself has a much tied integration with the Java platform in that it supports bidirectional relationship between Java and Groovy.
So with a language like JRuby it's quite easy to call Java from JRuby, going the other way is a lot tricker. With Groovy, on the other hand, you have a joint compiler, Java code can reference Groovy code, Groovy code can reference Java code.
Groovy is also the only dynamic language on the JVM at the moment that supports the full set of Java 5 features needed to support Enterprise Java. So we're talking about things like annotations, generics, and if you look at the latest specifications coming out of the Java community process I was just reading through Web Beans today, they're making extensive use of things like annotations and generics and currently Groovy is the only dynamic language that can take advantage of those.
In terms of Grails, well, Grails is just built on top of the Enterprise Java stock of Spring and of course, Hibernate and it's - it essentially is a plug-in system that uses Spring internally.
And the great thing is that it then benefits from all the great features that Spring offers so it builds on Spring's transaction demarcation layer, it builds on Spring's component model, it depends the injection container and it means that, for example, Rod was just talking about LinkedIn, LinkedIn is a prime example of where they have a Ruby on Rails application that needs to talk to their backend by XML web services whilst their Grails application is just embedded and talks directly to their Spring beans without any extra layers in between.
TO: So the main concrete difference for a company like LinkedIn is in their Rails app. They have to build some sort of rest layer that's in Java and then have the Rails app talk to that Rails layer. But in Grails they can just go directly to something like a Spring managed DAO?
GR: Absolutely, because Grails is built on Spring so they're just reusing the same Spring bean definitions the same application context that runs their entire back end.
But, you know, there's a whole lot of other differences performance characteristics are different. Grails is a lot more performant. There is - there are features in Grails that are important to Enterprise customers that are missing in Rails, things like conversational statement management, transaction demarkation, etcetera.
RJ: I think certainly if you look at Ruby on Rails, Rails introduced a number of very interesting ideas. For example, the extensive use of convention or the configuration, the kind of productivity and scaffolding tools that they provide. All of that is very interesting. So that certainly was a positive side. On the negative side there are really a number of things that are highly problematic for Enterprise developers looking to build applications in Rails.
Firstly, Activerecord really lacks the scalability and sophistication of our mapping solutions in Java. That is something that is absolutely not a problem for Grails. Grails can leverage the best that is available in Java or mapping. Secondly, as Graeme's already alluded to the performance benefits. Thirdly, if you are building an application with Ruby on Rails and you encountered the scalability issues, if you encountered the limitations of active record, if you encountered the problems of conversational state management, if you encounter a significantly to access Enterprise libraries that you already have authored in Java, you're gonna have to go rewrite your app. You're going to have to go rewrite your app in Java.
That is a big problem. With Grails it is completely different because you nearly hit a wall. Firstly, Grails itself is free of many of those restrictions but secondly if you ever need to write something in Java or if you ever need to use the full power of Spring you just go do that and you do that within your same application. There is absolutely no impedance mismatch, no jump into a different technology. So we feel that Grails is the technology that really picks up on a lot of the benefits that Rails delivered but he's actually much more Enterprise ready.
GR: In terms of Grails ability to do that is the fact that Groovy honors the Java class format. So that's something like JRuby does compile to byte code, it's not in the same class file format as you get with Java. So with something like Groovy, Groovy can be used in conjunction with Enterprise data grids like Terracotta and Oracle Coherence or as well as being able to take advantage of all the Spring features that rely on the byte code format produced by Java and Groovy.
TO: How many programmers would you say a percentage of Java developers that you've come into contact with know Spring and how many know Groovy?
RJ: It's always hard to estimate the usage of open source technology. In respect to Java and Spring usage well over 5 million people have downloaded Spring. The surveys that we've commissioned from independent third-parties indicate that something like two-thirds of Enterprise Java developers are using Spring.
So clearly the penetration is extremely high. The penetration of Grails is lower but there's a couple of things to note about that, one is that Grails is enjoying, as I said, explosive growth. The second thing is that Grails is a technology that is actually bringing new people to the Java platform and this is a big part of what we're doing with it.
We feel frankly that developers that like to develop in Java and it fits the profile of traditional Enterprise Java developers, you know, what we give them the SpringSource technology is already fantastic. Of course, we're always looking to make it better, you know, it's pretty damn good. Whereas when you look at the kind of audience that Grails can attract we believe that a substantial part of that audience is people who are new to the Java platform, and we think that's a very exciting potential Grail to grow both our audience of users and customers and also the broader audience of Enterprise Java.
GR: You know, both the philosophy of Grails and the philosophy of Spring is to simplify the lives of developers. Some of those developers are obviously into dynamic languages, some of them are into statically-typed languages. Of course, more dynamic languages like Groovy offer a level of simplicity that is more difficult to obtain with a statically-typed language.
However Grails - and the result is, is that, you know, Grails is attracting as Rod said, developers from the PHP and Ruby on Rails communities to the JVM.
TO: Are there any other dynamic languages that SpringSource is also paying attention to?
RJ: Certainly, we are always monitoring other technologies out there. In Spring Framework 2.0 we actually allowed the ability to author any Spring Bean, any Spring managed object in a range of dynamic languages and still enjoy the full benefit of this Spring component model.
So we to some degree say Spring and dynamic languages is a bit like Microsoft, the CLR and the Microsoft.net framework. So if you're developing on the .net platform, you've got common language runtime, you've got a host of Enterprise services that are available to you. However, what language do you author in? Maybe you use VB.net, maybe you use Manage C++, maybe you use C#, and Microsoft essentially neutral on what language you use to implement those Enterprise services.
We do believe that Groovy is at present the most promising dynamic language on the JVM. So, you know, I think that it's fair to say that this acquisition indicates our faith in Groovy. Having said that however, you know, we will certainly continue to insure that Spring Framework and our other products work with different dynamic languages, you know, where that's technically feasible.
The key thing I think is that Groovy allows you to compile to a class file from a Groovy artifact and that's a big deal. As Graeme said, you also have access to annotation processing which is incredibly important now to just about any Java component model including Spring Framework itself. So there are a range of reasons that we think that Groovy is a great choice on the JVM.
TO: I'm going to ask you one more question and I'm asking the two of you because you both have had a large role in helping to shape the direction of the Java platform in the last few years. SpringSource recently was elected to, I think it was the Executive Committee of the JCP. Is that right?
RJ: We were elected to the Executive Committee.
TO: Right, so I guess I'd like both of you to talk about what is the state of Java. It's been something of a whipping boy for the industry for a few years. Could you just talk about what you would like to see happen next with the Java language?
RJ: That's a very good question. I'll take it first. I think to some degree the use of Java as a whipping boy, it reflects a number of fairly superficial factors. One is that... Java, ten years ago if you wanted to enhance your resume you probably wanted to jump from VB or C# to Java and that had a competitive benefit for you and you got to learn something new and interesting. Right now Java is a mature language; mature languages are less sexy to the cool kids who like playing rather than working. Now that may sound like a fairly critical statement but I mean that is a fact of life.
So, you know, I think part of it is inevitable that when a language becomes mainstream, when it becomes successful you do actually find that you get a bunch of people who just feel they need to go look for something else.
Secondly I think that a lot of the negativity around Java relates to previous generations of technology that failed and has since been completely abandoned. So, for example, the horrendous reputation that J2EE developed excessive complexity around the old entity bean and the old EJB model. I mean no one uses those technologies anymore. I mean, people develop in Spring now. Spring and Hibernate instead of using those obsolete technologies. So, you know, that criticism really doesn't apply.
I guess the first point I would make is that I do think that a lot of the attacks on Java are a bit exaggerated. However, having said that I do feel there are very real challenges and certainly in my position on the EC I will be working to help address those challenges.
There are specific challenges that I think about are if you look say at the effort Microsoft is putting into the effort C# language and they've gotten that platform. If you look at thinks like Link that is really interesting technology and they're frankly innovating faster than innovation is occurring in the Java language.
Innovation really is occurring in places like Spring and Grails in Java and I think that Sun really needs to be open - more open to embracing that kind of open source innovation. Secondly, I would like to see greater embrace of dynamic languages on the JVM because I think the JVM story shouldn't be just Java. Thirdly, I would really like to see some housekeeping and printing of API's that are not necessary. I think Java is unnecessarily bloated with old API's and packages that no one uses like the old AWT, Windowing Library I think we should take a long hard look at doing some house cleaning.
I think the death of Java like the death of Mark Twain has certainly been exaggerated. We feel that both in Java based technologies and also with Grails there's a tremendous amount we can do to improve the Java platform. But, you know, on the other hand it is always important to be vigilant. Graeme, what's your take on this?
GR: Yeah, my take is that, you know, as Rod said there's a lot of noise on blogs and so forth about how Java is coming to its slow and gradual death or whatever, but the reality is quite different. Essentially if you look at the way the Groovy developers see this, you know, languages like Ruby and Python and so forth exist outside of the JVM and have been imported as JRuby and Jython, but they exist outside.
Groovy, on the other hand, it was designed specifically to be used in conjunction with Java. So Groovy is not seen as a replacement for Java. The Groovy developers and Grail developers are very aware that, you know, it's about picking the right tool for the job and there is still many, many, many circumstances where Java is a fantastic tool for many performance critical aspects of Enterprise Java work out there. And that's the great thing about Groovy and Grails is that you can mix the dynamic nature of the language like Groovy with performance critical code within Java and you can really get the best of both worlds.
In terms of Sun and their position I think that, you know, given the nature of the economy at the moment all companies are under a lot of pressure at this moment and having to take a strong look at themselves. You know, it's not at all surprising that Sun is in that same situation. It doesn't mean Java is going anywhere anytime soon. No, I don't think so.
RJ: Yeah, I mean, I think would I like to see certain things going to the Java language at a faster rate? Would I like to see certain things taken out? Yes, absolutely and I'll be pushing for that on the EC. But do I think that it makes it impossible to produce, you know, huge benefits for users of Java technology? No, I don't. I think there's a tremendous amount more that we can do in Spring, in our server technologies, in Grails.
You know, I think that we've already achieved a lot in terms of improving productivity and the experience of running Java applications and I think there is a whole lot more we can still do.
Related Links:
On November 11, 2008, Springsource announced the acquisition of G2One, Inc. Spring has been a significant force in Java since Rod Johnson wrote Expert One-on-One J2EE Design and Development in 2002. This book was a rallying call for Java developers who were fed up with the overly complex EJB specifications emerging from Sun Microsystems in the early part of this decade. Since 2002, Spring has become the center of Java innovation, and whenever you attend a conference like JavaOne, it is clear that most server-side Java developers look to technologies like Spring and Hibernate before they look to many of the standards emerging from the JCP or from Sun.
Graeme Rocher is a co-founder of the Grails web application framework and a member of the JSR-241 (Groovy) Expert Group. As the CTO of G2One, he works closely with people like Guillaume Laforge, also with G2One, to support and implement both the Groovy language and Groovy on Grails. In this interview, I wanted to give Rod and Graeme a chance to talk about the differences between Groovy and JRuby, and the reasons why someone would develop in Grails over running Rails in JRuby.
Interview Transcript
Rod Johnson: The news is that SpringSource is announcing the acquisition of G2One, the company behind Grails and Groovy. The motivations for this are firstly that we think that Grails is a very interesting technology in the Enterprise Java space.
Secondly, that we do see a growth of interest in dynamic languages. We think that's a pretty broad movement across the IT industry. You are seeing a significant number of people who like dynamic languages. We are still, of course, completely committed to providing excellent solutions around Java but we want to make sure that we can reach out to those - that audience and let them rate the full benefits of Spring.
Thirdly, Grails is a technology that is built on Spring. Grails is built on Spring, it is a technology that really enables people who prefer dynamic languages to enjoy that experience but do so in a way that gives me full access to the benefits of the Spring component model and all that Enterprise Java has to offer.
And also we're very excited by the style and explosive growth of the Grails community. I tend to avoid words like explosive. In this case I feel that it's very appropriate. Twelve months ago Grail's downloads were running around 7,000 per month, this month they've been steadily growing to an excess of 70,000 per month. That not only is truly explosive growth but it means that Grails has one of the largest communities out there in terms of Enterprise Java. There's really only a handful of projects, of course, including Spring itself, that have more downloads than that.
So we're very excited about the scale of the community and also I think that's a massive validation is the importance of Grails as a technology. SpringSource has over time been steadily broadening what it has to offer to its users and customers. We've been doing that though enhancements to the Spring framework though steadily increasing the scope of what we have to offer, in Spring projects though the introduction of the dm Server, application server though our acquisition of Covalent and now with our acquisition of G2One we're reaching out to a new audience that is very interested in dynamic language technologies.
We see this as a very natural and evolutionary part of SpringSource's mission to be the leading provider of Enterprise Java software.
Tim O'Brien: So in terms of your existing customer base, how many customers that use Spring products are already using Grails?
RJ: We do have some shared customers. One example of the shared customer is LinkedIn. LinkedIn is a very heavy Spring user. Their whole system is built on Spring by our SpringSource Enterprise customers. So, you know, they subscribe to our Enterprise value ads above Spring. They also value their 24/7 support experience that they can get and they also use Grails and are a G2One customer. So that's an example of a shared customer.
We are seeing an increasing number of SpringSource customers that are asking about Grails and are very interested in looking at whether or not Grails can help them. Of course, if you look at the G2One customer base every G2One customer was obviously already using Spring because Grails is built on Spring.
TO: ...about the difference between something like Grails and something like Rails, Rails has been very popular and there's also JRuby from Charles Oliver Nutter, but there is something of an impedance mismatch between the Java platform and the framework. Talk to me about the differences. What makes Grails different from Rails, you know, at a very shallow level?
Graeme Rocher: So essentially the difference is already two-fold. One relates to the fact that it's built on the Groovy language. The Groovy language itself has a much tied integration with the Java platform in that it supports bidirectional relationship between Java and Groovy.
So with a language like JRuby it's quite easy to call Java from JRuby, going the other way is a lot tricker. With Groovy, on the other hand, you have a joint compiler, Java code can reference Groovy code, Groovy code can reference Java code.
Groovy is also the only dynamic language on the JVM at the moment that supports the full set of Java 5 features needed to support Enterprise Java. So we're talking about things like annotations, generics, and if you look at the latest specifications coming out of the Java community process I was just reading through Web Beans today, they're making extensive use of things like annotations and generics and currently Groovy is the only dynamic language that can take advantage of those.
In terms of Grails, well, Grails is just built on top of the Enterprise Java stock of Spring and of course, Hibernate and it's - it essentially is a plug-in system that uses Spring internally.
And the great thing is that it then benefits from all the great features that Spring offers so it builds on Spring's transaction demarcation layer, it builds on Spring's component model, it depends the injection container and it means that, for example, Rod was just talking about LinkedIn, LinkedIn is a prime example of where they have a Ruby on Rails application that needs to talk to their backend by XML web services whilst their Grails application is just embedded and talks directly to their Spring beans without any extra layers in between.
TO: So the main concrete difference for a company like LinkedIn is in their Rails app. They have to build some sort of rest layer that's in Java and then have the Rails app talk to that Rails layer. But in Grails they can just go directly to something like a Spring managed DAO?
GR: Absolutely, because Grails is built on Spring so they're just reusing the same Spring bean definitions the same application context that runs their entire back end.
But, you know, there's a whole lot of other differences performance characteristics are different. Grails is a lot more performant. There is - there are features in Grails that are important to Enterprise customers that are missing in Rails, things like conversational statement management, transaction demarkation, etcetera.
RJ: I think certainly if you look at Ruby on Rails, Rails introduced a number of very interesting ideas. For example, the extensive use of convention or the configuration, the kind of productivity and scaffolding tools that they provide. All of that is very interesting. So that certainly was a positive side. On the negative side there are really a number of things that are highly problematic for Enterprise developers looking to build applications in Rails.
Firstly, Activerecord really lacks the scalability and sophistication of our mapping solutions in Java. That is something that is absolutely not a problem for Grails. Grails can leverage the best that is available in Java or mapping. Secondly, as Graeme's already alluded to the performance benefits. Thirdly, if you are building an application with Ruby on Rails and you encountered the scalability issues, if you encountered the limitations of active record, if you encountered the problems of conversational state management, if you encounter a significantly to access Enterprise libraries that you already have authored in Java, you're gonna have to go rewrite your app. You're going to have to go rewrite your app in Java.
That is a big problem. With Grails it is completely different because you nearly hit a wall. Firstly, Grails itself is free of many of those restrictions but secondly if you ever need to write something in Java or if you ever need to use the full power of Spring you just go do that and you do that within your same application. There is absolutely no impedance mismatch, no jump into a different technology. So we feel that Grails is the technology that really picks up on a lot of the benefits that Rails delivered but he's actually much more Enterprise ready.
GR: In terms of Grails ability to do that is the fact that Groovy honors the Java class format. So that's something like JRuby does compile to byte code, it's not in the same class file format as you get with Java. So with something like Groovy, Groovy can be used in conjunction with Enterprise data grids like Terracotta and Oracle Coherence or as well as being able to take advantage of all the Spring features that rely on the byte code format produced by Java and Groovy.
TO: How many programmers would you say a percentage of Java developers that you've come into contact with know Spring and how many know Groovy?
RJ: It's always hard to estimate the usage of open source technology. In respect to Java and Spring usage well over 5 million people have downloaded Spring. The surveys that we've commissioned from independent third-parties indicate that something like two-thirds of Enterprise Java developers are using Spring.
So clearly the penetration is extremely high. The penetration of Grails is lower but there's a couple of things to note about that, one is that Grails is enjoying, as I said, explosive growth. The second thing is that Grails is a technology that is actually bringing new people to the Java platform and this is a big part of what we're doing with it.
We feel frankly that developers that like to develop in Java and it fits the profile of traditional Enterprise Java developers, you know, what we give them the SpringSource technology is already fantastic. Of course, we're always looking to make it better, you know, it's pretty damn good. Whereas when you look at the kind of audience that Grails can attract we believe that a substantial part of that audience is people who are new to the Java platform, and we think that's a very exciting potential Grail to grow both our audience of users and customers and also the broader audience of Enterprise Java.
GR: You know, both the philosophy of Grails and the philosophy of Spring is to simplify the lives of developers. Some of those developers are obviously into dynamic languages, some of them are into statically-typed languages. Of course, more dynamic languages like Groovy offer a level of simplicity that is more difficult to obtain with a statically-typed language.
However Grails - and the result is, is that, you know, Grails is attracting as Rod said, developers from the PHP and Ruby on Rails communities to the JVM.
TO: Are there any other dynamic languages that SpringSource is also paying attention to?
RJ: Certainly, we are always monitoring other technologies out there. In Spring Framework 2.0 we actually allowed the ability to author any Spring Bean, any Spring managed object in a range of dynamic languages and still enjoy the full benefit of this Spring component model.
So we to some degree say Spring and dynamic languages is a bit like Microsoft, the CLR and the Microsoft.net framework. So if you're developing on the .net platform, you've got common language runtime, you've got a host of Enterprise services that are available to you. However, what language do you author in? Maybe you use VB.net, maybe you use Manage C++, maybe you use C#, and Microsoft essentially neutral on what language you use to implement those Enterprise services.
We do believe that Groovy is at present the most promising dynamic language on the JVM. So, you know, I think that it's fair to say that this acquisition indicates our faith in Groovy. Having said that however, you know, we will certainly continue to insure that Spring Framework and our other products work with different dynamic languages, you know, where that's technically feasible.
The key thing I think is that Groovy allows you to compile to a class file from a Groovy artifact and that's a big deal. As Graeme said, you also have access to annotation processing which is incredibly important now to just about any Java component model including Spring Framework itself. So there are a range of reasons that we think that Groovy is a great choice on the JVM.
TO: I'm going to ask you one more question and I'm asking the two of you because you both have had a large role in helping to shape the direction of the Java platform in the last few years. SpringSource recently was elected to, I think it was the Executive Committee of the JCP. Is that right?
RJ: We were elected to the Executive Committee.
TO: Right, so I guess I'd like both of you to talk about what is the state of Java. It's been something of a whipping boy for the industry for a few years. Could you just talk about what you would like to see happen next with the Java language?
RJ: That's a very good question. I'll take it first. I think to some degree the use of Java as a whipping boy, it reflects a number of fairly superficial factors. One is that... Java, ten years ago if you wanted to enhance your resume you probably wanted to jump from VB or C# to Java and that had a competitive benefit for you and you got to learn something new and interesting. Right now Java is a mature language; mature languages are less sexy to the cool kids who like playing rather than working. Now that may sound like a fairly critical statement but I mean that is a fact of life.
So, you know, I think part of it is inevitable that when a language becomes mainstream, when it becomes successful you do actually find that you get a bunch of people who just feel they need to go look for something else.
Secondly I think that a lot of the negativity around Java relates to previous generations of technology that failed and has since been completely abandoned. So, for example, the horrendous reputation that J2EE developed excessive complexity around the old entity bean and the old EJB model. I mean no one uses those technologies anymore. I mean, people develop in Spring now. Spring and Hibernate instead of using those obsolete technologies. So, you know, that criticism really doesn't apply.
I guess the first point I would make is that I do think that a lot of the attacks on Java are a bit exaggerated. However, having said that I do feel there are very real challenges and certainly in my position on the EC I will be working to help address those challenges.
There are specific challenges that I think about are if you look say at the effort Microsoft is putting into the effort C# language and they've gotten that platform. If you look at thinks like Link that is really interesting technology and they're frankly innovating faster than innovation is occurring in the Java language.
Innovation really is occurring in places like Spring and Grails in Java and I think that Sun really needs to be open - more open to embracing that kind of open source innovation. Secondly, I would like to see greater embrace of dynamic languages on the JVM because I think the JVM story shouldn't be just Java. Thirdly, I would really like to see some housekeeping and printing of API's that are not necessary. I think Java is unnecessarily bloated with old API's and packages that no one uses like the old AWT, Windowing Library I think we should take a long hard look at doing some house cleaning.
I think the death of Java like the death of Mark Twain has certainly been exaggerated. We feel that both in Java based technologies and also with Grails there's a tremendous amount we can do to improve the Java platform. But, you know, on the other hand it is always important to be vigilant. Graeme, what's your take on this?
GR: Yeah, my take is that, you know, as Rod said there's a lot of noise on blogs and so forth about how Java is coming to its slow and gradual death or whatever, but the reality is quite different. Essentially if you look at the way the Groovy developers see this, you know, languages like Ruby and Python and so forth exist outside of the JVM and have been imported as JRuby and Jython, but they exist outside.
Groovy, on the other hand, it was designed specifically to be used in conjunction with Java. So Groovy is not seen as a replacement for Java. The Groovy developers and Grail developers are very aware that, you know, it's about picking the right tool for the job and there is still many, many, many circumstances where Java is a fantastic tool for many performance critical aspects of Enterprise Java work out there. And that's the great thing about Groovy and Grails is that you can mix the dynamic nature of the language like Groovy with performance critical code within Java and you can really get the best of both worlds.
In terms of Sun and their position I think that, you know, given the nature of the economy at the moment all companies are under a lot of pressure at this moment and having to take a strong look at themselves. You know, it's not at all surprising that Sun is in that same situation. It doesn't mean Java is going anywhere anytime soon. No, I don't think so.
RJ: Yeah, I mean, I think would I like to see certain things going to the Java language at a faster rate? Would I like to see certain things taken out? Yes, absolutely and I'll be pushing for that on the EC. But do I think that it makes it impossible to produce, you know, huge benefits for users of Java technology? No, I don't. I think there's a tremendous amount more that we can do in Spring, in our server technologies, in Grails.
You know, I think that we've already achieved a lot in terms of improving productivity and the experience of running Java applications and I think there is a whole lot more we can still do.
Related Links:
Does Enterprise Development Have to be Painful, part three
Does Enterprise Development Have to be Painful, part three By chromaticJune 10, 2008 Comments: 2
My previous two articles covered my experiences with installing, configuring, and building a very small application with SAP NetWeaver Composition Environment (see Does Enterprise Development Have to Be Painful, part one and Does Enterprise Development Have to be Painful, part two. This article discusses bundling and deploying that application, as well as my thoughts on the entire process.
Bundling and Deploying Applications with SAP NetWeaver Composition Environment
Given the amount of configuration and the demands I put on the server because of my desire for rapid feedback, I recommend developing applications against a testing server and deploying them to a production server. It's much easier to develop in an ad-hoc fashion—not worrying about user roles and permissions—until you have to deal with real users and real data. This may be truer with my individual experiments, where data loss and security were lesser concerns than were ease of development and rapid experimentation, but separating development from production is a wise practice anyway.
The interesting question was "How do I bundle the work I've done for an SAP administrator to install on the production server?" I ran across a few references to checking my project into a team code repository, the SAP NetWeaver Development Infrastructure (NWDI). It may be a useful possibility when working with other developers, but it was a separate subject than the one under investigation.
Deployment occurs in two phases, mirroring the division between the data model and the user interface.
From the component browser view in the IDE, you can export all of the information for a CAF application to a file. My very minimal task application produced a 1.5 MB SCA file. (There are options to include other components, which is handy if you have an application that relies on models from other components.) I spent half an hour exploring the IDE to find this option, but once you know where it is, it's easy to use. This process takes a while: the IDE must generate and build the application.
Importing the SCA file is simple; it's the opposite process.
There are some caveats. First, I don't know if this includes any data inserted as a result of testing. (I deleted my test data before I could verify this.) Second, you still must configure the deployment of the WSDL files yourself. That is, the steps I took to connect the web service I built in the IDE to Visual Composer are still necessary on the production server. Armand mentioned that using NWDI to manage my development would have simplified this process.
Even when using NWDI, exporting and importing are much easier with Visual Composer; the Model menu has both options featured prominently. All you need to do is save the model you want to export, and then export it. The server will generate a ZIP file for you to save. Take this ZIP file to any other Visual Composer instance (on the production server, for example) and upload it as part of the import process. (Unlike the IDE export, this took me five minutes to discover.)
Again, you have to perform some configuration in the NetWeaver Administrator to connect Visual Composer to the web service (though apparently NWDI simplifies this too).
Unlike the import process in the IDE, importing a UI bundle into Visual Composer doesn't actually deploy the UI for other people to use. Rather, the Deploy icon prominently displayed in the Visual Composer interface does that. If building and deploying are successful, you'll get two links: one to the HTML version of your application and one to the Flex version. My research suggests that these are the public versions of your application suitable for other people to use.
Analysis
What did I learn from this whole process? First, SAP NetWeaver CE is a big system. My sample application was deliberately small, although it included several portions of the entire developer studio. Nonetheless, I explored only a fraction of the possibilities. There are multiple ways to build UIs and to produce and consume other web services, as well as to re-use built-in components and services. I have a much better understanding of the system now, if only that I'm aware of how much I don't know about it.
This understanding reveals flaws in my experiment. The platform does not make rapid iteration and prototyping easy. I'm not saying that SAP NetWeaver CE is a slow platform, or that it can't be agile, but it rewards more upfront design and understanding of what you want to build. This is not an indictment of SAP's tools; I am simply saying that getting the most value out of the Java and web services stack requires more up-front planning than I put into my project. Of course, Visual Composer seems very useful for rapid prototyping of UIs—even (or especially) if you don't connect it to a backend.
A similar argument applies to the size and complexity of applications developed in SAP NetWeaver CE. Although I intentionally kept my task-tracking application very simple so as to be able to develop and deploy a complete system on my own in a few afternoons, most of the power and necessary complexity of the system went unused. I've built similar systems with a couple of hundred lines of Perl, a few CPAN modules, the SQLite database, and an afternoon. The results suited a handful of colocated users, whereas a project built on and deployed to SAP's systems will support many more. Of course, the latter project will likely have more than one developer and more than a week's worth of afternoons devoted to it.
I expected these results. My biggest question was about learnability. Even though my project was small and arguably inappropriate, I had to learn enough about how to use SAP NetWeaver CE to build a real project if I had any hope of succeeding. The ultimate question for me was not "Does the software work?" but "What does it take to learn how to be productive with this software?"
The IDE includes a large amount of supporting documentation—all specific to the current version of the software—which sometimes offers great advantages over browsing the documentation in the wiki, forums, and resource centers of the SAP Developer Network (SDN). However, there are some inconsistencies in the available material. The data modeling section of the documentation contains a great tutorial, but there's little information on how to add custom operations to the generated models. I had sufficient trouble figuring out how to connect my data model web service to Visual Composer that Armand and I spent an afternoon working through the details. Once we'd done that, I had little trouble, but it's unlikely I would have solved the problem on my own.
I did occasionally rely on the SDN, though it's not perfect either. Plenty of material is available there, including some tutorials and training information. Some of it is great, but plenty applies to older versions of the software. (I followed a few dead ends before realizing that searching had landed me in the midst of a tutorial for an older, deprecated technique.)
Although I never posted directly in the SDN forums, I found some great information there, and it's likely that other SDN participants would have led me in the right direction, if I hadn't had Armand and Angel to guide me.
Here's the most important question: "Where would I use SAP NetWeaver CE in the future?"
Assuming I already had SAP deployed and available in my organization, building applications with these tools makes the most sense when the application:
* Can take advantage of existing libraries, models, services, and processes provided by SAP
* Serves multiple users in multiple roles
* Must integrate other services
In particular, I found the business modeling components powerful and easy to use. Visual Composer is effective for building data-driven user interfaces. I used the administration tools only to configure web services to transfer data between my model and my UI, but unified administration, deployment, logging, and governance are also valuable.
SAP NetWeaver CE doesn't remove all of the pain from enterprise software development. I didn't expect it to. It's not perfect, but in its sweet spot and with a little training or experience, it's powerful and flexible, and I'd consider using it for a real, non-toy application. It's not a tool to pull out for an afternoon's worth of work building a small application, but in situations in which I'd spend a couple of months building something larger—and where my list applies—it's a contender.
My previous two articles covered my experiences with installing, configuring, and building a very small application with SAP NetWeaver Composition Environment (see Does Enterprise Development Have to Be Painful, part one and Does Enterprise Development Have to be Painful, part two. This article discusses bundling and deploying that application, as well as my thoughts on the entire process.
Bundling and Deploying Applications with SAP NetWeaver Composition Environment
Given the amount of configuration and the demands I put on the server because of my desire for rapid feedback, I recommend developing applications against a testing server and deploying them to a production server. It's much easier to develop in an ad-hoc fashion—not worrying about user roles and permissions—until you have to deal with real users and real data. This may be truer with my individual experiments, where data loss and security were lesser concerns than were ease of development and rapid experimentation, but separating development from production is a wise practice anyway.
The interesting question was "How do I bundle the work I've done for an SAP administrator to install on the production server?" I ran across a few references to checking my project into a team code repository, the SAP NetWeaver Development Infrastructure (NWDI). It may be a useful possibility when working with other developers, but it was a separate subject than the one under investigation.
Deployment occurs in two phases, mirroring the division between the data model and the user interface.
From the component browser view in the IDE, you can export all of the information for a CAF application to a file. My very minimal task application produced a 1.5 MB SCA file. (There are options to include other components, which is handy if you have an application that relies on models from other components.) I spent half an hour exploring the IDE to find this option, but once you know where it is, it's easy to use. This process takes a while: the IDE must generate and build the application.
Importing the SCA file is simple; it's the opposite process.
There are some caveats. First, I don't know if this includes any data inserted as a result of testing. (I deleted my test data before I could verify this.) Second, you still must configure the deployment of the WSDL files yourself. That is, the steps I took to connect the web service I built in the IDE to Visual Composer are still necessary on the production server. Armand mentioned that using NWDI to manage my development would have simplified this process.
Even when using NWDI, exporting and importing are much easier with Visual Composer; the Model menu has both options featured prominently. All you need to do is save the model you want to export, and then export it. The server will generate a ZIP file for you to save. Take this ZIP file to any other Visual Composer instance (on the production server, for example) and upload it as part of the import process. (Unlike the IDE export, this took me five minutes to discover.)
Again, you have to perform some configuration in the NetWeaver Administrator to connect Visual Composer to the web service (though apparently NWDI simplifies this too).
Unlike the import process in the IDE, importing a UI bundle into Visual Composer doesn't actually deploy the UI for other people to use. Rather, the Deploy icon prominently displayed in the Visual Composer interface does that. If building and deploying are successful, you'll get two links: one to the HTML version of your application and one to the Flex version. My research suggests that these are the public versions of your application suitable for other people to use.
Analysis
What did I learn from this whole process? First, SAP NetWeaver CE is a big system. My sample application was deliberately small, although it included several portions of the entire developer studio. Nonetheless, I explored only a fraction of the possibilities. There are multiple ways to build UIs and to produce and consume other web services, as well as to re-use built-in components and services. I have a much better understanding of the system now, if only that I'm aware of how much I don't know about it.
This understanding reveals flaws in my experiment. The platform does not make rapid iteration and prototyping easy. I'm not saying that SAP NetWeaver CE is a slow platform, or that it can't be agile, but it rewards more upfront design and understanding of what you want to build. This is not an indictment of SAP's tools; I am simply saying that getting the most value out of the Java and web services stack requires more up-front planning than I put into my project. Of course, Visual Composer seems very useful for rapid prototyping of UIs—even (or especially) if you don't connect it to a backend.
A similar argument applies to the size and complexity of applications developed in SAP NetWeaver CE. Although I intentionally kept my task-tracking application very simple so as to be able to develop and deploy a complete system on my own in a few afternoons, most of the power and necessary complexity of the system went unused. I've built similar systems with a couple of hundred lines of Perl, a few CPAN modules, the SQLite database, and an afternoon. The results suited a handful of colocated users, whereas a project built on and deployed to SAP's systems will support many more. Of course, the latter project will likely have more than one developer and more than a week's worth of afternoons devoted to it.
I expected these results. My biggest question was about learnability. Even though my project was small and arguably inappropriate, I had to learn enough about how to use SAP NetWeaver CE to build a real project if I had any hope of succeeding. The ultimate question for me was not "Does the software work?" but "What does it take to learn how to be productive with this software?"
The IDE includes a large amount of supporting documentation—all specific to the current version of the software—which sometimes offers great advantages over browsing the documentation in the wiki, forums, and resource centers of the SAP Developer Network (SDN). However, there are some inconsistencies in the available material. The data modeling section of the documentation contains a great tutorial, but there's little information on how to add custom operations to the generated models. I had sufficient trouble figuring out how to connect my data model web service to Visual Composer that Armand and I spent an afternoon working through the details. Once we'd done that, I had little trouble, but it's unlikely I would have solved the problem on my own.
I did occasionally rely on the SDN, though it's not perfect either. Plenty of material is available there, including some tutorials and training information. Some of it is great, but plenty applies to older versions of the software. (I followed a few dead ends before realizing that searching had landed me in the midst of a tutorial for an older, deprecated technique.)
Although I never posted directly in the SDN forums, I found some great information there, and it's likely that other SDN participants would have led me in the right direction, if I hadn't had Armand and Angel to guide me.
Here's the most important question: "Where would I use SAP NetWeaver CE in the future?"
Assuming I already had SAP deployed and available in my organization, building applications with these tools makes the most sense when the application:
* Can take advantage of existing libraries, models, services, and processes provided by SAP
* Serves multiple users in multiple roles
* Must integrate other services
In particular, I found the business modeling components powerful and easy to use. Visual Composer is effective for building data-driven user interfaces. I used the administration tools only to configure web services to transfer data between my model and my UI, but unified administration, deployment, logging, and governance are also valuable.
SAP NetWeaver CE doesn't remove all of the pain from enterprise software development. I didn't expect it to. It's not perfect, but in its sweet spot and with a little training or experience, it's powerful and flexible, and I'd consider using it for a real, non-toy application. It's not a tool to pull out for an afternoon's worth of work building a small application, but in situations in which I'd spend a couple of months building something larger—and where my list applies—it's a contender.
Google Open Sources Google XML Pages
Given the mind-numbingly large number of pages that Google serves up every day, compiled efficiency is a key requirement for their web development team. However, as with many organizations, Google's team has also needed to split up their development efforts, so that web designers do not need to be programmers (and more importantly, do not need to endlessly spend their time validating and debugging low level code), and the core developers could spend time building components.
Given that, it was perhaps not all that surprising that at some point, Google decided that the best way of building such tools would be to use XML as a way of abstracting out complex functionality, then using a Java-based interpreter to convert that XML into a compiled binary object. This technology, Google XML Pages, was first developed by Google engineer Laurence Gonsalves in 2001, largely as an experiment at first. Over the years, it migrated out of the lab and into a number of Google sites including the AdWords, Blogger, Google Analytics, AdSense and Google Checkout.
At OSCON 2008, Gonsalves made the announcement that, after several years of consideration, Google was releasing Google XML Pages (or GXP) under the Apache Open Source License. Gonsalves admitted at the conference that they had intended GXP to be release under open source code earlier, but the GXP team felt that it needed to be as bulletproof as possible before that should happen.
Originally developed as a Python interpreter that produced Java source code, gxp was rewritten in 2006-7 to be a completely Java based application. The idea behind gxp is fairly simple (and is one that is used, in slightly different fashion, for Microsoft's XAML and Silverlight) - a web designer can declare a number of XML namespaces that define specific libraries on an XHTML or GXP container element, intermixing GXP and XHTML code in order to perform conditional logic, invoke server components, define state variables or create template modules. This GXP code is then parsed and used to generate the relevant Java code, which in turn is compiled into a server module invoked from within a Java servlet engine such as Tomcat or Jetty and cached on the server.
Given that, it was perhaps not all that surprising that at some point, Google decided that the best way of building such tools would be to use XML as a way of abstracting out complex functionality, then using a Java-based interpreter to convert that XML into a compiled binary object. This technology, Google XML Pages, was first developed by Google engineer Laurence Gonsalves in 2001, largely as an experiment at first. Over the years, it migrated out of the lab and into a number of Google sites including the AdWords, Blogger, Google Analytics, AdSense and Google Checkout.
At OSCON 2008, Gonsalves made the announcement that, after several years of consideration, Google was releasing Google XML Pages (or GXP) under the Apache Open Source License. Gonsalves admitted at the conference that they had intended GXP to be release under open source code earlier, but the GXP team felt that it needed to be as bulletproof as possible before that should happen.
Originally developed as a Python interpreter that produced Java source code, gxp was rewritten in 2006-7 to be a completely Java based application. The idea behind gxp is fairly simple (and is one that is used, in slightly different fashion, for Microsoft's XAML and Silverlight) - a web designer can declare a number of XML namespaces that define specific libraries on an XHTML or GXP container element, intermixing GXP and XHTML code in order to perform conditional logic, invoke server components, define state variables or create template modules. This GXP code is then parsed and used to generate the relevant Java code, which in turn is compiled into a server module invoked from within a Java servlet engine such as Tomcat or Jetty and cached on the server.
The Quintessential Applet
import java.applet.*;
import java.awt.*;
public class BasicApplet extends Applet {
// This method is called once by the browser when it starts the applet.
public void init() {
}
// This method is called whenever the page containing this applet is made visible.
public void start() {
}
// This method is called whenever the page containing this applet is not visible.
public void stop() {
}
// This method is called once when the browser destroys this applet.
public void destroy() {
}
// This method is called whenever this applet needs to repaint itself.
public void paint(Graphics g) {
}
}
Here is an example of an HTML file that will cause the browser to load and start the applet:
import java.awt.*;
public class BasicApplet extends Applet {
// This method is called once by the browser when it starts the applet.
public void init() {
}
// This method is called whenever the page containing this applet is made visible.
public void start() {
}
// This method is called whenever the page containing this applet is not visible.
public void stop() {
}
// This method is called once when the browser destroys this applet.
public void destroy() {
}
// This method is called whenever this applet needs to repaint itself.
public void paint(Graphics g) {
}
}
Here is an example of an HTML file that will cause the browser to load and start the applet:
订阅:
博文 (Atom)