The new edition of MundoJava magazine is finally out!
This edition turned out to be very cool since it’s the first one dedicated to dynamic languages on the JVM, particularly JRuby. We dedicated three articles to this topic, each of which I summarize next.
QUICKLY BUILDING DESKTOP APPLICATIONS USING JRUBY AND NETBEANS
This article, written by Demetrius Nunes, talks about how to build highly-testable desktop swing applications with the Model-view-presenter (MVP) architectural pattern and Test-driven Development (TDD). The author uses the NetBeans IDE for building up the GUI using the drag-and-drop great utilities offered by Matisse (Netbeans 6.0´s GUI builder). In addition, RSpec is used to specify and test the presentation-logic of the user interface. RSpec is a behavior-driven-development tool that allows one to write behavior-oriented unit tests in Ruby. The process of building a typical GUI is comprised of the following steps: 1) Write the tests for the Presenter (the presenter will be the class which will centralize the presentation-logic of the GUI) ; 2) See the tests fail; 3) Write the Presenter (using mocks for view and model); 4) See the tests pass; 5) Refactor. At the end of the process, we´re gonna have our GUI fully tested without even having the GUI itself! The GUI then can be visually created using the excellent resources of Netbeans. The whole MVP/TDD approach is a great technique to be used for Swing application development. Extra benefits, like readability and writability, stem from using a more concise and expressive language like Ruby to write our tests.
DYNAMISM AND ELEGANCE OUT OF THE COMBINATION OF JAVA & RUBY
In this article, my colleague Alex Marques Campos and I talk about how we can extend our Java applications using Ruby and the Java Scripting API. Firstly, we give a Ruby-in-a-nutshell description for Java developers unfamiliar with the scripting language: history, main features, basic types, OO, inheritance and mixins, dynamic typing, metaprogramming, reflection and DSLs. Next, we go on to describe the Java Scripting API (JSR-223). The API was added to the JDK in 2006. Its goal is to uniform the use of scripting languages on the Java platform through the use of a small set of classes and interfaces developers need to know. We describe how to use the JRuby scripting engine to integrate our Java applications with the Ruby language.
JRUBY + WEB: WHY USE JAVA WITH JRUBY ON RAILS?
Last but not least, Fabio Kung covers in his article a range of topics regarding JRuby and Java, including: performance issues of JRuby, the advantages of executing Ruby code over the JVM and how we can take advantage of that, how and why execute web applications with Ruby On Rails using Java technology.