acts_as_conference 2008 : JRuby

Brian LeGros | February 10th, 2008 | conferences  

Day 2 started out with some presentations from the sponsors of the conferences. We got to ask questions to guys at Engine Yard as well as see a short demo of working NetBeans for RoR development. Emphasis was placed on having a true debugger in NetBeans over other IDE solutions available in this particular development arena. I know a debugger is essential for the work I do with Java, so I can definitely see the benefits that Sun was trying to show; I hope others at the conference were able to come to similar realization. After these short plugs, we got into the real start of the day with Charles Nutter and his presentation on JRuby.

Charles is the recent celeb in the JVM languages world with the work that he’s done to bring JRuby to the community as well as participating in efforts to build standardized testing and set new baselines for performance in the Ruby language. Charles approached his presentation from the perspective of a developer who has only worked with MRI. He showed us a few uses cases that have been successful with JRuby and Rails including Oracle Mix and Mingle. He ran some performance tests for us showing JRuby 1.1 (trunk) versus Ruby 1.9 and how in most benchmarks JRuby was more performant after the initial startup costs of Java. He talked about the great work being done in the activerecord-jdbc-adapter project along with the benefits of using JDBC for database connectivity. For his final point, he talked about deployment scenarios comparing Mongrel and more traditional JEE servers, exemplified via GlassFish.

If you follow JRuby in the news, there was only one surprise in his entire presentation. Charles showed us an awesome gem that the GlassFish had put together to make it easier to deploy JRoR applications. I’m going to mess with the gem more, but from what I could tell, the gem allows you start a stripped down Glassfish server preloaded with your Rails app by simply calling a command that comes with the gem. It was mentioned that it’s a 0.1 beta, but the end goal is have a production quality server out of the box. Awesome.

Overall, it was great introduction to JRuby and the tools available to it. Great work Charles!

I’m so glad Java on the web tier rocks

Brian LeGros | June 24th, 2007 | programming  

So yeah, Java on the web tier rocks, at least from the awesome assessment I just got done making from the Java Pet Store 2.0 Blueprint Implementation (JPS). My hopes were pretty high going into this project that I would see some good programming practices in the web tier that would inspire my thought process with respect to ColdFusion. Unfortunately, if the JPS application is any clue what the Java community thinks “Web 2.0″, then they’re in trouble. Here are a few things that have been giving me headaches as I’ve been going through their source code:

  • Table-based layouts :)
  • No XHTML compliance
  • Gobs of Javascript code located inline within the HTML document
  • AJAX implementations preached as features of JEE 5 are truly just code written to interact with the Dojo library. I have seen only one instance in my, all be it limited, analysis that showed me Javascript code generated by any Java web-tier software. ColdFusion’s AJAX integration and binding capabilities will put their implementation to shame.
  • Uses an RSS control (via JSF I think) to consume an RSS feed and render it as HTML. Looks interesting but where is the RSS integration to provide feeds? How many developers, besides RSS aggregator builders, actually want to consume feeds? <cffeed> will be a welcome substitute for what they have.
  • There is this crazy set of classes to encapsulate the functionality of working with Lucene for searching the site. Can’t wait to implement <cfindex> and <cfsearch> to get rid of these 7 or so classes.

Please keep in mind I am no JEE expert and although I’m excited about interacting with new specs such as JPA, I don’t know much about them. That being said, I do however feel comfortable enough with good web practices to realize that this technology demo is not web savy. I feel I understand the purpose of the JPS application as a technology demo for JEE 5, but the use of web standards that it promotes is severely lacking. What I am able to accomplish using Java in the application/business-tier is amazing and I don’t see myself deviating from that any time soon. What I am able to do with ColdFusion in the web-tier vs. what I’m seeing in the JPS definitely convinces me that I won’t be using Java for the web-tier with any of my applications.

So far the raw conversion of the JPS in Java to ColdFusion has been trying, and after 6 hours, I’m ready to take a break. Hopefully, I can motivate myself to get into the “nitty-gritty” of the Javascript code they’ve written using Dojo to see what I need to reproduce from a CF perspective to satisfy their code. I figure once I’ve gotten the app working using a very stripped down CF approach, I can begin to do what I actually wanted to do from the start … make the application actually look good and simplified.  I may skip the use case analysis because I’m not good at collecting requirements, but the UML I think can be done quickly and simply to show its benefit.

I put your lunch in the fridge … next to the ColdFusion container

Brian LeGros | June 3rd, 2007 | programming  

Well, no sooner do I finish blogging about the new scripting integration in Java 6 then did Sean Corfield start to play around with it in the context of CF8. His examples have given me a better understanding of the capabilities of the Invocable interface as it applies to JSR 223 compliant languages. Looks like he had some issues initially going from PHP to CF but the transition to JRuby seemed to have gone pretty smoothly.

From the little I can tell, a CFML engine implementing JSR 223 would open up tons of possibilities for Java containers (possibly even integration of JEE specifications — JTA). ColdFusion application servers could be built using the same scripting engine but provide different features. I could see Smith and possibly Railo benefiting from this initially so I guess I can understand why Adobe was against complying. Adobe has such a monopoly on the CF app server market, even creating the CFML engine to be JSR 223 compliant might cause a demand for it to be open-sourced.

Man, wouldn’t that be awesome?!? An open source CFML engine based on Java. I wonder what types of performance hits we’d have to take, if any? I guess that’d be the great thing, we could choose our implementation at that point. I can’t see BlueDragon, Railo, and Smith not jumping right onto that band wagon and evening the app server playing ground. From some of the review’s Sean’s done on alternative CF servers (also here), I could see this as being that factor that makes people stand up and take notice. Right now, only Adobe can truly say they are 100% CFML compliant because they control the language and the direction of the language, not to mention the audience. An Adobe endorsed CFML engine would mean such great things for our community. I could really see a lot of innovation from tool makers and app server creators alike. Imagine if Mark Drew could create a local context to execute CFML code w/o needing hooks for server to be configured?

Ok, so I’m ranting now, but some cool stuff none the less. Nice intro to the CF community on these technologies Sean.

My pet store is better than yours!

admin | May 3rd, 2007 | programming  

So I’m sitting in the airport and I was looking over the Java Pet Store (https://blueprints.dev.java.net/petstore/) application from which the CFPetMarket application is based. After some reading over the last few weeks I think I’ve been able to clear up some confusion in my head. Initially I thought that the application was exercising plain old Java. Then I realized I’m an idiot and the standard way of constructing web-apps in Java is via the JEE framework. Now that this is setting in, I’m thinking crap. Check out what they are attempting to exercise via the sample application:


This application also demonstrate the use of various features of the Java EE 5 platform such as:

  1. JavaServer Faces: Many of the AJAX features are implemented as reusable JavaServer Faces components.
  2. Java Persistence API: The application uses Java Persistence APIs to create an object/relational mapping layer.
  3. Dependency Injection: The application uses dependency injection instead of deployment descriptors.

Crap. So I can use XML Forms to show a comparison to JSF, but I’m not sure how I can implement AJAX features w/o using an API like Spry. ColdFusion has a couple tags for <cfselect>, <cfupdate>, and <cfinsert> but nothing as robust as a standard interface API for object persistence. As far as the dependency injection stuff, deployment of a CF app in a stand-alone server install doesn’t support bundling, so I’ll ignore that for now.

Does anyone have any ideas for what I can do to setup the Pet Store app in CF to mimic the functionality that the JEE 5 framework can provide?

I can WAR an HTML file

admin | April 17th, 2007 | programming  

This is pretty much all I was able to accomplish over the last few days as it applies to JRuby. I haven’t dug into the Ruby language or Rails framework at all yet (besides the command “bin/rails myapplication”), but I’m loving playing with the tools JRuby provides to integrate with Java. Check this out:

jrubyc /mypath/myclass.rb

This is the command to compile Ruby code to Java byte-code. Ok, not that impressive, but just cool to write down. There is even a just-in-time compiler which ranks as extra cool. Check out this page in the JRuby wiki for more info.

I’m probably blowing the WAR magic out of proportion since it’s really just a glorified Ant task bundling up some dependencies for JEE servers to work with Rails. Here is the tutorial I used to create the WAR. I dropped it in Tomcat and it seemed to deploy w/o issue.

Maybe in a few days/weeks I’ll be able to figure out how to use the language and do something meaningful. In fact, my goal is to learn nothing about Ruby and just learn Rails. Ultimately, I can only hope to dream of the creation of the SPRUG (SPace coast Ruby Users Group) over here in Melbourne. With just the knowledge of Rails, I should be able to continue the tradition of Ruby UG’s everywhere. Just kidding fanboys! Keep “The Active-Record” alive and relax; I’m an idiot. I WAR’d an HTML file thinking it was a Rails app.

NOTE: Check out Charles Nutter’s blog if you get a chance. Since JRuby’s 1.0 release is coming soon they have a lot of fun runtime comparisons between regular old Ruby and JRuby. It’s a pretty good read from one of the head developers on the project.

Come for the Java, stay for the VM?

admin | April 9th, 2007 | programming  

OK, I shamelessly ripped off the “Come for the Java, stay for the Cocoa” line from some banner image I saw taken at an Apple conference. I’m moving on…

I was listening the the Java Posse this morning on my quick commute to work (Java Posse - Episode 111) and the topic was Withering Java. Who knows wtf that means. The whole podcast was about the functional programming paradigm (examples in Haskell) spawned by a talk at the Java Posse Roundup on the language Scala. You can read about Scala and Haskell at Wikipedia.

It was cool to hear about another paradigm besides the popular procedural and OO paradigms. I remember learning about functional languages in college, but doing very little (=nothing) with them. From what the panel was saying in the podcast, it seemed like functional languages are starting to be shaped by the more practical in the field of comp sci to be used in industry solutions. Although it seems like the paradigm has been around for like 15+ years, I’m encouraged to see it making its way out of academia.

The podcast went on to talk about how great it would be if it became common in shops for multi-language environments to spring up around a single VM, the JVM to be specific. One of the panel members kept going on about how he’d hire JRuby programmers for the presentation tier, Java developers for the application tier, and functional programmers for expert portions of the application tier and deploy everything to a JEE server. It was a good feeling to be able to say “HUZZAH!” in the car when I heard this. My co-workers and I have been using ColdFusion and Java in this fashion for a long while now. We have a separate architecture and implementation processes for Java and ColdFusion but everything deploys to JRun and potentially to any JEE server. I’m really hoping that with the release of JSE 6 that Adobe could utilize the new javax.script package to more fully integrate Java and ColdFusion. How nice would it be to plug a scripting engine for ColdFusion into your JEE server instead of running as a web app on a JEE server? All the sudden you have access to JTA, JNDI, and JMS resources with the ease of scripting in ColdFusion. Any issues ColdFusion currently has with truly entering the enterprise could potentially be solved.

NOTE: Now I have to ground myself after that rant. It looks like Macromedia was a big sponsor of JSR 223, so it’s probable I’m just over estimating what’s possible with Java 6.

There was a bunch of other stuff in the podcast about byte-code optimization and language comparisons that make it worth a listen. This was by far one of the best Java Posse episodes I’ve listened to since I’ve started.