NetBeans 6.5 review

December 1, 2008 – 11:07 am Tags: , ,

During the weekend, I tried out NetBeans 6.5 and its new PHP related functionality. I had earlier seen some quick shots of how the support was, and it seemed like a good contender for big names like Zend Studio.

What features does NetBeans 6.5 have for PHP developers? How does it compare against Zend Studio for Eclipse?

Overview

At the general level, NetBeans is quite similar to most other IDEs: You get a project view on the left, an outline of the things in the current file under that, an editor on the right and a task/problem view below the editor. It does all the usual tricks you’d expect, like tabs in the editor, syntax highlight, PHP function code assist etc.

Other PHP related functionality it provides are things such as templates – when you type func, it can autocomplete an empty function for you, fast PHPDocumentor docblock comment creation, code-assist for custom PHP classes based on the docblocks, including what variables their methods take etc.

NetBeans also has refactoring support for PHP – something that I’ve only seen before in Zend Studio. For example, you can easily rename a variable or a method in your class, so that it gets renamed everywhere in your code where it’s used.

In depth

The PHP editor

This is of course the most important part. Zend Studio for Eclipse has a very good PHP editor, and other IDEs with PHP support that I’ve tried (such as Komodo) usually fall very far from it.

NetBeans, however, does about 95% of what Zend Studio does.

  • Code-assist for builtin PHP functions? Yep.
  • Code-assist for custom functions and classes? Yep.
  • Quick insertion of phpdoc blocks? Yep.
  • Displays phpdoc information in code-assist? Yep.
  • Does above for variables, methods, methods’ parameters and all? Yep.
  • Let’s you easily rename variables/methods/classes with a refactoring tool? Yep.
  • Supports snippets/templates for quick inserting of function/class stubs etc.? Yep.
  • Supports code folding? Yep.
  • Supports jumping to the declaration of a variable/method/class? Yep.

Did I forget anything? Feel free to point it out!

NetBeans even does some of the things better than Zend Studio – which is definitely an achievement.

PHP code-assist in NetBeans
php code assist in NetBeans
Click for bigger image

For example, the code-assist for builtins displays more information, and links to PHP manual. The code folding feature (ie. those little + signs that you can use to make funcs and comment blocks smaller) works reliably, unlike in Zend Studio where it can screw up and display your code totally wrong if you use the folding feature, which is luckily only a rendering glitch.

NetBeans’ PHP documentor support is very good as well. For example, it supports the @property declaration that isn’t supported by Zend Studio. This is useful for example when you work with Doctrine 1.1, as it generates those for your models to give code-assist for the model properties.

But while NetBeans gives you @property, its support for @return is a bit shaky. It works just fine as long as you have a single return value, ie. @return Zend_Layout, but it screws up when there’s more, like @return Zend_Layout|null, which is valid phpdoc and means it would return either an instance of Zend_Layout or null. In the latter case, NetBeans won’t give you any code-assist at all. I have filed a bug report for this, so hopefully it’ll be fixed in a future release.

The project view

The project view does a decent job of letting you go through the files and directories in your project with ease. It will also display little icons and color changes, if you’re using subversion, to indicate modified files and such.

While it’s otherwise good, I do have a minor gripe in regards to creating new items. If you hit Ctrl+N in Zend Studio to create a new item, you can simply type in “folder”, “file” or “php file” etc. and hit enter and be done with it. In NetBeans, you need to first choose the correct main “group” of items, then hit tab and choose one of the file types (or mouse click) and hit enter. For some weird reason, if you doubleclick one of the items with the mouse, nothing will happen, and you will need to click next.

So if you’re really used to the way Eclipse based IDEs handle creation of new files and dirs, this may initially be a small annoyance, but it still works okay after you get used to tabbing around the selections.

PHP debugging support

While I haven’t used this much yet, it exists and seems to work as you’d expect with functionality like setting breakpoints, stepping through code and viewing variable values. NetBeans’ debugger appears to work with XDebug instead of the Zend Debugger module you will require to use Zend Studio’s debugging features.

+1: NetBeans debugger immediately worked with the xampp installation I had on my PC. The installer already picked up my apache from there, and when I fired up the debugger, it worked seamlessly. Getting Zend Studio’s debugger up and running was a bit more of a hassle, and I actually needed to consult Google for that.

Version control support

NetBeans supports CVS, Subversion and Mercurial out of the box, but they may require an external download if you don’t have the correct client installed beforehand. The installation for those is automatic and relatively painless, though.

The svn support was a bit confusing as it did some things in a bit weird way, compared to what I had gotten used to with TortoiseSVN. However, it works rather well after you get to know the quirks.

Wait, there’s more

NetBeans does even more than that. It has better support for HTML, CSS, JavaScript and even formats like YAML.

HTML code-assist in NetBeans
php code assist in NetBeans
Click for bigger image

When editing HTML in Zend Studio, it sometimes lets you autocomplete the closing tag, and it does display a list of attributes for some tags like form. That’s pretty much all it does.

NetBeans HTML editor is great – it autocompletes closing tags, lists attributes, even displays details on what the attributes do. It displays a lot of information for tags, too.

It doesn’t do that just for HTML – that happens in CSS as well. You get good information on the properties, and options for the values. It also features a “style builder” and a preview which lets you see how your selected style would look. As an added bonus, it seems to handle cascading styles correctly, so if you define that the body has a black background and your h1 declaration says the font must be white and bold, the preview has a black background too.

While the detailed infoboxes on HTML and CSS may not be of use to everyone, it could save you a trip to the W3C CSS spec – I know I have had to look things up from there from time to time.

And you get all this for JavaScript too – code-assist, function explanations, even for custom functions and complex objects. Oh, and debugging support in Firefox or IE. The JavaScript assist can even understand the difference between static and nonstatic functions (or whatever their proper JS terminology is), has some support for JSDoc etc.

Conclusion

Why aren’t you downloading NetBeans yet?

With all these features, the minor flaws in it don’t really matter – and they will hopefully get ironed out in a new release.

Did I mention it’s free? Yep, it has more features than the commercial big name Zend Studio does, and it’s completely free.
I probably forgot to mention something, since it’s got so many features in it. There’s also support for SQL etc. but I haven’t looked into those yet.

NetBeans 6.5 is officially my new favorite PHP/web-dev IDE.

Further reading:
Vim user? You’ll love NetBeans

Share this:
  1. 37 Responses to “NetBeans 6.5 review”

  2. Personally I only use ide’s like that for languages I have less experience with. For PHP I use e (textmate for windows) or textmate (for the mac, duh)

    By Harro on Dec 1, 2008

  3. I recently switched from Eclipse PDT and dont regret it. I really like all the nice features which Netbeans has “out of the box”. While in Eclipse I had to install 5-10 plugins to support the things I need. Also the “building workspace” annoyance does not occur in netbeans. Of course Netbeans also has to parse the PHP files and annotations, but this is much faster and done in the backgroud. Your IDE isn’t blocked while the “task scanning” occurs.

    The only performance flaw I could find was when working with shared folders (e.g. samba). Sometimes the task scanning, code completion or opening a file was a bit slower then usual. But that may also be a samba issue.

    By thedave on Dec 1, 2008

  4. Yeah most likely just a slowdown caused by the network latency or such. I ran some remote project in Zend Studio and it was horrible.

    By Jani Hartikainen on Dec 1, 2008

  5. Jani, got a link to your bug report? I’d like to keep an eye on it.

    By eric on Dec 1, 2008

  6. Here you go:
    http://www.netbeans.org/issues/show_bug.cgi?id=154142

    By Jani Hartikainen on Dec 1, 2008

  7. This is the first open source PHP IDE that I have ever actually enjoyed using. Certainly beats my various Eclipse experiences.

    By Stuart on Dec 1, 2008

  8. How do you insert phpdoc blocks?

    By JD on Dec 1, 2008

  9. If you write a block of code, say..

    public function myMethod($param)
    {
     
    }

    you simply go on the line above the function declaration, and type in /** and hit enter.

    By Jani Hartikainen on Dec 1, 2008

  10. Hi, personally what I really like in NetBeans PHP code completion is how easy one can overrride methods in a class; if you extend a class, you can invoke code completion in the class’ body and you will get all the methods from all the parent classes/implemented interfaces (as well as all the magic PHP methods) – just select the method you want to override/implement and hit … very easy and very useful IMHO

    By gapon on Dec 1, 2008

  11. To my previous comment:
    “and hit …” should be ” and hit ENTER…” of course.
    (HTML tags were removed.)

    By gapon on Dec 1, 2008

  12. Another nice netbeans feature are the “code templates”. Like snippets but you can just type them in the code and also define your own templates.

    Example: Type ‘tryc’ and hit tab. This will give you a complete try/catch block. Another example: Type ‘swi’ and tab, and this will give a switch block like:

    switch ($variable) {
    case value:
    ;
    break;

    default:
    break;
    }

    This could become handy if you can remember the abbreviations.

    By thedave on Dec 1, 2008

  13. NetBeans it’s a great IDE, I used it for Java (lighter than Eclipse) and now for PHP, JavaScript support is great, jQuery autocompletation! :D :D and the SVN is faster than Subclipse, I hope just something like Eclipse RSE :’) but the nightly build version comes with SFTP support (with an Exception :P), I’m waiting for next release.

    By Juan Felipe Alvarez Saldarriaga on Dec 2, 2008

  14. The most important advantage of Netbeans 6.5 PHP over PDT is the reliable auto-completion for bigger projects. Netbeans automagically finds all the correct class-files in your path-directories.
    Let’s see how PDT 2.0 will perform. It’s due to be released at the end of this month.

    By Daniel on Dec 2, 2008

  15. I moved over from Eclipse PDT a few weeks ago and so far I’m loving Netbeans. The Subversion support is great and saves messing around with Subclipse. It seems a lot faster too, none of the annoying hangs or crashes that I occasionally had in Eclipse. Good support for HTML and CSS aswell.

    I won’t be going back to Eclipse anytime soon.

    By Tom on Dec 2, 2008

  16. Tried it out and it looked like a decent IDE, but the lack of line wrapping drove me crazy. How is this so unimportant to the developers? http://www.netbeans.org/issues/show_bug.cgi?id=89894

    By Gábor Hojtsy on Dec 2, 2008

  17. I’m curious why so many people seem to want line wrapping in the IDE. I mean you usually hear that “don’t type lines longer than X chars” and that limit is usually enough to keep on a single line.

    One of the comments did explain it a bit, “I write little design scribblings and other ramblings in simple text files.”

    By Jani Hartikainen on Dec 2, 2008

  18. I liked NetBeans pretty well but it uses a lot of memory on my system — 140K+ and also a lot of CPU. Much more than any other text editor/IDE I’ve tried.

    Maybe I’ll try it again if I upgrade my system (currently Windows XP, 1GB of RAM).

    By Eugene Morgan on Dec 2, 2008

  19. The PHPDoc autocompletion is driving me nuts. Eclipse PDT isn’t that much better in this regard. Why can’t they make the description, parameter var types and return fields focusable with tab like the other code templates? I really want to stop being lazy documenting my code, but the IDEs aren’t helping me!

    The ${cursor} in NetBeans is also not focusable with tab, which is weird because it is used all over in its default code templates. I love the fact that code template shortcuts have a separate hotkey from code completion though. In Eclipse, it’s also Ctrl-Space and all functions and constructs starting with that shortcut comes up with it.

    By torv on Dec 3, 2008

  20. Christmas comes early! Thanks for the thorough review.

    By Steve Clay on Dec 3, 2008

  21. The only reason why I choose an IDE is for its debugging features. At now I’m quite happy with ZendStudio. Don’t know about NetBeans.

    By Marco on Dec 3, 2008

  22. Hi Jani, I also tried Netbeans (coming from a Zend Studio and Zend Studio for Eclipse background) and I noticed a few annoying bugs, one of them is the scope it warns about uninitialized variables. The scope seems limited to brackets, not so much the actual scoping PHP has. ( Screenshot: http://screencast.com/t/2rYUgBu0jI )

    I also think that the layout looks sluggish. It is a bit hard to explain what I miss when I compare it with, for example, Zend Studio for Eclipse. But I get the feeling I suddenly have less space on my screen…?

    The formatter of Netbeans is a real joke, it indents and that is basically all it does… I really hope they add features to the formatter as I think it’s one of the strengths of ZSE.

    Other then that I think Netbeans is a win editor, it works like a charm and once they fix some of the open bugs and if they improve the formatter I’m switching to Netbeans without a doubt !

    By Dynom on Dec 5, 2008

  23. It runs much slower than eclipse in my ubuntu 8.1 w/ athlon x2 and 2g ram. A bit better when using nimbus theme. Does anyone exp the same?

    By apit on Dec 16, 2008

  24. I’ve been developing PHP apps for over ten years and have tried every IDE there is. PHPEclipse 2.0 is slightly better than PDT 2.0 and both are superior to ZSE. Netbeans PHP however easily beats all three. Netbeans PHP and Vim (for the quick edits when you don’t want an IDE) is the best setup I can think of for a PHP dev in 2009.

    By John on Jan 2, 2009

  25. If you’re a die-hard Vim addict then the jVi plugin for NetBeans is for your. Google it, as it’s not in the main plugin repo. NetBeans + jVi === Best PHP IDE

    By Adam Jorgensen on Jan 12, 2009

  26. I probably qualify as a “die-hard Vim addict”, as it is my text editor of choice, both on *nix and windows platforms. I have been using jVi for the last couple of years and it totally changed my java development experience. Surprisingly well done in terms of replicating the core vim functionality as well as in terms of the integration with the NetBeans IDE.

    By Adrian, Toronto - Canada on Jan 24, 2009

  27. Good review Jani. I recently started using Netbeans 6.5 after constant frustrations with Zend Studio for Eclipse. NB6 is a joy to use and everything works brilliantly! I had a problem with the SVN support – renaming a folder in the Projects pane seems to corrupt the versioning (so I had to fix it with TortoiseSVN) – have you had this problem at all?

    By David on Mar 3, 2009

  28. how can I see functions and classes on a file? They dont show up automatically when opening the file

    By yacahuma on Mar 4, 2009

  29. Netbeans 6.5 is fantastic… As an amateur in web development, I’m finding it pretty nifty… With an excellent & explanatory auto-completion of code facility, its a necessity for me…

    Hope they improve a bit of code formatting, regarding indention soon…

    By Mohit on Mar 27, 2009

  30. For Ukrainian developers, short overview of Netbeans 6.5 in Ukrainian – http://www.rozrobka.com/blog/java/9.html

    By blaster on Jun 4, 2009

  31. Here’s the clincher for me :)

    I wanted an IDE so that I could have a debugger as well. I was using Dreamweaver CS3 before. It has some code assist but when it comes to managing a real PHP project, it just doesn’t have it and then, as I said, no debugger.

    I tried I think every IDE I think is available for a MAC in a MAMP Pro environment: Rules out Zend CE and I am not interested in the Zend debugger then.

    Bottom line: the Netbeans 6.7 IDE was the only one I could get working with xDebug.

    I find some minor annoyances with Netbeans like when saving a php file, why should I have to deselect the “.php” extension by default? As mentioned before by other reviews, the formatting by this editor is a bit odd to me.

    For the price (free) and the fact that it actually works makes it a winner for me.

    I am thankful for all the comments I have seen here and elsewhere that lead me to try this product.

    I just hope Larry and the folks at Oracle don’t screw this product development up. It would be a real shame!

    By jmcbade on Jul 13, 2009

  32. Nice review, thank you! I was having a real headache in choosing an PHP enabled IDE, but this article and an article published in Kevin Van Zonneveld’s blog /http://kevin.vanzonneveld.net/techblog/article/my_new_ide_netbeans/) helped me choose NetBeans. Keep up the work / jatka samaan malliin!

    By Janne on Aug 7, 2009

  33. Some reasons to use NetBeans IDE PHP

    - Easy to install even on linux, as long as you know how to elevate your permission to administrator permissions

    - Fast enough even on a slow PC (Pentium at 600MhZ, 528Mb RAM)

    - Cod (auto)completion and php function documentation inside IDE plus syntax highlight

    - Once you setup xdebug you can debug your app inside IDE; the reason I use an IDE for PHP is the ability to run step-by-step an php-app and to view variables value

    - Ability to trace, profile, reverse-engineering(for my own undocumented scripts) and case the source-code. Those who works to real php-apps, not just with few functions to cosmetize a HTML page knows why this is really important.

    - Auto-preview of php-documentor tags inside IDE

    - Help to focus in developing the app, not in syntax, when I am in a hurry.

    By LightVision on Sep 13, 2009

  1. 5 Trackback(s)

  2. Dec 5, 2008: schwobeseggl.de » Blog Archive » Netbeans 6.5
  3. Jan 12, 2009: Vim user? You’ll love NetBeans | CodeUtopia
  4. Mar 4, 2009: Java based IDE = Very bad IDEa | CodeUtopia
  5. May 17, 2009: Open Source Aid » NetBeans - The only IDE you need!
  6. Jun 2, 2009: the rasx() context » Blog Archive » “Linux administration with Flex, Adobe AIR, and PHP” and other links…

Post a Comment

You can use some HTML (a, em, strong, etc.). If you want to post code, use <pre lang="PHP">code here</pre> (you can replace PHP with the language you are posting)