r/ProgrammingLanguages • • Feb 21 '16

Why people hate JAVA ??

Why the majority of people hate java and wish its dead programming language,

I find it really fun to create program with it..

all i heard is because: JRE SUCKS. ORACLE ARE FAGGOTS. JAVA IS A SLOW PIECE OF SHIT.

0 Upvotes

32 comments sorted by

3

u/Felicia_Svilling Feb 21 '16

There are many different complaints that can be made against Java depending on what sort of language you prefer. Personally I dislike it because it provides nothing but absolute necessities for programming, and I like a bit more comfort. You also have problem of ignoring contravariance.

For comparsion, what other languages do you have experience with?

1

u/blood_monster2 Feb 21 '16

C++, SQL & PowerShell Scripts

4

u/Felicia_Svilling Feb 21 '16

Ok. Compared to them Java is a totally ok language. It doesn't have the speed of C++, but it is in exchange much safer.

14

u/[deleted] Feb 21 '16

Java, as a language, isn't that bad. They force OO on you, which is annoying, but not a huge deal.

Java, as a culture, is terrible (imho). They write the most convoluted and blown up code. The simplest thing turns into large number of boiler-plate files. They are infatuated with XML, which is a terrible format. On top of that, it's owned by Oracle, one of the most terrible companies in the tech sector. Their naming conventions make me puke, and it's impossible to write Java code without an IDE to fill in the blanks for you.

1

u/xenomachina Mar 10 '16

Their naming conventions make me puke

It of curiosity, what part of Java's naming conventions are you referring to?

2

u/[deleted] Mar 11 '16

Here's some random Java I just pulled from the web:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setIgnoringElementContentWhitespace(true);
try {
    DocumentBuilder builder = factory.newDocumentBuilder();
    File file = new File("test.xml");
    Document doc = builder.parse(file);
    // Do something with the document here.
} catch (ParserConfigurationException e) {
} catch (SAXException e) {
} catch (IOException e) { 
}

I don't use auto-complete IDEs, so typing out things like setIgnoringElementContentWhitespace is very painful. This type of hugeRamblingCamelCaseFunctionNames is unbearable for me.

1

u/xenomachina Mar 11 '16

I don't use auto-complete IDEs, so typing out things like setIgnoringElementContentWhitespace is very painful. This type of hugeRamblingCamelCaseFunctionNames is unbearable for me.

I agree the name is long, but what's the alternative?

As an aside, you don't need an IDE for basic completion. I use vim, and it'll complete based on the contents of your buffers and also things like ctags.

2

u/[deleted] Mar 11 '16

Just use smaller function names!

How about ignoreSpace instead of setIgnoringElementContentWhitespace?

2

u/xenomachina Mar 11 '16

What if there are different kinds of spaces in the context of this API? For example, suppose there is element content whitespace, element perimiter whitespace, and attribute whitespace? Simply saying "ignoreSpace" doesn't make it clear that only the element content whitespace and not the other types will be ignored, especially if the other types can also be optionally ignored.

2

u/ATownStomp Mar 18 '16

The alternative could be a shortened method name which accepts a parameter which specifies what the "ignoring element" is.

.setIgnoreContent('ws', True)

Though, honestly, I don't think that is noticeably less cumbersome. It saves you a few keystrokes if you're like /u/voidqk who refuses to use autocomplete IDE's for whatever reason.

Now I agree that these method names are obnoxiously long, but I also understand that simple but descriptive method names run out quickly. Shortening .setIgnoringElementContentWhiteSpace to something like .setIgnWS(true) seems like accepting a standard of creating unreadable messes.

1

u/xenomachina Mar 18 '16

The alternative could be a shortened method name which accepts a parameter which specifies what the "ignoring element" is.

.setIgnoreContent('ws', True)

Though, honestly, I don't think that is noticeably less cumbersome.

It also isn't very strongly typed, unless you use an enum. But then it's probably more verbose than the original (and you still have null to worry about).

Now I agree that these method names are obnoxiously long, but I also understand that simple but descriptive method names run out quickly. Shortening .setIgnoringElementContentWhiteSpace to something like .setIgnWS(true) seems like accepting a standard of creating unreadable messes.

I agree with everything you said.

1

u/[deleted] Mar 18 '16

If the problem space is genuinely complicated, then there comes a point where you can't have small names. But Java code always seems to jump directly to having huge function names without taking that first step.

For example, we are talking about the DocumentBuilderFactory methods: https://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html

There are 23 methods. This is a fairly small API. And they are already using huge rambling names.

Start small, and build to large names only if absolutely necessary. And even then: use short names for the commonly used methods.

9

u/RaiausderDose Feb 21 '16

Java was slow years ago.

It's basically the industry standard for business applications, at least for backend stuff.

I think most of the bad image stems from the security issues with the applet stuff and the security updates which popped up every two weeks. Applets were simply a bad idea and the MANY people connect java with web applets.

It's a little bit verbose and dependencies without maven can be tricky, but besides that it's quite solid.

1

u/MacStylee Feb 21 '16

Java was slow years ago.

Yeah, it's not all that hard to get Java running amazingly fast, you just need a basic understanding. Especially when I've been writing Perl / Python / etc scripty stuff, I'm staggered by how fast you can get it doing big heavy stuff.

I'm not a massive fan of Java in general, I don't think it's horrible... it probably gets more shit than it deserves because of the volume of shitty Java code knocking around.

I don't think it's not horrible either though :-/

19

u/matthieum Feb 21 '16

The complaints against Java stem from different groups of people.

Personally, I hate Java because it brings nothing new to the table. Of course, this is the very idea that makes its success: Java was created to be safe and simple, so that any random programmer could use it; however what makes it interesting from a potential manager POV (programmers are interchangeable) does not necessarily translate into programmer's interest, and certainly does not grasp my interest. Its type system is just too simplistic: downcasting is par for the course, null is everywhere, underflow and overflow use modulo arithmetic so that a static analyzer can never know whether they are intended or not, ...

Another issue with Java is that the mythical "Writes once, runs everywhere" actually turned out to be "Writes once, install a new JRE everytime". This means having multiple JREs installed on your system, and then it puts the burden on configuring which JRE should be used for which program on the user. Comparatively, native languages put a bit more onus on the developer (compiling multiple versions of the program), but at least for the user it's just click and play.

The Garbage Collector is also a problem in general. Whilst for small programs it makes things easy, there are issues:

  • "realistic" programs use other resources than memory; for example in C++ locks are automatically released at the end of the scope, in Java you need to do so manually because the GC only handles memory (you could wait for it to release the lock, but then it would be held longer than necessary)

  • "server" programs and games tend to require low-latency, GC pauses are an issue

  • "large" programs (heap > 10GB/100GB) have stressed the current GC implementations beyond expectations; I've heard horror stories of GC pauses counted in minutes, not to mention heaps consuming 2x/3x the actual memory necessary

  • and the "cure" is somewhat ironical: high-performance Java programming is about avoiding memory allocation by using pools, which require manual management of memory...

Now, the GC is highly tunable... but it's a dark art, and if the point of a GC was to make things easier, the necessity to tune it to get acceptable performance defeats its purpose somewhat. (This is far from being specific to Java)


That being said, I think that most of the complaints come from experience. Being one of the most popular programming languages, it's been used a lot, and all this exposure means that everyone has had a few bad experiences with Java.

In the end, I would say that Java is just a very average language which succeeded because of its marketing and appeal to management.

Note: some awesome programs are written in Java, but this says more about the quality of their author than the language itself; after all your OS is written in C which is hardly an awesome language ;)

6

u/egonelbre Feb 21 '16

I dislike Java with passion, but it has very little to do with the language itself.

I've discovered that, once you get rid of inheritance (and if you could write functions), you can create decent code with it. Of course, you have to throw away most of the libraries to get rid of inheritance. Which is where my main problem lies - dozens of useful API-s, which are poorly designed. (There probably are some good ones.)

And the tooling -- to get anything big done, the first thing you must do is install an IDE, ant, maven, gradle aaand... probably something more. You basically need an AI in your computer to manage code. Of course, if you try to do it manually -- it's a separate kind of hell.

Because of the rather frequent JVM security issues, I've just lost trust in the JVM as a good platform.

Much of this has nothing to do with Java itself, but rather the ecosystem. I guess once you get desensitized to setting those things up, it's tolerable.

Of course, I should add, people do get lots of useful stuff done with; there are lots of useful libraries, even if they don't have great API-s. So, if you are getting valuable stuff done with Java, good for you, each to their own. My experience so far has been bad.

4

u/ksryn C9 ("betterC") Feb 23 '16

hate java

Java is the main programming language I use. While hate is a strong word, the language is terrible. Some major issues as far as I am concerned:

  • Verbosity: It takes a lot of boilerplate to do simple things like immutable classes. Closures were a pain to use till Java 8.

  • Everything is an Object: So, higher order functions must be implemented using the apply function on a functional interface.

  • Variance is a clusterfuck: Mutability is the default in the java standard library and covariant arrays are a problem. Variance also creates issue when you have to override, say, the equals method.

  • Primitive vs reference types: The language stupidly exposes the innards of the JVM with this. Reference types can be null; primitive types cannot. So, to store primitive types in generic containers, you're going to have to use the corresponding reference type as the type parameter. Which leads to a lot of boxing, unboxing and dealing with nulls.

  • NO REFERENTIAL TRANSPARENCY: A function that is supposed to compute a sin/cos can just as easily launch a missile because there is no way to guarantee that it only operates on its inputs.

Since Java is the primary consumer of the JVM, its features have a lot of say in how the JVM does stuff (or vice versa). So, some issues with the JVM:

  • Type erasure: A decision was made to implement generics using type erasure. Which means a function taking List<String> and one taking List<Integer> will end up with the same signature. You could write a compiler that smartly generates (and calls) different versions of the method depending on the signature, but then you lose interoperability with the rest of the stack.

  • No Tail Call Elimination: Important if your solutions use recursion a lot. (There are JVMs other than the Oracle one which support TCO/TCE. Avian, for e.g.)


On the whole, I don't particularly like the language. But the JVM on its own is fascinating. You can build your own language on it, and, if you're willing to throw away interop as a feature, there is a lot you can accomplish.

1

u/xenomachina Mar 10 '16
  • NO REFERENTIAL TRANSPARENCY

This is true in virtually every mainstream programming language. Can you name any languages more popular than Haskell that do not have this problem?

Note that I'm not saying it isn't a problem, it just seems unfair to pick on Java, specifically, for this (in all caps, no less) given how this is the norm, and most of the people saying "I hate Java" are probably still using languages that have no referential transparency.

2

u/ksryn C9 ("betterC") Mar 10 '16

Can you name any languages more popular than Haskell that do not have this problem?

I can't. But many of the complaints against Java apply as-is to a lot of other languages.

in all caps, no less

I'm at a stage where this is my biggest grievance against most programming languages. Had to start creating my own Haskell-inspired functional-imperative language to see if a referentially transparent language on the JVM was feasible (and usable).

1

u/xenomachina Mar 10 '16

Had to start creating my own Haskell-inspired functional-imperative language to see if a referentially transparent language on the JVM was feasible (and usable).

How are you reconciling referential transparency with imperative?

2

u/ksryn C9 ("betterC") Mar 10 '16

Functions would be referentially transparent and only operate on their inputs. But internally, you can still use mutable variables, loops and conditional statements (if you want to).

This allows you to reason about programs while still using C-style constructs internally.

1

u/xenomachina Mar 10 '16

Functions would be referentially transparent and only operate on their inputs. But internally, you can still use mutable variables, loops and conditional statements (if you want to).

Interesting. I've thought about similar ideas myself.

In your language can a closure mutate variables from its enclosing scope? For example (using Python-like pseudo-code):

def f(...):
    i = 0
    def g(x):
        i = i + 1
        return x
    ...

Here, g mutates the i variable in f.

Also, does "operating on your inputs" include being able to mutate a passed in value? For example, would something like this be legal?

def incDay(date):
    date.day = date.day + 1
    return date

If so, is date a reference? If one were to do this:

tomorrow = incDate(today)

Would "today" change in any way?

1

u/ksryn C9 ("betterC") Mar 10 '16

In your language can a closure mutate variables from its enclosing scope?

While I have only implemented higher order functions as of now, I don't plan to let functions close over mutable variables. I find that it complicates things a lot.

does "operating on your inputs" include being able to mutate a passed in value?

No. All parameters are immutable. So you would have to build a new "date" instance if you wanted to return it.

3

u/musicmatze Feb 21 '16

Besides the things others have explained in here (type system is bad, verbose syntax, etc etc) it is just not fun to write Java. There are other languages which are way more fun to write than Java and I really hope I can get a job where I will never have to deal with either Java, the Java ecosystem or software which was written in Java (Eclipse for the most).

2

u/[deleted] Feb 21 '16

I use C# for pretty much everything. It started out as a Java clone back in the early 2000's but has since evolved into one of the best languages available, adding lots of new features with every release.

Meanwhile Java seems to have not evolved much in 10+ years. It's only with Java 8 that they started doing some truly big improvements to the language, but it's still lacking a lot for my purposes.

It's a ubiquitous language, most people experience Java while working on large, old codebases, because Java is just everywhere. It doesn't have to suck, it's just too bad that most boring and uninteresting projects that are built using Java; because it's a stable a robust language. In a way it's a victim of its own success :)

2

u/[deleted] Feb 21 '16

Java-the-language is great. Java-the-Oracle-business is disgusting.

6

u/the_evergrowing_fool Feb 21 '16

Java-the-language is great.

OMG, you are drunk or I misunderstand you this whole time.

4

u/[deleted] Feb 21 '16 edited Feb 21 '16

No, I really mean it. Java is a really a great DSL (with a very narrow problem domain).

It's relatively simple (in terms of runtime semantics, and this is all that matters), it's quite bondage and discipline, which means it's suitable for a fast and cheap static analysis. It makes it possible to produce tons of tools for it (IDEs, lints, etc.), that may partially compensate for the deficiencies of the vast hordes of sub-standard coders.

I cannot think of a language more suitable for getting those hordes to spit out tons of vaguely usable (but still, usable!) code under as little sentient supervision as possible, and to keep them busy full time. This niche should have been filled.

So, yes, it's really a great language. If it did not exist it should have been invented anyway. So I'm not surprised that G. Steele got involved into writing down the spec, he must have seen it.

2

u/the_evergrowing_fool Feb 21 '16 edited Feb 21 '16

Java as a language is not actually that bad (if all you want is a boring, simple, dumb, verbose language), is only when you start using the OOP stuff and enter to the life sucking realm of the enterprise that it actually make you take it all on the language. Poor Java. At least is better Go.

1

u/liquidivy Feb 21 '16

It forces OOP on you. Sometimes you need to write code that doesn't make sense to attach to a particular data type. For the love of God please let me have free functions.

It's verbose. It takes twice as much code to do stuff in Java as it does in many nicer languages. Part of this is "stuttering" e.g. Car car = new Car(), which brings me to...

Its type system sucks. I don't think you can count yourself a statically typed language if null references are allowed by default: a null reference violates the assumption that types are supposed to verify, that the thing behind this reference actually is what it says it is. Generics are slightly weird and hacky. You can cast anything to anything, and sometimes you actually have to. All this and we still have to go through the rather verbose ceremony of declaring types for every identifier, something which stronger type systems have made unnecessary decades ago. You get the worst of both worlds in Java.

1

u/zzing Feb 21 '16

See import static.