Disclaimer: You are looking at a post I wrote some time ago. The information and opinions contained within may be outdated and may differ from my current views. Please proceed accordingly.

This Book Shows Exactly What's Wrong With Java

Nov 26, 2006 9:45 PM
Tags: books, java, oreilly, programming

Java Generics and Collections: almost 300 pages. Three hundred pages of over-thinking on something that Ruby and Python developers would just get done and move on.

The best part is the subtitle: "Speed Up The Java Development Process." The very phrasing precludes the most obvious solution — don't use Java.

When your language has this:

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

instead of this:

print "Hello World!"

or this:

puts "Hello World!"
,

it's fundamentally broken.

The same goes for when there are so many different kinds of Vectors, Arrays, ArrayLists and the like, that most Java programmers can't name them.

(via Projectionist)


Comments: This Book Shows Exactly What's Wrong With Java

Well, if you're only going to output to a single output stream, why sure, print or puts are just fine. System.out.println prints to the standard system output. But the stuff before the println could be ANY output stream -- a file, a string buffer, a TCP/IP socket, etc.

Java also enforces object-oriented programming. If your applications are extremely simple, that's not necessarily a priority. But it does mean that you have to declare a class to create an executable.

Collections do seem to be a hobby with some Java programmers. The built-in collections work fine, but may not be as efficient as some would like, so sometimes programmers overwrite them or make their own.

Java is a general purpose language that's used for everything from the type of stuff Python and Ruby can do to fully-featured application suites with sophisticated user interfaces and even high end games with hardware-accelerated 3D graphics. It's not meant to "just" be working as middleware for small apps on the client or server side. So while in some cases it MAY be simpler to write these sorts of apps in a different language, I think that to complain that Java is overly complex or worse, fundamentally broken exhibits a somewhat myopic view of what Java is FOR.

Posted by: Steve Meister on November 27, 2006 8:58 AM | permalink

Name one significant Java game.

Java UIs are painful.

Doing simple things in Java is unnecessarily hard.

Java's overly strict typing system is obscene.

In any case, I think we're conflating Java the language (which I criticized in the main post) and Java the libraries (which I did in this comment) with Java the platform (which I think is decent).

If someone were to use Groovy, Jython or JRuby, that would be another great answer to the book's subtitle.

Posted by: Joe Grossberg on November 27, 2006 10:43 AM | permalink

Joe: how reusable are modules of Ruby and Python code? I'm asking because I really don't know. If it is reusable, then my next point is moot, but one big advantage of Java in my mind is how it forces you to think modularly and therefore create object classes that can be reused in future programs.

Also, not that it justifies the existence of a language, but Java is a good learning language because it forces the programmer into "strict typing" (it's really not that strict; I've seen worse) and good object oriented priniciples.

Posted by: Jay on November 27, 2006 4:54 PM | permalink

Jay:

I think modules' reusability is a function of how well-written, thought-out and documented they are, less than the language used to create them. Python and Ruby modules are great, IMHO, but you knew that was coming. :)

In any case, I think Java's overly strict typing makes it a *terrible* language for learning programming.

Look at how many concepts you must understand -- or things you must accept as "magic" that will be explained later -- to do simply write your name to the screen: classes, methods, public methods, class methods, return values, arguments, modules, strings, strings as arrays, etc.

Furthermore, Java enforces the incorrect notion that OOP is The One Right Way to solve every problem.

If I were asked by someone "How can I learn to program?", I would recommend Python or Ruby.

Posted by: Joe Grossberg on November 28, 2006 9:10 AM | permalink

"Name one significant Java game."

http://www.runescape.com

My kids played it for six months solid. Regularly has 100,000 players online.

But yeah, Java is only popular because it's popular. From a purely technical point of view, there are many types of applications that would benefit from being written in a language other than Java.

Posted by: Alan Green on November 29, 2006 8:17 PM | permalink

I totally agree Java is the worst bloody programming language in the world and got all it's hype from the word 'object oriented' and 'platform independent' which is the biggest load of nonsense - in fact - OO is merely a subset of sequenced programming and not nearly as powerful. Total hype - zero phat. not to mention all the different versions u have to load to kill your pc so u can try to get a single instance running - totally pathetic - like running 10 versions of linux over windows - patches here and there - don't bring that rubbish near my live servers!!!

Posted by: TJ on January 23, 2007 9:49 AM | permalink

TJ:

I'm of the opinion that OOP-bashing is as stupid as Java fandom.

What language do you use? Perl? Ugh.

Posted by: Joe Grossberg on January 23, 2007 10:37 AM | permalink

"myopic view of what Java is FOR" I think that may be an understatement for the way these guys think. Every level headed person can appreciate that each language has it's place. Some classic languages like C++ are a lot more complex and difficult to use than Java, yet they serve their purpose and will be around for a long time to come.

"don't use Java" - if you want to climb up a mountain you need a good rope, not a string, and not a chain. I say choose the best suited technology for the task at hand, each one has it's purpose.

Posted by: P on January 26, 2007 10:33 AM | permalink

Larry Wall (creator of Perl) is quoted as saying that the designers of Perl have learned a great deal from Java which wasn't around when Perl 5 was designed. If Java is so bad, why then is Perl 6 going to be transfomed into a strongly typed OOP language similar to Java. Read Radcliff, C.(2002)Perl for the Web, ISBN-10: 0735711143

Posted by: Joe on January 26, 2007 10:46 AM | permalink

And Perl 6 is coming out when, exactly?

They've been developing it for over 6 1/2 years now, and I feel like that ship has already sailed; Perl's era is over.

It's a useful secondary tool.

Posted by: Joe Grossberg on January 26, 2007 11:58 AM | permalink

No more comments! Either someone has violated Godwin's Law, I'm tired of the discussion or, most likely, the ten-week window has closed. You can, however, contact me through email.