NetBeans is TDD unfriendly!
Posted by John Kleijn • Monday, March 29. 2010 • Category: TDDI am getting soo tired of Zend Studio for Eclipse. On large projects, or rather projects with large libs (e.g. Zend Framework and Doctrine) code suggest and "building" is just too slow. It is since about a month impossible to blame hardware imitations either.
Goliath (my workstation in a massive Lian Li case, with three monitors making for a 6144x1152px desktop) has been fitted with a Xeon W3570 and 24 GB of ECC memory:
So throwing more hardware at it is just not going to work. There is apparently something fundamentally wrong with ZSfE. One of the reasons I've stuck with it has been the PHPUnit integration. You can, of course, run your Unit Tests in a console, but the integration in Zend Studio adds value more than a pretty graphical interface: it allows quick navigation to failing tests and errors from the console window (hyperlinked, which opens the file in the editor). But the PHPUnit integration in ZSfE doesn't work with namespaced tests case classes. Actually you can hack into ZendPHPUnit.php (e.g. "plugins/com.zend.php.phpunit_7.1.1.v20091227-1310/resources/ZendPHPUnit.php"), the IDE's custom bootstrap, and the tests will at least run, but you lose the navigation to test functionality.
Aside from that, you don't buy upper segment hardware to have to wait for code hints, or for your IDE to freeze up for several minutes while it's "building". Inexcusable, sorry.
So many people have recommended NetBeans, which I did try before. I didn't recall why I rejected it the first time, but it became apparent quickly: the integration of PHPUnit is TDD unfriendly. And very restrictive. Basically NetBeans requires the de facto standard for organixing tests in PHP. You know, say I've got a "kwd\foo\bar\Meh" class in "workspace\foo", then the testcase is found in "workspace\foo\tests\kwd\foo\bar\MehTest.php". I know that works for many people, but I prefer to have the same testcase in "workspace\foo\kwd\foo\tests\bar\MehTest.php". Yes, inside the library. As far as I'm concerned, the test case is part of the library, this especially makes sense when namespacing. So how does NetBeans force its wicked ways on me? Simply by not giving me another option: I have to right-click on the class I want to test, not the test case in order to run the test!
And therein lies the larger issue, you can't as I've been doing in Zend Studio, create a test, run it and create the test case and it's contents as needed. You have to decide what class you are going to make first, then create the test case. This forces a premature decision, as well as "one test per class". It seems pretty clear that in this IDE, the test is not and can not be the centerpoint of development.
In all fairness, I haven't spent a whole lot of time with this IDE yet, so perhaps I am overlooking something. Perhaps not. And to add some positive critique as well, I do like the IDE as a whole. In particular the fact that is uses the system's binaries instead of bundled ones. With ZSfE, you have to manage separate configurations, and there are version issues. For example it is possible that the subversion version Eclipse uses is not compatible with you system's, causing issues when you want to use the command line.
Anyway, since lately I've been using PHPUnit from the console anyway, NetBeans is most likely going to be my new IDE. Bye bye Zend Studio, you screwed up royally.



ShareThis