Tim Boudreau is a noted technology consultant, evangelist and author. While perhaps most broadly known for his leadership on Sun Microsystems’ NetBeans, those who’ve worked with Tim remark most on his technical chops, passion for a great challenge and rare gift of great communication. And, as a former troubadour, he’s pretty tough when it comes to bad 70s rock lyrics too. A real renaissance programmer. Tim has posted 25 posts at DZone. You can read more from them at their website. View Full User Profile

Tim Boudreau: My Five Favorite NetBeans IDE Features!

08.08.2014
| 3567 views |
  • submit to reddit

Continuing a series of articles focusing on NetBeans users and their five favorite NetBeans IDE features, here's the next part, by Tim Boudreau. -- NetBeans team.

Tim Boudreau is a noted technology consultant, evangelist and author. Most broadly known for his leadership in the NetBeans project while it was part of Sun Microsystems, those who’ve worked with him remark most on his technical chops, passion for a challenge, and rare gift of great communication. And, as a former troubadour, he’s pretty tough when it comes to bad 70s rock lyrics too. A real renaissance programmer!

What are your 5 favorite NetBeans features?

1. Hippie Completion. I put this first because fancy editor features usually get the attention, and this is a simple one that's been there since 1999. But I probably use it 10x as much as traditional code completion.

Start typing a word and press CTRL-K and the editor will find a matching word in the open files, and cycle through matches if you press it repeatedly. It, and code templates, are probably more responsible for the speed at which I code than anything else. (More on this here in an old blog entry by Tor Norbye.)

2. AngularJS support. I use AngularJS a lot, and the fact that syntax highlighting and code completion works inside the quotes of a tag attribute is pretty amazing.

3. NodeJS Support. This is a shameless plug, since I wrote the module. It is available on my update server:

http://timboudreau.com/modules

Or can be downloaded from Jenkins:
http://timboudreau.com/builds/job/NetBeans-NodeJS-Plugin/

NodeJS is a wonderful server-side complement to Java, since they have different strengths. These days, I frequently write hybrid systems, where one side of the wire is NodeJS and the other side is Java. For number crunching or highly multithreaded stuff, I use Java. If I need to run a bunch of native processes, I'll use Node. With this plugin, I can have Java and NodeJS projects both open at the same time, and they are both first-class citizens of the IDE.

Click to enlarge the image below:

4. Maven Support. With first Ant, and even more so with Maven, NetBeans made the decision to support popular project build systems directly. The IDE's metadata about the project simply is the project. If I check a project out from GitHub, I can simply open it - NetBeans didn't reinvent the wheel.

I stuck with that pattern in my NodeJS plugin. The metadata is Node's native package.json file. Not only can you open any NodeJS project, with no additional steps - but since the libraries that project uses are also NodeJS projects, you can open those as well. So you can just check out a NodeJS project from Git or whatever, instantly open it, and drill through all the libraries it uses and open those too.

5. Code Templates. Little sequences of characters you can type, then press tab to expand into a much bigger chunk of code. These are wildly powerful, yet few people realize you can define your own in Editor | [language] | Code Templates. You can specify what bits of the template can be tabbed over and edited (so for example, in Foo bar = new Foo() you only have to type Foo once). Here are some of the built-in ones:

  • n - yes, just type n and TAB, and you declare a new variable and get to edit its type
  • re - return
  • psvm - create a skeleton main() method
  • 2arr - find a collection in scope and call toArray() on it, filling in the types correctly
  • psf - private static final
  • Psf - public static final
  • csort - find a collection in scope and sort it
  • lka - NetBeans plugin project specific - find a Lookup in scope and call lookupAll(SomeType.class) on it - there are several variations on this (Lka does the same with the default lookup) - this saves a lot of boilerplate typing
  • sout - Good old System.out.println()
  • tds - Thread.dumpStack() (can you tell I usually debug things via the console?)

And here's one I defined for myself - it adds a null check for a parameter (i.e. I'm writing a method that takes a parameter "someObject" and I want the method to begin with Checks.notNull("someObject", someObject) using a library call to throw an exception if the parameter is null. Not only does it usually automatically find the right parameter, but I only type the name once if at all:

${coltype type="com.mastfrog.util.Checks" default="Checks" editable="false"}.notNull("${param instanceof="java.lang.Object"}", ${param}); ${cursor}

It's a bit vebose, but you type it once, and then use it forever!

Watch this space for more from Tim, on which NetBeans plugins he finds useful, as well as a list of his favorite frequently undiscovered features. He'll also write about a plugin he's working on that finds code similar to what you're working on, in its database of source code from well-coded projects, as you edit and shows it to you.

Do you and your colleagues also want to share your team's favorite NetBeans features with the world? Write to netbeans dot webmaster at gmail dot com.

Published at DZone with permission of its author, Tim Boudreau.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)