The Artima Developer Community
Sponsored Link

Still Crazy After All These Years
Java is Object-Oriented COBOL
by Steve Holden
April 1, 2004
Summary
Why is this "new" language so annoyingly verbose? Why does it take so much code to express relatively simple ideas? Why is Java drowning in the complexity of its APIs?

Advertisement

Before I start I'd like to make it clear that this modest essay is not an attempt to get anybody to change their ways. I made my decision, and others are free to make theirs. You are free to criticize my inadequate knowledge of the language and my generally ill-informed approach. You will not be the first. The rest of the world may do as it chooses. I took up Java early, and left it early, in 1996 if I remember correctly. "I used to write in Java, but I'm all right now".

The language suffers from bloat at the API level. Last time I looked, I found a closely-printed book of over a thousand pages documenting the many and varied interfaces the programmer can use to do whatever he or she needs. I don't imagine this has been simplified or streamlined in the intervening years. In terms of learning curve, of course, this makes Java a little like Everest, and I suspect some people have climbed the Java learning curve for just the same reason as Everest.

When you get right down to it, Java seems to me to be a depressing language in which to attempt to become productive. I have no idea why ithas become as popular as it undoubtedly is, unless because of the dollars the Sun marketing communications team has spent winning "mindshare". Perhaps you really can fool all of the people all of the time.

Please note that I am simply trying to explain a personal distaste for the language, one which has been niggling at me for years now. I suppose it could be a matter of usage. I just saw this example used in the discussion of someone else's blog entry:

OldClassName newThing = new OldClassName();

So much Java is written like this. Java programmers actually seem to revel in this idiom, while for some reason its deliberate redundancy seems to jar my sensitive little soul to the point that I think if I see one more line of the form:

Thing aThing = new Thing();

I will scream. Java is so type-strict, surely the type of the result of calling the Thing() constructor can be inferred, making the type at the start of the declaration unnecessary? As if it weren't obvious enough just from the naming conventions. Perhaps the language is the way it is to allow for the possibility that one day some daring soul will write:

Thing aThing = new NotThing();

and a new metaphor will be born.

There are a number of other nits. Relative import and class path management has several of the same issues that Python is struggling with right now (see, I'm not a language bigot). While I understand the need for integer and Integer (and similarly for many other primitive types and their corresponding wrapers) for efficiency reasons, it certainly doesn't make Java easier as a first programming language which, God help us, for many recent beginners it is. Do we really have to design our languages with execution efficiency as a foremost consideration in the twenty-first century? ("Yes" is an acceptable answer to this question, by the way. Please give your reasons).

In fact, I'm beginning to suspect that the title of this piece does COBOL a disservice, because if you want to put a columnar report together then COBOL is a really easy language to do it in, with PICTURE declarations that allow you to control formatting down to the exact level you need. In Java nothing seems easy, despite the swathes of support libraries using sometimes-compatible interfaces, even though everything is possible. In the old days, everyone wrote commercial code in COBOL because it was so obviously the best tool for a wide range of tasks. Nowadays Java is the predominant langauge because ... ?

I'm not intending to be personally offensive to the many excellent Java programmers, though I do find it dperessing that Java seems to encourage mediocrity in programming. I am told that some Java "programmers" recently interviewed by a colleague couldn't write a simple for loop, which supports my suspicion that there are a lot of "cut-and-paste merchants" masquerading as programmers. Be that as it may, there are undoubtedly a lot of very intelligent people writing Java, better programmers than I will ever be. I just wish I knew why.

Talk Back!

Have an opinion? Readers have already posted 35 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Steve Holden adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Steve Holden has been using computers longer than some of you have been alive, and he still isn't tired of it. The fascination is to do with the modeling flexibility that information systems allow. Steve consults to help his clients design and build their network architectures and programmed web systems, and teaches networking, database and security classes. He is the author of "Python Web Programming" (New Riders, 2002) and chaired the PyCon DC 2003 conference.

This weblog entry is Copyright © 2004 Steve Holden. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us