# Is "Java" absolute garbage, or what?

**URL:** <https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968>\
**Category:** Factual Questions\
**Created:** [August 9, 2007, 5:27am UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968 "2007-08-09T05:27:29Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Rysto](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Rysto](https://boards.straightdope.com/u/Rysto)\
**Post date:** [August 9, 2007, 9:26pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/21 "2007-08-09T21:26:30Z")

</div>

[QUOTE=Dominic Mulligan]  
I don’t think that’s the whole story at all. Java _is_ inherently slow. Using even well designed software (IntelliJ IDEA, for example) is like running in treacle.  
[/QUOTE]

Like I said, Java GUIs aren’t always responsive.

> [@Voyager](#):
>
> Any examples? The engineering software I use sure as hell hasn’t been proven.

It’ll only be in software where the consequences of failure would cost millions. Stuff for the space program, for instance. Even that doesn’t guarantee results. Formal verification can prove that your problem conforms to a formal specification, but it doesn’t prove that your specification actually specifies what you want it to do.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [August 9, 2007, 10:07pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/22 "2007-08-09T22:07:35Z")

</div>

> [@](#):
>
> Any examples? The engineering software I use sure as hell hasn’t been proven.

Depends what you mean by “proven”. A large subset of the Java language itself has been formalised in Isabelle and proven type safe, for instance (see the Archive of Formal Proof). If we’re talking individual programs, then I don’t know of any non-trivial examples.

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [August 10, 2007, 5:05am UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/23 "2007-08-10T05:05:28Z")

</div>

The market for formal verification (the ‘proof’ I referred to above) is large enough to support [special-purpose tools that verify software](http://www.prover.com/products/ppi/).

---

<div class="post-metadata">

**Author:** ![Digital\_Stimulus](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@Digital\_Stimulus](https://boards.straightdope.com/u/Digital_Stimulus)\
**Post date:** [August 10, 2007, 7:55am UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/24 "2007-08-10T07:55:09Z")

</div>

[QUOTE=ftg]  
(Creds warning: Ex-CS prof and Sun Certified Java 2 Programmer.)  
[/quote]

Disclaimer: CS doctoral candidate who mainly programs in Java. Hopefully, I can learn something here. 🙂

> [@](#):
>
> The language was released way too early. (Hence the heavy use of “deprecated” everytime you read the documentation.) There’s a lot of anti-Object Oriented Programming stuff built into the language (which is bizarre to say the least). The error-handling system is completely messed up. And on and on.

Yes, it was released too early. Most glaringly, this was indicated by the primitive types not being objects; sort of solved with autoboxing, although at a significant performance hit. Furthermore, the added complexity and odd ways of bouncing between them is terrible (and leads to some non-intuitive bugs). But what other forms of “anti-Object Oriented Programming” are you speaking of? And why do you say the error-handling system is “completely messed up”? Are you referring to the ongoing checked exception debate?

> [@](#):
>
> Hence Sun’s Java software is in constant state of flux, always trying to fix the patches to the bodges to the mistakes that should have never have been there in the first place.

Yes, I suppose the software is constantly being revised, which can cause some odd (and difficult to debug) issues. AFAIK, nothing comparable to the move from gcc 3.x to 4.x, though. Not that this is an excuse, but software is (almost always) under constant revision. Again, that doesn’t make it desirable, but it is somewhat understandable.

Beyond the primitive/object issue I brought up, what other major fixes are you speaking of?

> [@](#):
>
> Programming Java is a nightmare. Many simple things that every other modern language has cannot be done at all in Java. You twist, turn and scream trying to get it to do things in an approximately reasonable way.

There are a few things about which I have to agree with you here. For instance, (almost) anytime I’ve tried to use parts of the nio package it was such a hassle that I found a different way to approximate it (non-blocking, non-GUI IO, for example). But it’s rare that I encounter anything like that day to day. Are there specifics you had in mind?

> [@](#):
>
> A _lot_ of Java programs are a mess.

Sure, but the same can be said of anything, right (says the TA who has suffered through grading Java, C++, Scheme, etc. code)? Or is there a particular feature or characteristic of Java that you’ve found specifically lends itself to badly written code?

> [@](#):
>
> Put it all together and you have the answer to the OP’s “question.”

I’m not convinced, and the animosity directed at Java always baffles me. There are tons of good things about Java; note however, that while I do like Java, I wouldn’t claim that it’s the solution to everything – it’s certainly not the right tool for every job. But, on the other hand, the claim that it’s “absolute garbage” makes me suspect a serious error is occuring on the non-computer side of the keyboard. 😉

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [August 10, 2007, 8:28am UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/25 "2007-08-10T08:28:42Z")

</div>

> [@](#):
>
> There are a few things about which I have to agree with you here. For instance, (almost) anytime I’ve tried to use parts of the nio package it was such a hassle that I found a different way to approximate it (non-blocking, non-GUI IO, for example). But it’s rare that I encounter anything like that day to day. Are there specifics you had in mind?

Operator overloading is a big one - it was pureposefully left out lest it confuse programmers :rolleyes:. Lambda expressions are another (indispensible once you’ve used them) - although I think these may have been added, or be added soon, I know there was an approximation using anonymous classes. Objectitis is another issue. What takes one line of code in any other language takes about five in Java, due to having to instantiate about fifty objects. Completely unneccessary and it doesn’t even make sense - in what way is Math an object? The strict adherence to OO is stifling and prohibits experimentation into other programming paradigms easily (even C++ allows a limited form of functional programming through boost.lambda and the STL). Again, looking at templates/generics/parametic polymorphism - Java’s version will only work with objects, not primitives, AFAIA, making the code at the bottom of this post almost impossible to implement.

But again, Java’s a language that’s ignored pretty much all the advances made in programming language design over the past forty years, instead attempting to make a coherent language out of C++. For instance:

```auto

datatype 'a BTree = Empty | Branch of ('a BTree) 'a ('a BTree)

fun member item Empty = false
   | member item (Branch a b c) =
     if item = b then
      true
    else (member item a) orelse (member item b)

```

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [August 10, 2007, 1:10pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/26 "2007-08-10T13:10:34Z")

</div>

[QUOTE=Digital Stimulus]  
Are there specifics you had in mind?  
[/QUOTE]

[ul]  
[li] **No first-class anonymous functions.** Remedy that deficiency and Java is pretty close to being a pretty good language.[/li][li] **Algol-like type system.** Either emulate the ML family and get a type system that actively helps you or emulate the Lisp family and save the programmer from fighting his own type declarations. A proper numeric tower is essential regardless.[/li][li] **Horrible, horrible syntax.** Weapon.Handgun.pointTo(Person(Me).Head).Fire(). Lisp has better syntax, and Lisp _doesn’t have syntax_.[/li][li] **Bad object system.** Steal Javascript’s. Javascript, removed from the abusive environment of web browsers, is a fairly nice language in the ways Java is not and has a very good object system.[/li][/ul]

[Revenge of the Nerds.](http://www.paulgraham.com/icad.html) – The source of my Steele quotation above, and a good explanation of why Java is as popular as it is. It’s important, so I’ll quote it here:

> [@](#):
>
> But it’s all based on one unspoken assumption, and that assumption turns out to be false. The pointy-haired boss believes that all programming languages are pretty much equivalent. If that were true, he would be right on target. If languages are all equivalent, sure, use whatever language everyone else is using.
> 
> But all languages are not equivalent, and I think I can prove this to you without even getting into the differences between them. If you asked the pointy-haired boss in 1992 what language software should be written in, he would have answered with as little hesitation as he does today. Software should be written in C++. But if languages are all equivalent, why should the pointy-haired boss’s opinion ever change? In fact, why should the developers of Java have even bothered to create a new language?

[Execution in the Kingdom of Nouns.](http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html) A rather scathingly funny rant about Java’s object system.

---

<div class="post-metadata">

**Author:** ![SmackFu](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@SmackFu](https://boards.straightdope.com/u/SmackFu)\
**Post date:** [August 10, 2007, 1:19pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/27 "2007-08-10T13:19:09Z")

</div>

The design flaws of the language have nothing to do with the user experience.

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [August 10, 2007, 1:49pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/28 "2007-08-10T13:49:08Z")

</div>

[QUOTE=SmackFu]  
The design flaws of the language have nothing to do with the user experience.  
[/QUOTE]  
They do if the language forces programmers to use sub-optimal design to achieve the stated goals.

---

<div class="post-metadata">

**Author:** ![Rysto](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Rysto](https://boards.straightdope.com/u/Rysto)\
**Post date:** [August 10, 2007, 2:27pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/29 "2007-08-10T14:27:07Z")

</div>

So basically your complaint is that Java isn’t a functional language.

---

<div class="post-metadata">

**Author:** ![groman](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groman](https://boards.straightdope.com/u/groman)\
**Post date:** [August 10, 2007, 3:13pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/30 "2007-08-10T15:13:57Z")

</div>

[QUOTE=SmackFu]  
The design flaws of the language have nothing to do with the user experience.  
[/QUOTE]

Well they are definitely not part of the solution.

Java is absolute garbage, but it’s absolute garbage users and developers alike put up with, often without realizing it. Even on the most modern, powerful personal computers starting the simplest Java application is slow. Why? Mostly because developer’s mental benchmarks aren’t calibrated properly 🙂

I do a lot of optimizations of other people’s code for a living (among other things) and usually have very high standards for good performance. Even putting Java and Windows aside, somebody like Apple has absolutely no fucking excuse for having their computers not be able to do a boot to desktop in under three seconds.

Before I got into manual optimizations I used to wonder "Geez, what the hell is it doing. " The answer in 99% of the cases is “Something stupid in a profoundly stupid way.” I don’t know what the hell Java VM is doing when it’s loading, and frankly I’m afraid to find out. If somebody is willing to present to me why it’s impossible (or even really really hard) to launch the Java VM (without any sort of preloading, first launch) in under a second even on a meager machine, I would certainly like to know. I don’t have the desire, resources or time to fix every single piece of retarded code but unfortunately slow programs serve as reference benchmarks for other slow programs and the cycle continues.

As long as the new version has more features or “ooh shiny” factor as compared to how much slower it is, it’s considered fine. The utter unwillingness of developers to properly add those new features is a little discouraging. My 25Mhz 386 laptop with 4MB ram booted into windows 3.1 in under a minute and I could launch MS Word 6.0 and be ready for typing a document within 5-10 seconds. My 1.4 Ghz laptop with 1GB ram boots into Windows XP in a little over a minute and I can launch MS Word 2003 and be ready for typing a document within 5-10 seconds. My friend’s 2.4Ghz dual-core laptop with 2GB of ram boots into Windows Vista in a little over a minute and can launch MS Word and be ready for typing a document within 5-10 seconds. The only new feature I’m consistently using when booting and starting MS Word is supporting a larger number of display pixels (yet still at our state-of-the-art-in-1978 PPI).

There’s a meme around embedded developers is that 30ms is the longest amount of time something can take and still seem instant to the end user. Even if it’s not the exact number that seems reasonable. My PC can’t even launch a second instance of Notepad or Calculator in under 30ms – what fucking year do we live in? 30ms on a 1.4Ghz machine is 42 million cycles. Even being generous and assuming a horrid IPC of 0.1, that’s still 4.2 million CISC instructions. Even assuming Microsoft or Linux people do not know what a file system cache is, the hard drive latency does not exceed 15ms. :mad:

---

<div class="post-metadata">

**Author:** ![Rysto](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Rysto](https://boards.straightdope.com/u/Rysto)\
**Post date:** [August 10, 2007, 3:18pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/31 "2007-08-10T15:18:30Z")

</div>

> [@](#):
>
> Before I got into manual optimizations I used to wonder "Geez, what the hell is it doing. " The answer in 99% of the cases is “Something stupid in a profoundly stupid way.” I don’t know what the hell Java VM is doing when it’s loading, and frankly I’m afraid to find out. If somebody is willing to present to me why it’s impossible (or even really really hard) to launch the Java VM (without any sort of preloading, first launch) in under a second even on a meager machine, I would certainly like to know.

It has to load all of the system classes into memory. It probably goes on to compile the bytecode into machine code – and compiling isn’t an instantaneous process.

Edit: They probably could optimize this – but the primary market for Java nowadays is server side stuff. The JVM is launched once when the server boots and then just keeps running forever. Nobody doing server stuff cares about knocking a couple seconds off of startup time.

---

<div class="post-metadata">

**Author:** ![SmackFu](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@SmackFu](https://boards.straightdope.com/u/SmackFu)\
**Post date:** [August 10, 2007, 3:18pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/32 "2007-08-10T15:18:30Z")

</div>

Wow, that’s some pretty generic venting against slow modern computers. Don’t see what it has to do with Java.

---

<div class="post-metadata">

**Author:** ![groman](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@groman](https://boards.straightdope.com/u/groman)\
**Post date:** [August 10, 2007, 3:34pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/33 "2007-08-10T15:34:24Z")

</div>

[QUOTE=Rysto]  
It has to load all of the system classes into memory. It probably goes on to compile the bytecode into machine code – and compiling isn’t an instantaneous process.  
[/QUOTE]

Well I know what it’s doing literally, but that’s a disingenuous answer. Kind of akin to

Q:“How the hell did you manage to spend $250,000 in one afternoon?”  
A:“Well, I got a haircut and some ice cream.”

[QUOTE=SmackFu]  
Wow, that’s some pretty generic venting against slow modern computers. Don’t see what it has to do with Java.  
[/QUOTE]

Because even if Java was perfect, everything underneath it and on top of it is profoundly slow, so it wouldn’t be all Java’s fault, but I don’t think they’re even trying.

---

<div class="post-metadata">

**Author:** ![Digital\_Stimulus](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@Digital\_Stimulus](https://boards.straightdope.com/u/Digital_Stimulus)\
**Post date:** [August 10, 2007, 4:02pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/34 "2007-08-10T16:02:03Z")

</div>

[QUOTE=Rysto]  
So basically your complaint is that Java isn’t a functional language.  
[/QUOTE]

Yeah, that’s pretty much the vibe I’m getting. Although there is an ongoing debate about adding [closures](http://gafter.blogspot.com/2006/08/closures-for-java.html) to the language, which addresses some of that.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [August 10, 2007, 4:17pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/35 "2007-08-10T16:17:26Z")

</div>

[QUOTE=Rysto]  
So basically your complaint is that Java isn’t a functional language.  
[/QUOTE]

Yeah, we’re complaining Java’s thirty years out of date.

---

<div class="post-metadata">

**Author:** ![Digital\_Stimulus](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@Digital\_Stimulus](https://boards.straightdope.com/u/Digital_Stimulus)\
**Post date:** [August 10, 2007, 4:36pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/36 "2007-08-10T16:36:34Z")

</div>

[QUOTE=groman]  
I don’t know what the hell Java VM is doing when it’s loading, and frankly I’m afraid to find out. If somebody is willing to present to me why it’s impossible (or even really really hard) to launch the Java VM (without any sort of preloading, first launch) in under a second even on a meager machine, I would certainly like to know.  
[/QUOTE]

There is a (semi)good point here. Yes, the JVM has to load all its system classes during initialization. That’s the price of using a VM – there are costs (memory use, load time, performance) for the benefits (hardware-independent standardization, process isolation, sandboxing). A pretty classic tradeoff, IMHO.

A huge issue with startup was that each instance of Java had to load all it’s classes during initialization – no shared code among processes. But that’s been addressed since 1.5 (_see:_ [class data sharing](http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html)) at least to a large extent, work is ongoing, I believe). Doesn’t eliminate the issue, but does mitigate it. But again, if one wants to work “close to the metal” (e.g., on embedded systems), use C. And deal with the attendant issues (_cf._ [shooting yourself in the foot](http://www.cacs.louisiana.edu/~mgr/404/burks/language/shoot.htm); that always entertains me).

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [August 10, 2007, 4:42pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/37 "2007-08-10T16:42:47Z")

</div>

[QUOTE=Rysto]  
So basically your complaint is that Java isn’t a functional language.  
[/QUOTE]  
Common Lisp isn’t a functional language. Neither is Javascript. However, both of them support the functional paradigm much better than Java does at this point.

My complaint against Java is that it locks programmers into a paradigm that isn’t really very useful compared to a lot of others that have been invented over the past five decades.

---

<div class="post-metadata">

**Author:** ![Rysto](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Rysto](https://boards.straightdope.com/u/Rysto)\
**Post date:** [August 10, 2007, 5:07pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/38 "2007-08-10T17:07:09Z")

</div>

Your complaints might have a bit more weight if the vast, vast majority of commercial programs weren’t written in those “30 year out of date” languages of the C family. Especially when one considers that second place on the list would go to web scripting languages.

If functional programming is so much more efficient than imperative, why aren’t there companies out there using functional languages and kicking the ass of those out-of-date companies still writing imperative programs?

---

<div class="post-metadata">

**Author:** ![Derleth](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Derleth](https://boards.straightdope.com/u/Derleth)\
**Post date:** [August 10, 2007, 5:25pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/39 "2007-08-10T17:25:14Z")

</div>

[QUOTE=Rysto]  
Your complaints might have a bit more weight if the vast, vast majority of commercial programs weren’t written in those “30 year out of date” languages of the C family.  
[/quote]  
The vast majority of software is written in COBOL.

> [@](#):
>
> If functional programming is so much more efficient than imperative, why aren’t there companies out there using functional languages and kicking the ass of those out-of-date companies still writing imperative programs?

Google. MapReduce. Search for it online sometime using the search engine of your choosing.

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [August 10, 2007, 5:35pm UTC](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968/40 "2007-08-10T17:35:59Z")

</div>

> [@](#):
>
> Your complaints might have a bit more weight if the vast, vast majority of commercial programs weren’t written in those “30 year out of date” languages of the C family.

Don’t be so facile. There’s good reasons why the C family has come to dominate. Chief amongst them being:

C was one of the first major languages invented. There’s millions of libraries written in C. The C family dominate today because they dominated in the past. It’s a self-fulfilling prophecy.

C’s syntax is familiar to virtually every programmer on the planet. Retraining programmers familiar with C in Lisp or Haskell is going to cost money.

Functional programming languages generally need far more sophistication on the part of the programmer to master. Most functional programmers come to be acquainted with the basics of domain theory. Haskell’s foundations lie on category theory. Virtually all strong statically typed FPL’s use a variation on Hindley-Milner typing - again, a knowledge of basic type theory will help in the design of programs. Epigram requires quite sophisticated type theory to master (dependent types, and all).

The likes of Java and C# are backed by massive corporations, who are able to advertise. When was the last time you saw an advert for Prolog - an “academic” language? (Although, it’s funny, C# continues to become closer and closer to a functional language with every new update - lambda expressions, limited type inference, parametric polymorphism etc. etc.).

Although, really, what has this got to do with the glaring deficiencies in Java that I’ve pointed out and _you’ve_ still not addressed? As if pointing out that lots of software is written in Java somehow makes these false…

[Previous page](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968.md?page=1)

[Next page](https://boards.straightdope.com/t/is-java-absolute-garbage-or-what/414968.md?page=3)
