Friday, March 27, 2009

Netbeans - Debugging Rails apps

My new gig at Integrum could easily be described as constant, face-paced learning. The tool of the trade there is TextMate, a commonly used editor/IDE in Railsistan. Integrum feels like a place where ideas flow pretty openly, given said ideas have strong merit, so I considered bringing up the editor I use on my personal time and in my previous gig - Netbeans.

When using Netbeans, I did a lot of trail-blazing by going to desktop development route with tools like Monkeybars. I knew based on some peripheral projects that Netbeans had a lot of optimizations for Rails particularly.

During one of the weekly talks, I figured I'd do a quick rundown of things Netbeans could do that TextMate just couldn't. This isn't an attack on TextMate. I use TextMate personally as well, but more as a text editor that's lightweight, and less as my primary IDE, because I feel Netbeans fills that gap quite well. After some time at Integrum and learning some more of TextMate's cool features, I'm still sold on Netbeans as a primary IDE. I set out to learn more about some of the Rails specific or at least optimized features in Netbeans.

One of the Rails features in Netbeans is the debugger, as they love to talk about on their front page. Unfortunately, what the Netbeans team does and what their users do seem to be two entirely different worlds. Debugging a Rails app with Netbeans feels only useful if you're a Rails Core developer, and not one of the Rails users. This is because 'step over' in the debugger is really a smaller version of 'step into'. Stepping over a line in my controller code sent me deep into the bowels of Rails, and several more steps wouldn't get me out (and 'step out' simply wouldn't work and was disabled). I couldn't show this to my team.

Netbeans 6.5 had been out for a while. If there's one thing I've learned doing Ruby development, it's that if you're not on the cutting edge, then you're behind. I'm not very convinced that this a good thing. My dev directory is littered with tons of projects because a developer wasn't brave enough to make a release, and instead just has a repo up on github. Back to Netbeans - I nabbed the Milestone release (6.7 M2). Understand that going this route with Netbeans is quite an adventure, with crashes, stalls, and other things to look forward to. My hopes here is that this major shortcoming (rendering debugging totally useless from a productivity standpoint) would be fixed in a newer. No joy.

I can't show this off to my teammates. I can show off some other features that Netbeans has over TextMate, but Netbeans is only a little better. Method seeking, RDoc, syntax validation, IRB, etc are all in TextMate, just in a more primitive form. The real cherry on top would be having a solid debugger. It makes the difference of my talk being 'There's more than TextMate out there, just FYI, but it might be too painful to switch vs. the benefits' instead of what I'd like it to be: 'Netbeans: THE Ruby IDE'.

I'm hooked in to the feeds for Netbeans. I see the weekly announcements. As a Ruby developer, I feel like a second class citizen here (Netbeans was built for Java, after all). However, it doesn't help that lately I've seen mostly updates to the PHP side of the IDE. My thought always is: Wait a second, the Ruby side still needs a lot of love. Don't leave yet! To top this off, I've heard the Netbeans team got hit pretty hard by seemingly universal layoffs by larger companies at the beginning of the year. I won't hold my breath for a better debugger.

This is a place I'd love to be wrong. Is there something I'm missing?

3 comments:

dneighbo said...

I tried NetBeans 3 different times. My big complaints then (a lot probably has changed).

1. It's massive. Being an old emacs guru. I can deal with a "heavy" editor, but the 4 hour netbeans download was painful and 2 minute startup time was just painful.

2. It suffers from information overload. Because it is a GUI builder as well as an editor it has tons of bells/buttons/whistles that are just noise that I will never use. I'm okay with that if you sufficiently hid it from me. Net Beans does not. It has poor UI imho.

3. Most of its advertised Rails perks just didn't work as advertised or were very clunky. I felt like I had to use the mouse ALL the time to get anything done.

That said, I am not a huge fan of Textmate, but I wanted to really give it a try before I gave up on it and went back to emacs. I started the TextMate tip of the day screencast to force myself to learn the editor. I will share my opinion in a few months.

Maybe a NetBeans tip of the day for rails folks woudl go a long way in converting people to Net Beans. For me I don't see a compelling reason to make the switch, but I would love to hear one.

The current state of Rails editors today appears to suck.

Logan Barnett said...

I completely agree with pretty much everything.
I think Netbeans has some really awesome features that go a long way for helping productivity, but it lacks a trump card.

One thing I have seen in more recent versions of Netbeans (6.5) is that there's quite a few TextMate keyboard shortcuts they threw in. I'm pretty sure this isn't 100% though. I'm a hybrid keyboard/mouse guy, so I haven't explored that aspect as much.

I might try out the tip of the day thing. Just making this post got me to learn a lot about setting up debugging with Netbeans (:

David said...

@dneighbors: Oh come on, that's pure FUD you're spouting off.

>1. It's massive. Being an old emacs guru. I can
>deal with a "heavy" editor, but the 4 hour
>netbeans download was painful and 2 minute
>startup time was just painful.

Really? Check out the download page for the various flavors of Netbeans: http://www.netbeans.org/downloads/index.html
The Ruby version is 55MB. Now that's not the petite 10MB Textmate download, but it's certainly not a 4 hour download unless you're on some 56k modem connection. Oh, and that download includes the glassfish app server that can serve as a production deployment server. So if you run under Mongrel for development with Textmate you should factor the Mongrel download size into your overall Textmate vs Netbeans size comparison.

>2. It suffers from information overload. Because
>it is a GUI builder as well as an editor it has
>tons of bells/buttons/whistles that are just
>noise that I will never use. I'm okay with that
>if you sufficiently hid it from me. Net Beans
>does not. It has poor UI imho.

The Ruby edition of Netbeans can't even syntax highlight a Java file, much less build GUI's. Even if you have the Java editing and GUI builder tools installed, how is it "in your face"? You right click on your project/folder select "New" and you see options for the project type you're working on. When I right click/New in a Rails project I see ERB File, Ruby File, RSpec File, etc. Nowhere on that list is Java file, JFrame, or JUnit test case. I don't see how you are getting non-Ruby options when editing a Ruby project.

>3. Most of its advertised Rails perks just
>didn't work as advertised or were very clunky. I
>felt like I had to use the mouse ALL the time to
>get anything done.

So Command + Shift + A doesn't jump between your controller and your views? Command + Shift + T doesn't jump you to your tests?

Command + O opens up a particular class, no need to leave the keyboard to jump around in your application. Also you can define "Next Tab / Previous Tab" which I map to Command + K and Command + J for easy tab switching.

I understand that Netbeans is not fully keyboard drivable ala Emacs, but it's far from the mouse dependent, confused behemoth you make it out to be.

Post a Comment