Tuesday, August 8, 2006

Thoughts on Java Development

I've been doing some Java development lately, mostly just for fun, but from time to time for work, and I've come to a few conclusions.

First, IDEA rocks. I really tried to give Eclipse a shot, and I really want to like it, but in the end it's just too slow for me. Heck, IDEA's faster and it's still verging on too slow, to the point that I occasionally revert to vi and ant. Outside of the speed question though, IDEA definately kicks some serious ass, I just love the way it points out problems I didn't even know were there. I've definately seen some weirdness with the way it complains about some perfectly valid Java 1.5 constructs, but all in all, I think it's worth the occasional backflip to work around that in exchange for the real problems it does point out.

Second, if you have to do any sort of multithreaded programming, in any language, but especially in Java, run to your nearest technical bookstore and pick up Java Concurrency in Practice. It's a fantastic book about the ins and outs of multithreaded programming in Java, and really comes in head and shoulders above any other book on multithreading that I've ever seen. Highly recommended.

Third, someone needs to explain to me what the appeal of Maven is. I just don't get it. Ant I can figure out, it works just fine, and aside from the XML bullshit I can certainly get along with it. Maven just seems to require me to bend my project into its image of what a project should look like (thanks for those LOVELY deep/directory/trees/that/go/on/forever even above and beyond the ones you get from Java in the first place!), and in return it will attempt to download all my dependencies and then fail half way through with some sort of network error. Thanks.

Finally, and this isn't because I'm interacting with it, but I just keep seeing it when browsing through the Java section of bookstores, how do these people take themselves seriously when their community actually makes use of a term like POJO. I mean come on people, you went and invented a special name for an OBJECT! It's a freaking object oriented language, it's composed almost entirely of objects, what does it say about the culture when you had to come up with a new name to market the practice of just using the fundamental abstraction provided by your language!

Anyway, it turns out I'm actually enjoying the Java work I've been doing lately. It's a pretty decent environment to work in, all things considered. I wouldn't want to live there all the time, but it's certainly a nice enough place to visit once in a while, if you stick to the less insane bits of it...

6 comments:

  1. Funnily enough, I'm coming to much the same conclusions. Most of my work is in Perl, but I've been doing a fair amount of Java recently. I didn't disagree quite so badly with Eclipse as you did, it seems. I now have the "quick fix" key burned into my brain. :-)
    I've found that there is much to like in Java. They've clearly been paying attention to hard problems. I'm pretty impressed with Hibernate, and it's clear that they've gone a lot further than any of the ORMs in Perl.
    The trouble is that there's so much to dislike as well. I've been trying to understand the myriad of configuration files for various different projects and how to isolate them from the .war file. There seems to be lots of assumptions about "oh just stick the config file in the classpath", which is great if you're writing an app that will only run in one place ever. And then I start finding things like the rather baroque JNDI and it's limited form in tomcat. This is definitely the less pleasurable side of things.
    But overall, I'm glad that I've stuck with it a bit. It's been an overall positive experience. Although, that's with the caveat of using a good IDE. I dread to think how far back I would be without intelligent completion...

    ReplyDelete
  2. I guess I feel required to try to explain the Maven thing.
    (Note: The downloading piece tends to work better with a mirror (try the LSU one): http://maven.apache.org/guides/mini/guide-mirror-settings.html but Maven does need to handle failure better)
    To me the benefits of Maven are build inheritance (helping with don't-repeat-yourself) to share build configuration information, and convention-over-configuration, meaning that if you DO follow the standard build convention stuff (which isn't required), then you can generally integrate new build tools with almost no work. I don't feel like Ant buys you much: you pretty are writing out the exact steps of what to do to build, and repeating for everything you want to build. It's manual, painful, and error-plagued process (well, at least if the build is done by your typical junior-level programmer). Ant is procedural vs. Maven which is a higher level of abstraction (akin to object-oriented).
    Admittedly, a fair amount of the obvious-win stuff up front comes from the plugins for site-reports generation, which we're not really using with Abdera. Plus you guys doing the Ant build clearly already have a lot of the best-practices for it ingrained; for those of us who never used Ant long enough to get to that point, trust me that Maven helps me get to a non-brain-dead build a lot faster than Ant did.

    ReplyDelete
  3. Oh, and the IDE plugins. The Netbeans one isn't great, but I've heard that the IDEA one is fine, and the Eclipse one (command-line) works very well for me. Take a project out of source-control that contains only source, run "mvn idea:idea" or "mvn eclipse:eclipse" and have your IDE settings up and running. Again, this is a huge benefit on the job for me, because we have a very large number of separate projects that many people work on, and I may have to start development on at any point. Maven can help with consistency in a way that Ant doesn't. These benefits don't start to show up until things get big. For smaller projects, I can see how the overhead starts to weigh down the benefits.

    ReplyDelete
  4. Wikipedia has a good explanation of the term "POJO": http://en.wikipedia.org/wiki/Plain_Old_Java_Object
    I think it's perfectly valid, in reaction to some frameworks that force you to add all kinds of interfaces and machinery to your objects, as opposed to using...plain old Java objects.

    ReplyDelete
  5. after having dealt with the terror of EJB for a few years, POJO gives me a nice warm-n-fuzzy feeling everytime i say it.
    as for maven ... its difficult to understand what maven really brings to the table unless your project is sufficently omcomplex and you swear you'd tear out your eyeballs if you have to write those same 100 lines of Ant code all over again. that being said, if you are finding yourself building a complex app with, for example, hibernate, JSF, springframework, etc ... many of these libraries have complex interdependencies (JAR hell!). managing all that crap is cumbersome. maven lets you say "give me spring 2.0rc2, myfaces 1.1.3, and hibernate3" and it takes care of all the extra work. you can also setup your own modules and have module dependencies -- maven takes care of ensuring that they are built in the correct order.
    locally we've setup our own dain maven repo that mirrors everything we need from ibiblio -- makes the network errors on builds disappear and gives us a place to publish our builds to. and because we're geeks, and good geeks have maven mirrors! =D

    ReplyDelete
  6. Ant is a great tool. Lots of little building blocks that can be composed in any way imaginable. The problem is, more often than not, the person who constructed the Ant set up is the only one who understand how it actually works. It gets worse for more complex projects. You would be surprised at all the different ways build systems can be organzied using Ant tasks; I have yet to run into any such project that could not be more simply organized using maven.
    I have read the code of many projects and I my task becomes much easier when the projects are constructed w/ maven. I find that I am in familiar territory in that they are organized the same way. I can focus on the code and not the build system, which is where I mentally want to be.

    ReplyDelete