Summary
In a recent InfoQ article, Sun's Roman Strobl reviews three Ruby-related features of NetBeans: Ruby code completion, debugging, and refactoring.
Advertisement
One of the most interesting new features in Sun's NetBeans IDE is support for the Ruby language. In a recent InfoQ article, NetBeans: Ruby Developer's New Best Friend, NetBeans developer Roman Strobl highlights three features in NetBeans 6 that make Ruby developers' lives easier:
Code completion:
In Ruby creating good completion is a very difficult task because types are not declared in Ruby language. Thus the IDE resorts to heuristics to guess what the types are and provides options in code completion based on its guess... Code completion shrinks the possible number of options as you type, and you can simply hit Enter to fill in the selected option.
You can see the module for each of the methods and what parameters are accepted by the method. Providing a fast way to fill in the method/class/module name and parameters is only one of many ways that code completion helps. Also extremely useful is the way that code completion shows documentation (RubyDoc) for each of the classes, methods, modules, keywords, etc...
One of the useful features of code completion in NetBeans is support for regular expressions. Unless you are one of the few who can remember all syntactical options for regular expressions, you will find this very handy...
Graphical debugger:
NetBeans provides a graphical debugger for Ruby, one that is very similar to Java's. You can add breakpoints into your code and run the application in debug mode and it will stop on the first breakpoint as expected. Then you can see useful views such as local and global variables; you can add watches; see the call stack, switch threads, etc... RHTML debugging is supported as well, and you can easily step through RHTML pages.
Refactoring:
With NetBeans, this process is automated so you can do things such as search for all usages of any method/class/variable in your code or invoke the rename refactoring to change the name of the element.
In future versions of NetBeans's Ruby support, there will also be other refactoring available, including features such as extract method, extract local variable and others.
The IDE can sometimes detect variable collisions in code and in cases where the code may not do what the user intended. The IDE can provide a "quick fix", an easy way to correct the code...