The Temple of Java
(January 15th, 2007)
Working in Java has been a painful exercise for me over the last few years, and for a long time I thought it was because Java was such an immature and limited language. Recently I’ve come to realize that the driving force pushing may away from it is not anything about Java itself. In truth the language is quite reasonable, and while there is a degree of pain associated with having to type so much extra stuff and work inside its limitations it’s not nearly enough to explain my growing dislike. No, it is not the language of Java that bothers me. It is the religion of Java that bothers me.
Java as a culture has become a temple of rules presided over by a clergy most of whom only understand the surface meanings of their doctrine, and every day another law is added to the holy writ. Were I still a starry-eyed youth I might, perhaps, view these rules as deep and impenetrable. I could think of them as something that I might learn and eventually understand. Unfortunately, I have long ago passed the point of blind devotion and find myself an atheist amongst the flock. I am no longer impressed by the arguments and am even less impressed by many of those who make them. I have, quite clearly, passed out of all grace and hope for redemption.
Take the new covenant of the “final.” The law has come down that no parameter shall be written nor variable declared excepting that it first be blessed with the mantle finalness, and this shall all our tools enforce, forever and ever, Amen. I understand this rule, and I reject it. It clouds meaning and prevents legitimate usage all in the name of avoiding a very rare set of sins towards which I am not naturally inclined.
Similarly, it has been said that no man may offer up the goods of his object unless it first pay the tithe of getset. “But,” said I, “this object is a mere tuple and not worthy of your inspection. Let me pass it about freely that I might benefit therefrom.” And they smote me and made me may pay also the tithes of the hash and of the equals for they feared greatly that I might collect my objects or sort them.
If you venture out beyond the shores of Java, and pass into the ocean of the Enterprise Edition the rules grow deeper and more dangerous. There is the JSF dogma of HTML avoidance and the sin of direct linked pages. The rules are too many to catalogue on this site as I fear for my bandwidth limits. And breathe not a word against the works of Gosling lest you be told of the time when the world was a great C and it was in chaos and without form. The time before the rising of the Sun when a man dare not drop his goods upon the ground for there was no collector to help you pick them up.
The pain for me as a consultant, isn’t that I have to follow the rules, or that I don’t know them. It’s that I do know them and at times I feel like a sellout for not spending time trying to convert the flock away from their dogma back to the sevenfold path of less-is-more truth. I should cast the moneychangers from the temple but instead I take my pieces of silver and leave.
It makes me want to start my own company.


January 15th, 2007 at 9:41 pm
You’re being too nice. I think it really is the Java language. Would the Dogma of Java be so strong with a better language?
FYI, the spam protection thing is clever, but it could be friendlier, too.
January 15th, 2007 at 9:56 pm
Thanks. The anti-spam is actually a soft form of leetspeak (http://en.wikipedia.org/wiki/Leet), but really I should get a standard image CAPTCHA algorithm installed at some point.
January 15th, 2007 at 11:11 pm
The Volkswagen Lisp:
http://damienkatz.net/2007/01/the_volkswagen.html
January 16th, 2007 at 2:56 am
Good rant. Start your own company. Use a reasonable language or invent your own. Trying to convince people that their religious beliefs are wrong is probably not a good use of any person’s time.
January 16th, 2007 at 3:30 am
I hear you, brother! I have similar Angst at work where we have C# rather than Java but the same sort of prattle goes on.
January 16th, 2007 at 3:48 am
Those are the best examples you could come up with? Seem like pretty petty grievances. Yeah, Java can be rigid. I appreciate it’s rigidity everytime I have to read someone else’s PHP or Perl code. Or even someone else’s crappy Java code. I wonder how much more difficult it would be to read if they weren’t using a language that shoehorned their code into well recognized idioms.
January 16th, 2007 at 4:50 am
I challenge those who attempt to indoctrinate the forced use of final for all local declarations as follows. There is a logical implication that doing so eliminates the possibility for a for/while loop, therefore, the proponent of this dogma must use recursion. Then, after attempting to use recursion, the resulting code will perform so poorly on the Sun JVM that it is not viable. If only these religious zealots were indoctrinated with Compiler Theory.
January 16th, 2007 at 5:20 am
I know exactly where you’re coming from, and I feel your pain. I have been using JSF, Cocoon, Hibernate and a few other packages for a while, and while they do some things quite well, they are more often than not hard to set up, over-engineered, require all lots of dependent jars, come with a lot of undocumented restrictions (e.g. certain combinations of logic are just not possible in Hibernate, but you’ve got no idea what they are because the docs are quite vague), they are difficult to debug with, and very hard to get the software to do something outside its rather narrow original design intentions, aka you can’t easily do things out of the box.
It seems the package developers have spent far too much time trying to make their software fit a beautiful design idea/principle and not enough time making it usable in the real world. What’s more, it is almost impossible to propose a fix as most of these packages employ many layers of abstraction. I would like to know more about your experiences because I have the feeling I’m not the only one who feels this way.
The problem now is, unfortunately, there are not many people who will pay me to write Perl, but plenty who will pay me to develop in Java.
January 16th, 2007 at 9:51 am
Well, the major design rule for Java was that you should be able to take a horde of interchangeable, incompetent programmers, and they won’t hurt themselves too badly. The entire design philosophy revolves around:
Standardization. Everyone is forced to use the same tools, the same libraries, the same style of coding, the same programming model (OO), and even the same OO methodology. The result? If a programmer leaves your team, and a new one signs up, the learning curve is smaller. In addition, programmers only need to learn one set of tools, libraries, programming model, etc., so they’re cheaper to train.
Removal of anything dangerous. Multiple inheritence? Functional programming? Real templates? Pointers? Operator overloading? Uhuh. If you use ‘em wrong, your code become unmaintainable. You can’t use them when you need them (which is a fair bit — Java programmers have just generally don’t understand them, so don’t see the point), so you need to occasionally make huge cludges around not having the expressiveness in your language you need. With powerful, but slightly unsafe tools, if you have good programmers, they won’t abuse them. If you have poor programmers, it makes sense to take them out, and give the programmers dull safety scissors to work with.
Small simple language, and There’s Only One Way To Do It. Again, less training. Easier to understand other people’s code. Less power.
Having good practices turned into commandments follows along the same lines. If you don’t tell incompetent programmers that Every Object Must Pay Tithes To The Getset, no objects will, and the code will soon be an unmaintainable mess (exponential time growth in development time). If you just make it a rule, the programmers will take a bit of extra time adding getters and setters where they’re really not necessary, but no real harm is done (programming time is multiplied by a constant factor).
When you wonder why Gosling did something, just think of the slobbering guy on the short school bus who somehow got into IT. Think what you’d do if you were designing a language for him. Then you’ll understand.
For the most part, they’re reasonable (indeed, very good) design decisions for the 90% of programmers out there working on corporate databases, stupid e-commerce web sites, and other boring applications that are too numerous and too boring to recruit the limited number of competent programmers out there for.
January 16th, 2007 at 9:59 am
Mike Cohen said:
> Yeah, Java can be rigid. I appreciate it’s rigidity everytime I have to read someone else’s
> PHP or Perl code. Or even someone else’s crappy Java code. I wonder how much more difficult
> it would be to read if they weren’t using a language that shoehorned their code into well
> recognized idioms.
I think if you have to deal with so much code from bad programmers, legibility isn’t the biggest of your problems. Thedailywtf.com often has examples of where Java’s rigidity helps not one bit. Rigidity has a clear cost, and the benefits are unreliable at best.
With regard to Perl and PHP specifically, those languages are not the best comparison points. Perl is write-once, and PHP is a language that encourages a lot of bad design patterns, not to mention its origins tilt its programmer base towards the less trained and less experienced.
Mikey K said:
> What’s more, it is almost impossible to propose a fix as most of these packages employ
> many layers of abstraction.
I think that’s necessary in order to get them to be generally useful in Java’s rigid system. They can’t use metaprogramming or dynamic typing or function pointers, so they’re forced into all sorts of ungainly contortions to come up with something useful in diverse settings. I used to be quite keen on Spring and Hibernate until I realize how much of them would just disappear if you tried to port them to a more powerful, less constrained language.
January 16th, 2007 at 10:03 am
Peter said:
> For the most part, they’re reasonable (indeed, very good) design decisions for the 90% of
> programmers out there working on corporate databases, stupid e-commerce web sites, and other
> boring applications that are too numerous and too boring to recruit the limited number of
> competent programmers out there for.
I dunno. They’re only too boring for competent programmers if you tie those competent programmers’ hands and force them to type the same things over and over again. If you give them freedom to use languages with power and to develop tools for themselves to generate all these boring sites by fiddling with just a few variables, it might be different. What’s boring isn’t the task itself but being forced to do the same thing over and over the same way every time.
January 16th, 2007 at 6:25 pm
Personally I mark everything final when I don’t intend to change it, and I prefer expressions and ternaries and chained methods to declaring locals, reserving locals for clarity or for code that would be duplicated. I write tuples with public final fields and set them once in the constructor. I prefer defining anew to re-assigning. This is all from my functional programming experience. I’m trying to cut down the number of places anything could change, because each of them introduces a dependency, and that makes it harder to be certain code does what it says. To a functional programmer, Java is a scary language. Nothing’s ever certain. Nearly anything might throw.
January 16th, 2007 at 11:36 pm
I like Java and C#’s rigidity, when I read other people’s code. But, for the people who don’t like Java here, what do you prefer? Lisp? Ruby? Python? C/C++?
January 17th, 2007 at 2:45 pm
[…] The Temple of Java […]
January 17th, 2007 at 8:07 pm
I agree in general, although ‘const’ is pretty useful in defining clear C++ interfaces, so maybe ‘final’ can be used in a similar way.
Kevin: any chance of a link to examples of the new covenant of “final”?
January 17th, 2007 at 9:00 pm
Python’s good. Ruby’s good. Both are imperfect, but they’re a sight better than Java. Lisp I have insufficient experience with.
February 7th, 2007 at 10:03 am
Yup. I left a dotcom job, partially because of Java. I argued “why should we spending 10x our time on these projects in Java. Why not just do them, and spend the rest of the money on trips to Aruba?” They replied the clients required Java. I said we should get different clients, then.
That was ten years ago. I’ve been writing in Python (and Tcl, and C, and C++, and PHP, and Java) since then. Alas, Java hasn’t removed its barnacles to speedy and enlightened development.
Nearly 100% of my objects are variation of a Hashtable or List. Why doesn’t Java have operator-level support for them? Why Integer(x) vs int x? Why array.size vs Vector().length()? Is there an sprintf() yet? Python has a operator for it!
Why do managers seem to like this damaged but functional language so much?
February 26th, 2007 at 2:54 pm
In response to Shavenwarthog:
Nope on the operator support for hashes or lists, that’s one of the safety straight jackets Sun enforces rather stringently.. except for + with strings.. they don’t want any operator overloading..
As for ints, There is now what’s called autoboxing (as of Java 5), so for vast majority of cases an object Integer and an int can be used interchangeably. The same goes for the other primitives. Although you still can’t call methods on a primitive like in ruby.. 5.each..
As for array.length and everything else .size().. you got me..
Finally, there is a sprintf like capability (as of Java 5).
So two (mostly) out of 4 in 10 years.. that’s progress I guess..
Btw if it’s not evident from my post, I’m a Java developer right now by trade and I used to be quite enamored.. and was really keen on things like Spring and the anti-EJB movement.. until I started looking at other languages and features. And I agree whole heartedly with the article.. so much engineering is put into Java projects to get around the languages short comings.. Always trying to hack dynamism into the language.. byte code twiddlers.. extensive introspection.. code generators.. Ugghh!
I think this all stems from difference in goals, between corporate/employee interests and comp sci interests.. Comp sci people have always wanted to make a single developer more and more powerful so that only a few really bright people could do anything with a computer. But many tech people entered the field to make money and managers to build their legions, and their power over those legions. So a lot of language dumbing down went on and hordes of developers were hired, and made as replaceable as possible. And the ideal of empowering the few highly skilled people got lost somewhere.. sigh
March 13th, 2007 at 2:47 pm
[…] The Temple of Java […]
May 3rd, 2007 at 8:35 pm
I must admit, I do like Java. It makes me feel safe. It makes me feel safe in a particular way: That if I write my Java code clearly and with a minimum of complexity then there is (hopefully) only one way in which Random Support Programmer X can interpret it when he comes to attempt to change it in three years time.
Unfortunately, that situation is the reality in large parts of the software industry and to ignore it is unrealistic. To ignore it is tantamount to intentionally writing unmaintainable code.
While I am sure that I and a select number of colleagues would be more productive writing in a higher-level language than Java, that is not the only consideration in software. And also, we get good at bending Java to our will. All those frameworks and tools that are out there - if you find a small set of good ones that you know how to use then they can help a great deal.
May 21st, 2007 at 12:41 pm
Hey all those computer jargon is greek and latin (or its tecno equavalant) to me.5 years back when I came across the first artist’s website I decided to have mine. The first ‘designer’ I met said Rs25000/-!!!!…..I fled. The second fellow said Rs12000/-…I stil fled but this time I was thinking…why and how did the price come down. Things were in limbo till I met good old Jojo who was running a ‘computer institute’with 5 coms and two ex-students as tutors. He gave the mantra-Learn Dreamweaver, flash and photoshop just enough to make a working website. My neibours kid was studying at Arena Multimedia, I borrowed a few books, rented jojo’s wreck of a com for Rs1,000/- and sat down with kids half my age and taught myself just that. My site geocities.com/raghusworld was hosted in 10 days. 15 others followed before I got fed up.The kid who was in arena…he is still studying.
May 30th, 2007 at 6:11 pm
[…] I commented on a blog entry here where people were Java-bashing and saying that it was inefficient and restrictive. I’ve expanded that comment into an entry here and put a bit more thought into it. It boils down to a trade-off between speed of implementation and cost of maintenance, which is a topic that is well understood in some contexts and I feel that it applies here too but is lost in the noise of language wars. […]