Netbeans for PHP: Continues to Impress

Standard

It seems that I don’t blog much unless IDE’s are concerned; there is a good reason for this: IDEs are an integral part of my development process and when they suck, development sucks.

The story so far:

  • Boy meets ZDE 2.5
  • ZDE grows up to 5.5
  • ZDE gets replaced by new eclipse-based ZSfE/PDT
  • ZDE keeps going, until one day, Boy upgrades OSX
  • Boy hacks OSX, but ZDE is running on a donut
  • OSX update kills ZDE for good
  • Boy cries
  • Boy finds Netbeans

This is the continuation of that story. In the last installment Netbeans 6.7 was a nightly build, it had gotten it’s OSX look and feel, and it was starting to get it’s remote debugging up and running.

Now, 6.8 has been out for almost 2 months, and things are really starting to gather steam. With the death of ZDE5.5 finally a reality, and PHP 5.3 code starting to become part of my work-day, I finally jumped 100% to Netbeans.

And let me tell you, Netbeans 6.8 is nothing short of amazing. Debugging with xdebug is now almost as easy as ZDE, it works instantly on 90% of my remote machines, but I have 1 cluster for which Netbeans simply *cannot* find the local source file, making it impossible to debug.

Watches, breakpoints (though, I haven’t figured out conditional breakpoints, if they are there), callstack and local variables work as you would expect (though watches/variables sometimes refuse to populate larger vars, I think this is xdebug config related). In addition, Netbeans supports arbitrary breakpoint groupings; these can be enabled and disabled as a group — very neat.

In addition, it has path mapping to help with remote/local file correlation; so it can find the local file to show the source during debugging — this stops the problem ZDE has where two files have the same basename() and it’s unable to choose the correct one.

However, a fully functional debugger is a minimum requirement. Netbeans 6.8 also has great support for PHP 5.3 (though it has some syntax support bugs), again another minimum.

So where does Netbeans shine? The single biggest answer to that, is PHPUnit support. Netbeans lets you specify your test folder, and abstracts it out of the project, so your tests are separated visually; this is a great minor addition. In addition, Netbeans can generate unit tests (this utilizes phpunit’s built-in functionality), and has a great UI for running tests.

You can run a single unit test by simply right clicking on the test and choosing Run, or you can test a whole project by right clicking on the project and choosing Test. Doing this will bring up the Test Results pane:

As you can see, it shows the number of tests, the test suite, and it’s test status; this can then be expanded to show individual test methods.

Further to this, you can have Netbeans capture code coverage information, if you have the xdebug extension installed locally. This then manifests visually in two ways; the first, is a summary:

The second, more impressive/useful way, is visually within each file:

You will also notice that this adds a set of buttons below the code, which can be used to run the test for just the current file (based on the typical phpunit file/test naming structure, I assume) and to re-run the entire test suite.

To me, this integration is phenomenal, and is changing the way I work. This is a great example of an IDE conforming to your workflow, and proving new ways to do things; rather than fighting you and requiring you to change to it’s needs and ideals.

Other things of note, Netbeans 6.8 has Symfony project integration, and 6.9 is including Zend Framework integration, if those things appeal to you — I have yet to play with either, so can’t comment on their usefulness.

I can, without doubt, confidently say, that despite the few bugs, and some still immature minor things, Netbeans is my recommendation for an IDE.

Go grab Netbeans today.

– Davey

Fixing ZDE 5.5 in Snow Leopard

Standard

If you are still using Zend Studio 5.5, and recently upgrade to Snow Leopard, you will have spotted pretty quickly there is a pretty severe display bug when selecting text.

The reason for this, is that Snow Leopard only ships with Java 1.6 and 1.3 (wtf?)

[sh]
$ ls -al
total 47
drwxr-xr-x 12 root wheel 408 Aug 30 22:08 .
drwxr-xr-x 11 root wheel 374 Aug 29 10:27 ..
lrwxr-xr-x 1 root wheel 5 Aug 29 10:26 1.3 → 1.3.1
drwxr-xr-x 3 root wheel 102 Jul 20 19:35 1.3.1
lrwxr-xr-x 1 root wheel 10 Aug 29 10:26 1.5 → CurrentJDK
lrwxr-xr-x 1 root wheel 10 Aug 29 10:26 1.5.0 → CurrentJDK
lrwxr-xr-x 1 root wheel 5 Aug 29 10:26 1.6 → 1.6.0
drwxr-xr-x 7 root wheel 238 Aug 29 10:26 1.6.0
drwxr-xr-x 8 root wheel 272 Aug 29 10:27 A
lrwxr-xr-x 1 root wheel 1 Aug 29 10:27 Current → A
lrwxr-xr-x 1 root wheel 3 Aug 29 10:26 CurrentJDK → 1.6
[/sh]

As you can see, except for the 1.3 JDK, everything else symlinks to 1.6.0. Now, ZDE will not run with 1.3, and is broken in 1.6, so how do you fix this?

The answer, can be found here: http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard

I am replicating it here, as it looks like it’ll be a temporary problem for them and is likely to disappear.

Update (9/13/2009): See this post for details on getting the Java 1.5 binaries from Apple themselves.

It essentially comes down to this: Grab the Java 1.5 JDK from Leopard (original) and then tell OSX to use the 32bit version by default.

This is all done through the Terminal.

So, first, grab the 1.5.0 leopard tarball and unpack (if the link below stops working, contact me for a mirror):

[plain]
cd /tmp/
wget http://www.cs.washington.edu/homes/isdal/snow_leopard_workaround/java.1.5.0-leopard.tar.gz
tar -xvzf java.1.5.0-leopard.tar.gz
[/plain]

Next, move the folder to the standard JVM location on OSX (this will require your user password):

[sh]
sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard
[/sh]

Then remove the current 1.5.0 symlink and point a new one to our new 1.5.0-leopard directory.

[sh]
cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo rm 1.5.0
sudo ln -s 1.5.0-leopard 1.5.0
[/sh]

Next (and this isn’t in the original document), set permissions:

[sh]
sudo chown -R root:wheel ./1.5.0-leopard
[/sh]

Finally, open up the Java Preferences app in /Applications/Utilities, and in the Java Applications section, drag the “J2S2 5.0 32bit” version to the top.

After doing all this, restart ZDE and the selection bug is gone!

– Davey

ZDE 5.5 On OSX

Standard

Even though I am in the process of trying to replace it, Zend Studio 5.5 is still my day-to-day IDE for development. However, on OSX Leopard, it has seemed for a while, like the app was decaying — growing progressively crashier the more I used it. Literally, to the point where I could use it.

I think, however, I have solved the issue.

Simply edit /Applications/Zend/ZendStudio-5.5.1/bin/runStudio_mac.sh and make the following change:

[sh]
java -Xms16m -Xmx256m -cp ZendIDE.jar:MRJToolkitStubs.zip:sftp.jar:axis.jar:commons-discovery-0.2.jar:commons-logging-1.0.4.jar:javaxzombie.jar:jaxrpc.jar:saaj.jar:wsdl4j-1.5.1.jar:jhall.jar:../docs/help.zip com.zend.ide.desktop.Main
[/sh]

becomes:

[sh]
/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java -Xms16m -Xmx256m -cp ZendIDE.jar:MRJToolkitStubs.zip:sftp.jar:axis.jar:commons-discovery-0.2.jar:commons-logging-1.0.4.jar:javaxzombie.jar:jaxrpc.jar:saaj.jar:wsdl4j-1.5.1.jar:jhall.jar:../docs/help.zip com.zend.ide.desktop.Main
[/sh]

This just explicitly makes it use JVM 1.5, which is, after all, what it was built for.

Once I did this, it became snappy again, and seems to be far less crash-prone, hurrah!

– Davey

Detailed IDE Reviews: How do you want to do this?

Standard

So, dear readers, I’m doing the IDE reviews for all of you guys and there’s two ways I can proceed:

I can take each of the requirements and do a single post per requirement with a writeup about it in detail for each of the 4 IDEs — then I was thinking for each new IDE I try, I can hit those same points. Or I can write up specifically on a single editor at a time, covering all of the requirements and I will also then review anything else about the editor etc.

I’d like to do a single post on the cross-platform technologies in play (Java Vs XUL) and on the Eclipse and Netbeans platforms (outside of any PHP plugins), but these fall outside of the scope of the original intention of reviewing the IDEs.

There are several incarnations of Eclipse I would like to review: Zend Studio for Eclipse, Aptana and PHPEclipse, I think perhaps I need a comparison table for Eclipse solutions on their own ;)

Thoughts?

– Davey

IDE Comparison

Standard

So it seems that some people want to know my opinions on different IDEs that I have tried in my quest to find a good upgrade path from Zend Studio 5.5  — as such, I have created a new page with an overview of my requirements, and a table comparing the various IDEs I have tried.

Check out the IDE Comparison

I plan to follow up the page with in-depth posts on each requirement and how each IDE matches up. Furthermore, any new IDEs I try will get a write-up on each of the requirements. Look for these in the coming weeks and months :)

– Davey

Update: surprisingly, it took over 2hrs to get an e-mail telling me that VIM was the perfect IDE; I expected it far sooner. VIM might be the perfect IDE for some, but not for me. Though I do use it daily as a text editor on remote systems and like it for that purpose. Also, it’s great for editing xdebug human-readable traces thanks to Derick Rethans vim syntax file.