We've been hard at work here at the Burning Door compound banging out a big ole' scalable Java web application, and it's fun to see how the platform has evolved over the years. When we first created spyonit.com, J2EE didn't even have an acronym yet, so Enterprise JavaBeans didn't even exist yet. So what did we do? What most everyone did back then: we rolled our own persistence layer, our own RMI-based distributed fault-tolerant component architecture, and all sorts of other plumbing that didn't really have anything to do with the "business logic" of the application.
Guess what? It worked. It was a big pain to have to maintain all of the infrastructure code as well as the app code, but since we had built it, it was transparent and we could go ahead and fix what needed fixing. Would I do it the same way today? No f'ing way.
In fact, when we were acquired, we embarked on an effort to refactor the application using EJBs, JMS, and all that J2EE goodness so we could deploy on top of a "real" web application server like WebLogic. Then we wouldn't have to worry about all that infrastructure code and get all sorts of magical benefits like "linear scaling" and "distributed transaction management".
I learned a few things during that effort. First, there's no real "halfway" when you start down the EJB road: it's best just to bite the bullet (to mix metaphors) and refactor things to the "EJB" way even if it doesn't really map to the system architecture as it existed before. Second, when treated as a whole, the J2EE spec really is an impressive bit of engineering design, and it's nice to be able to stand on the shoulders of people that think about that stuff all the time. Third, if something ever went wrong when you actually deployed your app, good luck trying to find which of the 29 configuration files you messed up on, assuming you haven't stumbled upon some undocumented limitation of the app server itself. It really makes for an overall slow, "unagile" development process and some miserable debugging.
Which brings us to an article I read a little while ago entitled "Simpler Java". Fully buying into EJBs is just so heavy and ponderous that there's a bit of a backlash which results in some intriguing options. There are so many amazing open source frameworks and libraries available today, you can save yourself an incredible amount of time and effort by surveying what's out there. That's what we're doing here. I just wanted to share with you what my classpath currently looks like and my thoughts on the various packages we're leveraging here at BD.
- Hibernate - This is the O/R mapping framework we're going with right now. Lots of support, good documentation, and I like the format of the mapping documents. We originally started with Apache OJB, but it was just a little too opaque for my taste. Maybe I'll take a look again when we get to some performance testing.
-
Spring - It took me a little while before I "got" it because it's really a collection of a bunch of different frameworks. I really like the "Bean Factory" part and the Hibernate integration, not so crazy about the AOP and web framework stuff. But that's fine, you can easily pick and choose which parts of the package you want to use.
-
log4j - Even though we're developing on JDK 1.4, I still prefer the capabilities offered by log4j over the native logging. Actually, now that I'm looking at my classpath, I can see it's littered with packages from Jakarta: Commons-Lang, Commons-CLI, Commons-Collections, Commons-DBCP. On the web side we're using Tomcat and Struts. God bless Jakarta!
-
JUnit - Don't even question incorporating JUnit into your app development process. It's not like I'm a big fan of XP (Extreme Programming) or anything, but being good about coding your unit tests just helps you so much throughout the lifecycle of your app.
-
JDOM - I looked at a few different XML frameworks, and I think this is the one I like best. I haven't put it through its paces with real performance testing yet, but this is just a totally rational approach to dealing with XML in Java.
So there you have it -- that's what's in my classpath right now, not even counting the libraries that Spring and Hibernate depend on. Isn't it amazing how much functionality you can get from the start if you're willing to spend the time to figure out what's really out there?