http://java.sun.com/ http://java.sun.com/javaone http://java.sun.com/javaone
JavaOne - ExperiencingJava technology through education, industry, and community
Home > The NetBeans Ruby IDE: You Thought Rails Development Was Fun Before

The NetBeans Ruby IDE: You Thought Rails Development Was Fun Before

 

by Ed Ort
 

One of the powerful features added to NetBeans IDE 6.0 was support for Ruby, JRuby, and Ruby on Rails. The Ruby programming language has become popular with a growing number of developers because of its simplicity and its productivity features.

JRuby is an open-source pure Java implementation of the Ruby programming language. Because of its tight integration with the Java platform, JRuby allows Java applications to call into Ruby code. It also allows Ruby applications to call into Java code. This Ruby-Java integration is a very handy feature for developers.

Ruby on Rails, often shortened to Rails, is a web application framework written in the Ruby programming language. The framework is designed to make web application development faster, simpler, and more efficient.

With this added support for Ruby, JRuby, and Rails, developers can take advantage of the NetBeans IDE's sophisticated project management, editing, and debugging features in building their Rails applications. In the technical session titled "The NetBeans Ruby IDE: You Thought Rails Development Was Fun Before," Sun Principal Engineer Tor Norbye and Sun Senior Engineer Brian Leonard, both NetBeans experts, used the NetBeans IDE to quickly build a Ruby on Rails application -- a simple web application that tallies votes for presidential candidates. In the process they demonstrated many of the features in the IDE that make it an attractive tool for Ruby on Rails development.

Norbye and Leonard presented far too many features during the session for me to cover in this short article, so I'll highlight just a few of them.

  • Project management: NetBeans allows developers to create a Rails project from existing files or to create a project "from scratch." In addition, developers can specify a specific Ruby interpreter when they create a project, for example, the native Ruby interpreter or the JRuby interpreter. The interpreter can also be changed during the development process.

  • Code generators: One of the productivity features in Rails is the use of code generators, saving developers from doing a lot of boilerplate coding. NetBeans provides all the standard code generators that come with Rails such as scaffolds, which construct most of the models and views for a basic Model-View-Controller-based Ruby on Rails application, models, controllers, database migrations, and integration tests. Additional generators can be easily installed into NetBeans.

  • Code completion: Code completion is available in the NetBeans editor for all Rails APIs. It's also available for database parameter completion in ActiveRecord calls, as well as for hash keys and hash values.

  • Editing in Erb files: Erb files are the Rails version of JavaServer Pages (JSP) technology files, allowing developers to embed executable Ruby code within the HTML code on the page. An embedded block of Ruby code is called a scriptlet. All the NetBeans editing features available to Ruby are also available to scriptlets. In addition, the editing features extend to other code in an Erb file such as HTML, JavaScript, or CSS.

  • Quickfixes: The editor checks for many common programming mistakes, providing hints for fixes. It also identifies deprecated Rails constructs and suggests replacements.

  • Source navigation: NetBeans has some nice shortcuts for Rails application editing. For example, press Ctrl-click on a class, method, field, or variable to jump to its declaration. Press Ctrl-Shift-T to jump between a file and its test. Press Ctrl-Shift-A to jump between a controller and its view.

  • Advanced debugging: NetBeans supports a comprehensive set of debugging tasks for Rails developers such as stepping through code, setting breakpoints, inspecting local variables, navigating call stacks, and running tests. It also enables debugging of both template files as well as Ruby files.

  • Flexible deployment: NetBeans supports deploying a Rails application to any Java servlet container such as Tomcat or GlassFish. Leonard pointed out that most deployment environments do not include Ruby containers. So this feature enables developers to deploy their Rails applications in their existing infrastructure. Unfortunately, Leonard could not get the voting application to run. It's likely that during the talk, Norbye or Leonard added some incorrect code to the working code that was originally folded into the project. However, this gave Leonard a chance to show more debugging features.

I was impressed with the comprehensive set of Rails development features already in NetBeans, but enhancements are coming. Norbye said that future plans include more extensive type inference, enhanced test support, better console integration, more refactorings and quickfixes, improved Java integration, and support for additional Ruby frameworks.

Despite the application execution problems, this was an impressive display of Rails support in NetBeans.

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.