I’ve read a recent rant of Steve Yegge about ‘Java bloat’ (http://steve-yegge.blogspot.com/2007/12/codes-worst-enemy.html); language wars will never end. There always be cool languages and old ones and programmers will always invent something new and what’s cool now will be old within a couple of years…

The idea is that Java is verbose so codebase grows quickly, then it becomes unmanageable and thus it’s better to use other more succinct languages. And so Java developers are doomed. 

First I thought: there are millions of Java developers – how could it happen that they are all wrong? Ok, there is a chicken and egg paradox: Language needs libraries to be usable and libraries have to be written by programmers that use the language. There are two ways to break it: create a superb language so there are enough impressed programmers to write libraries and made existing libraries available through wrappers or some clever hacks. Java was a superb language; it was C – pointers + garbage collection. Now there are so many libraries for Java so it just can’t die any time soon. ECMAScript has chosen the second path – it uses Java libraries. Plus it’s quite popular because it’s the language of web browsers. Other languages like Ruby and Python seem to be not so superb and so have no so many libraries; they have not yet grown out of this chicken and egg hole.

As Joel Spolsky noted twenty years ago it was enough to read C book from K&R to be a programmer. Now there are lots of technologies and APIs available; programmer should know much more. I can’t remember all classes and constants from JDK; even those that I used in my code vanish from my brain after a while. Eclipse API is huge too. The only way to stay productive is to be able to quickly find information you need and good IDE is an information retrieval tool! Why people use autocomplete feature? Not just because it’s faster to type code; you can quickly find a right class method or attribute. Eclipse even shows javadoc comment for the methods in autocomplete list. Another crucial feature is the type search: you can press a shortcut to bring ‘Find Type’ dialog and type part of the class name; in the list below you will see all matching classes and may open the one you need. I’ve noticed that I rarely read JDK documentation – it’s so much faster to just find the appropriate class! And of course source code navigation; put cursor on the class or method and press F3 to open it’s declaration, press Cmd+Shift+G to find all its usages. There lots of other things that allows you to discover the code and semantics behind it; people use Java because strong typing makes code discovery possible. From the dirt point of view languages with strong typing imply structured dirt like houses and bridges while languages without type system imply just piles of dirt.

Using smart features of the language won’t save you from the complexity. The only viable cure for quantity is abstraction; and this means only one thing – create and use DSLs. Now it’s really easy to spawn your own language: have a look at ANTLR, it will do all the routine job for you. There will never be a problem with your boss that insists on using Java; you may always hide your DSL in Java app as configuration files. And yes, it’s the ‘Interpreter’ design pattern; your boss likes GoF, isn’t he?