Posted on

Using Netbeans

Chase introduced me to Netbeans a couple of months ago.   It looked cool, but as with any dev tools there is some inertia involved in switching to a new editor.

I’ve been using Netbeans on my Linux dev box for about a month now.  While there are some quirks and some problematic areas with Netbeans, overall I have grown to like it more than jEdit, gvim, WinEdit and a handful of other code editors.    It is well balanced between the powerful, but often way to “heavy”, Visual Studio platform and the weaker editors like jEdit.
My favorite features I’ve come to discover & use on regular basis:

“Projects”

Netbeans will create projects based on current source directories.  Tell it the basic project type, such as PHP, and the starting file.  It tries to be intelligent about the structure of your code by doing semi-intelligent crawling.  It does a decent job.  The thing I really like about this is now that I have a dozen source directories setup as projects I can use the other tools (see find below) to locate stuff wherever it may reside.

“Find In Project” (ctrl-shift-f)

Netbeans will build a project based on a source directory you specify.  It crawls the source and builds a semi-intelligent index, which is a nice feature for “object browsing”.   However this quick search tool is my “go to” for locating “stuff”.    You can easily setup include/exclude patterns using system tools like “exclude this folder” or regular expressions.   The regex include/exclude is easy to use and super-powerful.     This same tool allows you to search “all projects”, “all open projects” or just the current project.

“Navigate”

Highlight a function or variable and right-click.  Use Navigate to find the definition or all occurrences (usage) of the same variable/function/thing-a-ma-bob.   Very nice and cuts down on my “find in project’ searches, especially when I want to modify a definition.

“Smart Complete”

I’ve not seen this in a decent PHP editor before, but it works much like the Visual Studio tool.  Start typing a method/function name and it pulls up all possible methods/functions and their property variants.  If you have optional params it lists those as different variants.  If your commenting on the declaration is well formatted it will also show you the description of the function, what the parameters are meant to do and more.     Scroll, pick one of the prototypes from the list and press enter and the call is put into the inline code, press tab to jump to and replace each param.

“Commenting”

This kind of goes with “Smart Complete”.    It took me 6 weeks of using Netbeans to find this because I NEVER write the code first then add the comment block.  I always put a stub comment first, then go back and fill it in.    I happened to paste in a function from elsewhere that had no comments, went above it and typed “/**”.   Netbeans automatically created a comment block with all the params listed.  That was cool.
You can learn more about auto-created comments and auto-completion here:

Summary

So I’ve grown to really like Netbeans.    Yes, it has some issues but overall the benefits outweigh the problems.
I know Eric has a plethora of Emacs tips & tricks he’s shared over the years.   What about others?  Do you have a favorite editor or IDE?   What are the cool tricks you’ve found?   Or if you use Netbeans, what other shortcuts have you discovered to help you manage/write code?