Had a long conversation this morning with a recruiter who was trying to get me interested in a contract gig. I must admit, it was enticing: the gig was local, the rates were good and the company was reliable. There was only one problem: Half of the coding was to be done in Java. Now, I have Java down on my CV, but only under the 'Secondary skills' heading. It's there purely to reflect my history, not as a selling point.  The recruiter refused to accept that. "But if you know the basics, you can pick up the rest", he persisted. I tried to make him understand that it's nothing to do with my confidence in 'picking up the rest', but more with my unwillingness to do so.  I tried to explain -in simple terms- how coding in Java makes me neither productive, nor happy. It's difficult to do this over the telephone, speaking to a non-technical person with their own agenda, so I decided to write this down as simply and concisely as possible. Next time I get 'the call' I'll just refer them to this URL. 

Here is the simplest task you can do in programming: just display a simple message on the screen. Here's how we do it in Ruby:

                                   puts "Hello World!"

and here it is in Perl:

                                   print "Hello, world\n";

and in JavaScript

                                     alert("Hello World!");

Once you grasp the simple fact that puts/print/alert/etc. prints to screen, then completing the task takes two seconds and half a code line.  OK, the newline delimiter in Perl might trip you up a bit, so I'd add another couple of seconds to comprehend that "\n" adds a new line.

Now here's the same task coded in Java:

                                    public class HelloWorld {
                                        public static void main (String[] args) {
                                           System.out.println("Hello, world!");
                                        }
                                    }


Other than the obvious observation that our code is now much more verbose, we also have to get our head round quite a few heavy concepts:

  • Classes ( public class )
  • Access Specifiers ( public main() )
  • Methods and 'special' methods ( void main() )
  • Scoping methods ( static main() )
  • Type declarations ( String[] args )
  • Arrays ( String[] )
  • Streams ( System.out )
  • Method chaining ( System.out.println )

Flip me, that's quite a lot of concepts to know just to be able to say 'Hello World'!! Not only that, but I'm also forced to save this code to a file called HelloWorld.java !   Some people will attribute this to a solid architecture or a comprehensive design. I attribute it to a triumph of form over function, ceremony over practicality, pomp over productivity. It's designed to overwhelm its users, rather than help them.  It's shouting "Look at me, I'm solid and safe, big and unbreakable".  I like languages that shout "Look at me, I can get things done quickly and easily", or "I can do stuff without imposing myself upon you".  
I like languages that get out of my way, not get in my way. I appreciate expressiveness and freedom instead of constraints and limitations.

Me, I like languages that can flex, that can expand to accommodate my programming needs. Java, in addition to its others limitations (such as inability to implicitly model data, hence the plethora of XML, property files and countless mapping frameworks), lacks meta-programming, lacks macros, lacks all these syntactic abstractions that would allow me to stretch and twist my code in all sorts of angles in order to achieve my goal. Instead, Java forces me to shoe-horn everything I do into a convoluted,  'faux' object-oriented, static and inflexible model that -to add insult to injury- also takes much longer to develop.

At the end of the day it comes down to this: life's too short to spend it fighting a programming language.  So I hope you understand now Mark, this is why I don't do Java.