Wednesday, April 2, 2008

Java Complaints and Introducing the Redemption of Java: J2Free

I'm a big Java fan, so this list is by no means a declaration of war against Java. There are, however, a few things about the language that I find very annoying:

1) Strongly typed. I enjoy types, I really do. Sometimes I even love the strongly typed nature because of the kick ass things that can be done with generics and reflection. Other times, I crave the flexibility of loosely typed languages, such as javascript. I've found that loose typing can lend itself to more elegant solutions.

2) No anonymous functions. If Java treated functions as first-class objects and allowed dynamic creation of functions at runtime, I would be in heaven. Sometimes, I find scenarios where the most elegant, and quickest to implement, solution would make use of an anonymous function. Other times I really wish I could pass functions around as arguments. This would make my life more happy.

3) == vs. .equals() for equality comparison. I'm not a big fan of pointers in C and C++. I prefer array notation in Java, for example. However, C and C++ pointers make equality comparison very easy and clear. Namely, it is quite obvious when you are comparing by memory location and when you are comparing by value. In Java, it is easy for this to escape me momentarily and cause me to spend 5 minutes debugging something so simple as an equality comparison. For example, comparing int primitive data types with == compares by value. However, if you happen to be using the int wrapper class, java.lang.Integer, then equality comparisons with == default to comparison by memory location since Integer is an Object. To compare two Integers by value, you have to use the .equals() method of Integer. I would much prefer if == in Java defaulted to comparison by value, and .equals() (or something like .objectEquals()) was used for memory location comparison. I think it would be more straight forward at least when it comes to consistency with the Java primitive data types.

4) I can't ever find any hosting providers that support Java application servers. This is a pain because I end up setting up all of our servers, taking me away from tasks I find more interesting, challenging, engaging and, in general, worthwhile.

In all fairness, I still think the reasons against Java out there are highly exaggerated. The "experiments" that show Java is less agile, clunkier, and slower to develop all seem to be written by people that don't know Java. The first time you're trying any framework it's confusing as hell, simple as that. Java has some basic configuration required for any web-application. I've been doing it long enough now that I've developed my own framework-ish libraries, which allow me to skip right past all the parts of Java people complain about and jump right into the creation aspect.

On that note, I've begun development of a consolidation of my tools with the help of one of my Co-Founders at, Arjun.  We are calling the project J2Free.  It's goal: redemption of Java when compared with frameworks such as Rails & Django.  We started out by thinking up all of the things that annoy us when starting a new Java web-application.  The first step in the J2Free is a smooth process by which users can bypass the annoying crap and jump straight into development.

J2Free itself will utilize J2EE + JPA (with Hibernate as the persistence provider) + MySQL in a classic MVC architecture.  As a disclaimer, I despise JSF with it's massive xml configuration files and odd String return values from controller classes.  So, don't expect any of that here.  J2Free will feature time saving procedures such as auto-generation of an admin section and fun little tidbits such as taglibs for pagination of datasets, templating, caching, and display formatting (Date formatting, quote escaping, etc).

Additionally, J2Free will make it easy to automatically open controller (or subsets of controllers, such as read-only functions) classes via API.  Want an API? "Click. Done."  Since I am a big fan of DWR, I plan on including that same "Click. Done." ease for enabling AJAX via DWR.

Clearly, this is all very early, but we're getting started with planning so now is the best time to throw out ideas!  When complete, we plan on making J2Free available freely and we will be open sourcing the project at some point as well.  Anyway, something to look forward to!

No comments: