Wednesday, April 18, 2007

Netbeans 6 is AWESOME

As part of the subclipse problems I blogged about a couple of weeks ago, i started playing around with other IDEs again. In addition to the subclipse issue, i was tired of the less than robust jsp editing...neither the Web Tools or MyEclipse, in my opinion, are totally there yet. Though I've used MyEclipse for a couple of years now, i've never loved it. I just used it because it was the best i could do in Eclipse. It never came close to the great jsp editing facilities I was used to in IdeaJ. I also got tired of having to manage so many plugins. This abundance of plugins is, to me, also one of the biggest problems. I just cant get them all to play together nicely.

So..my first thought was to try Idea again. I downloaded the latest EAP version of Idea 7. While i was pleased to have a lot of the java and j2ee functionality built-in without the need for a plugin..the IDE felt S-L-O-W. If i didnt use it for a few minutes, it seemed to hibernate or something, and took a good minute or two to wake up. It also felt like the editor just couldnt keep up with my typing, and overall, it seemed like it was just plain getting in my way and slowing me down. Maybe that is due to using an EAP version, and i should have tried the latest stable release. Then again, i've read a lot of comments about how Idea 6 seemed to be a step back, esp in regards to memory and speed issues.

Next, i decided to try a Netbeans 6 again. I had tried one of the early milestones, and saw promise. 2 weeks ago, i downloaded milestone 8. After just 2 days, i found the IDE i've been looking for the last 2-3 years. Finally! In fact, i liked it so much, Eclipse/MyEclipse and IDEA have been removed from my machine. For the first time in 3 years, i have just one IDE on my machine, and i'm happy about it. No need to play around with anything else anymore.

I know IDEs all come down to a users preference. What i love, the next person might hate, and vice versa. However I would recommend anyone try the Netbeans 6 Milestone 8 edition and see what you think. I know Eclipse might have many of these features listed below, but i just think they are done better in Netbeans 6. Below are some of the reasons I love netbeans.

1) Lots of functionality outside the editor, without needed 20 freaking plugins! Built in are: svn/cvs (though you do need a svn exe on your machine), server deployment support, debugging, html and jsp editing, profiler, database explorer, load generator and many more.

2) I love the how the windows are used in netbeans, instead of the view idea in eclipse. Netbeans just feels more intuitive.

3) it detects my Ant build.xml, so i can just right click on the build.xml file and run a task..no need to open an Ant view as in eclipse.

4) the memory usage info is nice, as is the ability to run GC when i see that my memory usage is getting full. Prevents long GC pauses. I saw something similiar in eclipse, but it required a plugin.

5) the subversion support is really nice. I think the "view changes" functionality is done well. When i boot up, i run that command to see the incoming & outgoing changes..the rest of the day, i can just refresh it. I think eclipse has something similiar, but to me, its not as easy or as nice to use.

6) I like how the different windows are docked along the sides of the ide, compared to eclipse. hovering over them makes them temporarily pop out. This keeps you from having to click on a tab when you only need to glance at something. Just hover, it pops out, then move off the tab and it disappears.

7) The editor is nice and fast.

8) The Output tab keeps named tabs from commands you have run (like tomcat and ant task output). I know eclipse does this too, but again, its just better (to me) in Netbeans. In netbeans, if i run the tomcat reload task in my build.xml, the output is captured in its own window (again, eclipse does this). However, it also has a Rerun button. So for future tomcat reloads, instead of finding my build.xml, i just tell the output window to rerun the command. I do the same for running the app deploy task. I know its just a little thing, but these little things add up.

9) Overall, the UI design feels much nicer, and more intuitive.

10) It feels like an honest-to-goodness IDE, not a tool framework.

There are many more small things make me love netbeans 6..the above are just a few of them. I feel like I have a complete java development tool now, and I dont have to spend my time managing and debugging plugins anymore. When it comes right down to it, I am flat out more productive using Netbeans 6..which is really the highest compliment i can pay.

Note that if you do try out the netbeans 6 milestone 8 build...you will have the occassional error. I dismiss the dialog and continue working. It usually only happens 1-2 times a day..after all, its not a final release yet. It is also missing a large percentage of the refactoring in Eclipse, but this wasnt enough in my mind to outweight all the other advantages netbeans has.

Thursday, April 12, 2007

The ridiculous java bashing needs to stop

I've been blogging for several months now, guess its time for my first rant post.

After reading this article by Bruce Tate, I decided I couldnt keep quiet anymore. I dont have a problem with the article overall, I just want to speak out on a couple of points that I keep hearing brought up by the ruby folks. (And no, I'm not going to bash ruby or rails..every language has its place in different situations. Choose what fits, and what you enjoy coding with. Instead of speaking negatively about another language, I want to speak positively about java.)

Most of these points are made over and over again about how java is bad, too heavy, too time consuming to develop with, etc. Sure, compared to some languages SOME of this is indeed true, and its stupid to deny it. However, some points I think are flat out exaggerated.

First item: In the Tate article under the heading Simple Architectures, he mentions the several layers "typical" java applications have compared to Rails (remember, not bashing Rails..instead, responding to the java statement he made). Our website codebase was started from Appfuse (thanks Matt!) and consists of WebWork (struts 2 upgrade on hold), iBatis, and Spring. Our app has 4 basic layers which i think are common for the current ideas of java development: Model, data access layer, action layer, and the view. In fact, if you use Annotations and JPA, your model and data access layer can be combined, similiar to Active Record. Then you have the same 3 simple layers Rails has. However, even if you have the 4th layer, for us its iBatis, how much extra work is it really? At least for us, very little. Taking the extra 5-10 minutes to add some SQL to an xml file isnt exactly pushing our development schedule out by 6 months. Its not ActiveRecord simple, but its hardly a yoke around my neck. Java development can be clean and simple like Rails, if you have the luxury of using JPA, Java 5, and one of the newer generation web frameworks like Struts 2 or Stripes. At the pure framework level, I really dont see the huge, massive penalty imposed by java frameworks (though if you are on a 3+ year old architecture, than the bloated java accusations have a lot of truth).

Second item: Another negative I read about java (again, compared to Ruby) is the compile time. Seriously? If you work in small cycles like most developers probably do, does the 10 second compile time really bring your brain and development momentum to a halt? Come on...if you are making changes in small chunks (i.e. not modifying 100 files at once without testing your code), then this argument is bogus. The day that the extra 5-10 seconds it takes to run the Compile task in my build.xml file throws off my development hot streak (sarcasm) is the day i need to find a new job. Yeah, we work under deadlines, but come on, the 10 second compile time isnt really blowing out your project schedule. (I'm talking incremental building, as the way we develop, we dont compile the entire project from scratch at every compile. Who would do something like that? Change 2 files, let Ant compile those 2 files. Simple.)

Third Item: Finally, this one also gets me. The HUGE (more sarcasm) time it takes to recycle your changes on the webserver to test your changes. I can buy this argument if you are running on a heavy appserver, but we use relatively simple tomcat for development (and production). Thanks to Appfuse, my build script contains an Ant task for reloading my app in tomcat. This task is also usually 5 seconds or less. Again, are 5 seconds really that important. If so, do you also leave your cell phone open so you dont have to flip it open to answer? Do you have the remote car start on your key chain so the car can be running when you get to it..no need to waste time actually turning the key? Good grief..i can't believe all the outrage about how Java is such a beast because you have to wait to compile and reload your server to see your changes. I guess I'm just naive because I like having that 10-20 seconds (compiling and reloading in total) to think over the change i just made. Sometimes it even gives me time to realize my change isnt complete even before i test. I like using that time to mull over what i just coded.

Yeah, java can be all those things the java detractors claim. But, IT DOESN'T HAVE TO BE. If you have the luxury of starting with a clean slate (which is one thing recommend for beginning Rails development), you can choose a java architecture that is almost as light weight, and doesnt take forever to build and reload to test your changes. I won't claim that java the language is as elegant as Ruby, because it isnt (though I may get ridiculed for saying it, I LIKE the java langauge except for the getter/setter stuff and lack of closures).

Sorry about the long rant, if your reading took you this far. I've been doing java since 1998, and with the freedom to start a app from scratch 15 months ago, I realized that the achitectures we chose prevent us from experiencing most of the problems that are allegedly "typical" of java development. It may be typical of java development 2 years ago, but not anymore. Not if you can make some intelligent decisions about how design your application and its environment.

UPDATE: Just to clarify the webserver reloading point in argument #3 above. I am not talking about restarting tomcat every time. I am taking about the time it takes to run the Tomcat Reload task in my build.xml file. There is no need to stop and start the server..you can simply use a tomcat task to reload your webapp, which is much quicker..and yes, it really does take just a few seconds to do that. So, i find my build.xml in Netbeans 6, right click and say reload, and 5-10 second later, my changes are ready to be tested.

Thursday, April 05, 2007

Do subversion and eclipse work together for anyone?

I've run into several problems with subversion that last few months, but 2 rather big ones have happened this week that have just about put me over the edge.

I've mostly been using the eclipse 3.3 milestone builds the past couple of months, but i have had subversion issues occassionally throughout the project. I use the subclipse plugin for subversion functionality within eclipse.

The problems I am running into can be summed up by saying subclipse doesnt always commit the changes to the right branch.

For some background, instead of using branches, i use tags. Philosphically that might not be the correct way to do things, but from reading my subversion book, technically there shouldnt be any problems, as a branch and a tag are really the same thing (right?).

So, for each phase of development, we create a new tag from the current trunk, everyone switches to that tag so that all new changes are committed to the current tag. After release, changes are merged into the trunk, then a new tag is created. We switch to that tag, and the cycle continues.

My teammate checkes out each tag into its own new directory on his machine, which also means setting up the project each time in eclipse. That definitely is the cleanest way to approach this problem. However, I'm a bit lazy and dont want to be constantly setting up new projects for eclipse every time we create a new tag. So, instead, i use the subclipse feature: switch to new branch/version. Instead of having multiple directories for different branches, i use the 'switch' command and let subclipse handle updating files, downloading new files, deleting files not in the new tag, etc. I am guessing this is where my problems are coming from. This just flat out doesnt work reliably.

it seems that reusing the same directory and letting subclipse handle the switching isnt the way to go. Because i had been having some issues with using just one directory, for our latest tag, I actually did check out the new tag, say its name is 3.0, to a brand spanking new directory. So, now i have the trunk AND the 3.0 tag in separate directories. Things would be fine you would think. I work in the 3.0 tag directory ONLY for 3 weeks. Out of the blue, i check in a file, subclipse shows that I am checking it into the 3.0 tag (subclipse shows the repository path in the dialog box), but my teammate doesnt see the file. I double check, do a history on the file in my 3.0 directory, see a revision number, so i assume all is well. Teammate still doesnt see the file. he digs around and finds the file has been committed to an old tag..2.8.5. I do not have 2.8.5 ANYWHERE on my machine. No idea why subclipse committed the file to an old tag. Especially considering the 2.0 tag is in a clean directory that did not exist prior to checking it out from subversion.

Things get even better the 2 days later. We tried to roll our Struts 2 version of the app (from the webwork migration) to production and ran into a major problem that seems to be struts related. We tried rolling back to tag 2.8.5. Rollback failed. The 8 webwork jars i removed from the 3.0 tag, somehow also got removed from the 2.8.5 tag! Unbelievable! That deletion was committed 3 weeks ago! With no 2.8.5 code ANYWHERE on my machine, where the heck does subclipse get this old setting. And how does the deletion remove the file from 2 separate tags???

I'm sure lots of other folks work on multiple tags/branches at once..how do you do it? Is it something I'm doing wrong? I cant imagine what..i've been pretty careful, due to other random minor subversion issues.