NetBeans vs. Vim for PHP development
NetBeans vs. Vim for PHP development
Join the DZone community and get the full member experience.Join For Free
Whatever new awaits you, begin it here. In an entirely reimagined Jira.
I am accustomed to using Vim for writing my PHP scripts and full-fledged applications. I'm not alone in this tool choice since many geeks prefer terminal tools over IDEs.
However I recently started using both Vim and NetBeans in the company I am consulting. They have NetBeans on all the development machines, and while exploring their codebase I found it very user-friendly, also due to its plugged in PHP-related functionality that can aid every developer in managing his application. In comparison with other IDES, I love it.
But actually, on my side there's not only Vim: within its environment I can take advantage of many command line tools, so it's more a comparison between Unix command line tools and NetBeans as an Integrated Development Environment. I will use Vim as an umbrella term for the use of the command line and the terminal over the IDE.
In general, command line tools can be used quickly without exiting Vim simply by prefixing the commands with the ! character (which can be used to call any external binary).
Since this is an old religion war and it can't be solved out of context, my points will be specifically related to these programs. In this comparison, I collected examples of where Vim and NetBeans differ in behavior and performance. The point of view is that of a PHP developer, since I experienced much worse results with Unix tools while programming in other languages such as Java.
Vim obviously wins here, since it opens in less than a second: for what concerns the user experience, immediately, to the point that I do not pause Vim between editing sessions but simply open and close it everytime.
In this field, NetBeans closely follow. It is written in Java, but this does not result in a heavyweight environment. Eclipse would lose badly here, both in startup time and in responsiveness.
NetBeans wins since it has automagic features for exploring the codebase of an application, available just right a checkout from the version control system. It interprets the docblocks and follow variable definitions to a certain extent; then it jumps to the definition of a class or an object at a keystroke.
Vim has no features of this kind out of the box. There are many available plugins but I haven't found a particularly impressive one in my experience.
Vim can be setup for using ctags, which is a generated list containing all the tokens that appear in the codebase. It is not very useful unless you have very specific identifiers and method names.
However NetBeans uses its CPU cycles proficiently: it has automatic completion of methods, constants and fields every time it can find out the class of an object.
Vim has also a quite useful 'complete with a word in the current file' feature, which you can usually activate natively with CTRL + N. It is usually sufficient for many autocompletion use cases, but won't save you from looking up an API like NetBeans does.
A build setup implemented as a phing target which comprehends test and static analysis reports is by far more portable than an IDE setup, being it NetBeans or Eclipse. Continuous Integration tools like Hudson work with automatic scripts, and not with IDE metadata. Moreover, unless you save the metadata in the version control system, which is a practice not everyone is comfortable with, at every checkout you will have to set up the project in NetBeans or your IDE of choice, specifying information like the test suite folder and PHPUnit's configuration files.
Ease of use
Even considering that I am an hardcore Vim fan, NetBeans wins here. In general, there is a steeper learning curve for Vim and command line tools, while IDEs are more user friendly and comes with bundled wizards which can be skipped when the curve is finally over.
There is no clear winner, but keyboard shortcuts are very important in both cases. When the hands do not left the keyboard typing speed increases much and they are not a strict bottleneck to the speed of thought anymore. NetBeans does not force to use the mouse nor its wizards, and it has many useful shortcuts that can match Vim's ones.
Third-party tools support
PHP-related tools for software development usually come with a command line interface: PHPUnit, phing, phpcs, or the official clients of git and Subversion are all command line tools. This means they are natively interfaceable with Vim (see the introduction).
NetBeans has good support for the famous tools like PHPUnit and Subversion, and can be extended via plugins. I still prefer the simplicity of command line output: even NetBeans can show the output of the command he uses when the plugin support doesn't cut it.
From this point of view NetBeans is very clever: it takes advantage of already-installed tools and it wraps them well, without reinventing the wheel each time. Eclipse and its Subversive plugin for example are veru ugly instead.
Command line tools win here, since they are chained together easily, in ways that IDE developers cannot predict. In comparison, it is usually not straightforward to extend the functionality of an IDE like NetBeans (via plugins?) for a quick'n'dirty workflow which you may execute only one or two times.
For example, today I was wondering if I left debugging calls in my code. In Vim, I could get a quick response via typing !svn diff | grep var_dump. In NetBeans I didn't know where to start, but it may be due to my little experience with it.
In conclusion, we should try both the IDE and the small, orthogonal tools approach to software development. Never make assumption over one of the two styles when you do not have at least tried both for a continuative period of some days.
Opinions expressed by DZone contributors are their own.