@DanLebrero.

software, simply

Why Java? Why Clojure?

The reasons to use Java and Clojure are the same

I learned Java at university back in 1997. It was my third year as an undergraduate and Java was at version 1.1.

I still remember the struggle to understand the classpath and the relationship between packages, files and folders. And how slow it was!

But what I remember more vividly is how it immediately clicked. It solved a lot of the headaches that I was having with C.

Maybe Java was less powerful than C but I felt an order of magnitude more productive:

  • Garbage collection: a big chunk of complexity and bugs just disappeared overnight.
  • NullPointerExceptions: they were awesome! (if you compare them with a crash, some corrupted memory and a core dump)
  • Immutable Strings: I was manipulating strings all day long; immutable strings just made my life so much easier.

All those features made my programs so much simpler, and they allowed my brain to focus on more important stuff.

But by 2008, I realized that a profound dissatisfaction was growing within me.

ORMs and the never ending object-relational impedance mismatch, long compile and deploy cycles, XML all the things (or the more modern annotate all the things), millions of if (foo != nil), Factories and FactoryFactories, inflexible types, little reuse and all the frameworks’ black magic.

And then my pet hate: creating yet another Mapper class to transform one DTO to another DTO, both of them being 95% the same.

I got to the point where:

If I still want to be a programmer I don’t want to do it this way anymore Rich Hickey — Clojure, Made Simple.

So I started to look elsewhere: Ruby, Erlang, Scala. Somebody suggested to look into Clojure and of course I ignored him (it is a LISP! A LISP!).

But then Rich Hickey’s Simple Made Easy talk really struck a chord. Simplicity is what I was looking for.

Clojure solved a lot of the headaches that I was having with Java. Clojure is more powerful than Java and I feel an order of magnitude more productive:

All those features just make my programs so much simpler, and they free my brain to focus on more important stuff.


Did you enjoy it? or share!

Tagged in : Clojure Java