Just over a year ago, I was sitting in a classroom at Sun’s virtually deserted Burlington campus, learning a new programming language from a living human in person for possibly the first time in my whole life. The class itself was a little slow; it definitely wasn’t geared towards experienced developers. But it was more effective learning than fiddling at work had been, since it successfully prevented all distractions. Now that I’ve had a year to work with the language (and have gone back and forth to programming in Perl), there’s several reasons why I’m still using Java.
- Strong typing: Perl has no type safety, and I used to think that was an asset. But when you have a dozen programmers working on hundreds of source files, type conflicts can easily get introduced and go undetected for a long time. Objects are hashes, references are scalars, and arrays are quietly scalar-ized.
- WAR files: Releasing a new version of a website is brainless with Java. See that .war file that was built by Eclipse or Maven? Copy it to your server. Done.
- JUnit, Hibernate, Spring, log4j: Perl has a lot of freely available modules. But not a single one of them is as useful as Hibernate alone. It encapsulates database objects transparently, and is remarkably flexible. We've got a lot of awkward legacy database schemas, and without Hibernate's flexibility, we'd be building database objects by hand with JDBC. Spring's dependency injection and session management, JUnit's unit testing mechanisms, log4j's logging simplicity, and Maven's build architecture mean we spend less time planning and re-planning the infrastructure of our applications and more time implementing functionality.
- Eclipse: I know that there are Perl plugins for eclipse (EPIC in particular), but they never added that much useful functionality as far as I was concerned. Having a full-featured IDE with method completion and inline error display saves me huge amounts of time.
- Everything is a reference: Java's object-oriented nature reminds me a lot of C++ (that's the OO language I have the most experience with) except for the lack of the object/pointer paradigm. The fact that everything (okay, okay, besides primitives) is a reference keeps me from having to remember all of my pointer-management skills.
I could probably come up with a dozen other reasons that I enjoy programming in Java, but those are the big ones that make my life easy.