Runcible Blog

Sick of Java

The other day while killing time at a book store I paged through "The Python Cookbook" and felt so refreshed to read such elegant and simple code. I'm really impressed with Python. Within a couple days of learning Python, I had written a multithreaded application with configuration files, logging, and other nifty things (it was just an exercise though). It's too bad we're not using Python for anything at work.

I'm already getting tired of Java, mostly because I think it's overrated. Java seems infested with marketing dweebs with fetishes for acronyms, buzzwords, and XML files. I'm tired of using such ugly, counterintuitive interfaces (NetBeans, Eclipse, etc.) to do even rudimentary things in Java. "Java people" are in denial that the language they love is still slow and bloated after 10 years and still looks crummy on OS X.

I think that if a language basically requires you to use a big, fancy IDE to develop with it, you've got a problem. And specifying each JAR file you need to use on the command line when you run a class gets old quickly.

Here's a very unscientific comparison between Java and Python. I wanted to know how much resources Java takes when it's not doing anything. Here's the shortest bit of code I know to have Java sleep for 10 seconds:

public class JavaSleep {
    public static void main(String [] args) {
	    try {   
	    } catch (InterruptedException ex) {

pretty needlessly verbose.
Here's how to do it in Python:

from time import sleep
print "Sleeping..."

Ahhh...that's more like it!

And here are the results from top:


955 python       0.0%  0:00.14   1    12    37   816K   376K  1.44M  27.5M
956 java         0.7%  0:00.43   9   150   110  23.8M  12.4M  8.32M   235M

The JVM uses 9 threads, many megabytes of RAM, and more CPU time just to sit there sleeping. To be fair, Python isn't known for its speed or its memory footprint either.

Anyway, that wasn't much of a comparison, but my complaint still holds. It seems like Java and its IDE's encourage programmers to be lazy and unsure of themselves. Type-ahead editing is nice but very easily abused. I've seen it in action: you start typing something, hit period, wait 10 seconds for a long menu of methods to pop up, and find the right one. "Java people" will say, "It makes me more productive!", but I'd argue that if someone experienced with Java still relies on code completion for every task, there's probably something wrong with Java (and the programmer).

That's my Java vs. Python rant.