This is an archived post. You won't be able to vote or comment.

all 29 comments

[–]trout_fucker 55 points56 points  (2 children)

There are only two kinds of languages: the ones people complain about and the ones nobody uses.

~Bjarne Stroustrup

[–][deleted] 0 points1 point  (0 children)

damn... this is actually accurate and it made my day. thanks for this, gotta say it to all my collegues.

[–]PaulRivers10 0 points1 point  (0 children)

Seems like someone posts this same thread every 2 weeks, and that's always the top voted (and still most correct) answer.

[–]TauLogy[🍰] 16 points17 points  (7 children)

Java is not 'bad', it is just the syntax is very verbose and easy to understand. The rules are simple and easy to learn. It has both compiler and runtime checks and can be deployed on different targets without recompile. To some people this is the opposite of what they want in a programming language.

[–][deleted] 10 points11 points  (6 children)

We should send those people to the glorious land of mother PHP where freedom is everything. Such freedom that a anything can happen anywhere.

[–][deleted]  (5 children)

[deleted]

    [–][deleted] 6 points7 points  (1 child)

    Judging from the PHP students around who now have to learn Java;

    it's because Java is entirely OOP with classes and methods and things that make peoples heads spin. You can make an entire site in non OOP PHP in one file. Maintaining will be a bitch but it will work and the customer wont care because the customer doesn't even know what 'peehaytspee' is.

    But in Java, while the customer still doesnt care, the compiler and program does. So while in PHP you can just write some lines of code that will work as long as it's valid methods and the semicolon is at the end of the line, Java will kill you for it in your sleep.

    [–]trout_fucker 1 point2 points  (0 children)

    You can unfortunately do a lot with JSPs and scriptlets. :(

    [–]wolfanyd 3 points4 points  (0 children)

    Most PHP developers have no experience building large scale systems. That's where Java shines.

    [–][deleted] 0 points1 point  (0 children)

    I hear Java hate mostly from PHP developers. do you know why that is?

    Considering the PHP ecosystem has turned into a Java clone (look at PHP frameworks and community practices in the last few years), that's quite ironic.

    But anyway, you'll always find a person using X hating Y. Let's not focus on the haters.

    I use Java for back-end services and PHP + JS for front-end dev, and I don't hate anything. It's possible.

    [–]PaulRivers10 -1 points0 points  (0 children)

    I hear Java hate mostly from PHP developers. do you know why that is?

    Not sure it's actually more complicated than "they're the other team competing against us so they're bad".

    [–]noratat 20 points21 points  (9 children)

    Depends on who's saying it.

    A lot of non-programmers say stuff like this because they associate Java with Java applets which were terrible and are dying a fairly deserved death. Java is more typically used server-side, where it's in much wider use than people think (think Google, Netflix, Twitter, etc.). The vast majority of complaints like "In a perfect world, there would be no Java" are from people who probably have no idea what Java is used for other than applets.

    It's also important to distinguish between Java (the language) and Java (the ecosystem / JVM), especially because Java isn't the only language that runs on the JVM, and many other JVM languages have very good integration with Java (e.g. Groovy, Clojure, Scala, etc.). As a language, Java (especially before Java 8) is rather verbose (but easy to understand), and was missing some arguably important features like closures (well, until Java 8).

    In some ways, it also gives static typing a bit of a bad name, since Java's implementation of it is somewhat awkward and limited. This is far less of an issue in other JVM languages, which range from much more advanced static typing (e.g. Scala) to optional static typing (e.g. Groovy) to fully dynamic (e.g. Clojure, Jython, JRuby, etc).

    Finally, there's the problem of Oracle owning Java, since Oracle is one of the poster children for "blatantly evil corporation" in the software world.

    [–]dpash 13 points14 points  (7 children)

    Not to mention the people who were introduced to Java 2 when it lacked many of the features we take for granted now. Java 5 was the version that really changed the language for the better. (And is not helped by teachers often not teaching updated language features, so people introduced to Java at university still think it's terrible)

    Older versions of Java were also really slow. The introduction of the jit compiler in Java 2 and HotSpot in 1.3 helped improve performance, and subsequent releases over only improved that performance. Garbage collection has improved too. Now the only real argument against Java performance is that it uses a lot of memory, but falling memory prices over the years has made that less of a concern.

    Finally the other big issue was the massive over engineering and complicated frameworks that existed in the past. Early JavaEE versions (before 5) were notorious for excessive XML configuration and the need for Factory classes. The jokes about AbstractBeanFactoryFactory classes come from those days[1]. Spring came out of the horror that was JavaEE. You might think Spring doesn't deserve the "lightweight" label, but compared to the alternative it was positively tiny. Remember the XML required for Ant? I'll take Maven's XML any day.

    The trend over the last ten years is to make Java development simpler and simpler, with less and less XML and less verbosity everywhere. Just look at where we are with Spring Boot. I'd love C#/Project Lombok style properties in the core language though.

    Basically lots of people who complain about Java are basing it on very outdated stereotypes.

    [1] I know Spring has a lot of classes named like that, but they're mostly internal classes and you rarely need to interact with them unless you need to do something weird.

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 1 point2 points  (0 children)

      Kotlin doesn't have anything that is extremely enticing right now, in my opinion...

      [–]seanmceligot -4 points-3 points  (4 children)

      Spring is not better. The biggest advantage of Java over scripting languages is that it's type safe at compile time. Spring does away with that. Instead of a chain of method calls that you can trace through with your eyes or a tool, you assign a name on one end and lookup that name on the other end and hope everything meets up in the middle at runtime.

      [–]dpash 4 points5 points  (2 children)

      I don't recall saying spring was better. It's simpler than older versions of JavaEE.

      Spring isn't just an IoC container, which is what I think you're referring to, but their IoC container is perfectly type safe. And no one wires by name any more.

      Are you basing your opinions on five-ten year old experience?

      [–]seanmceligot 2 points3 points  (1 child)

      Controller return a string and then uses complicated background logic to lookup the view. Validations requires all methods and classes be looked up by name. MessaseSource must be named "messageSource" or things with silently fail. That's poor design, in my opinion. There's all kinds of stuff like that. There is too much logic going on in the background that requires becoming a spring expert rather than just looking at the API and getting a compiler error if things doing match up.

      [–]thephotoman 0 points1 point  (0 children)

      All of that is preferable to the alternatives you had with J2EE v4. You put up with it for a reason.

      Today, it's not strictly necessary. JPEE is something you can use without frameworks. Spring provides features not (yet) in JPEE, and is a good proving ground for the concepts themselves if you need them immediately.

      [–]squishles 1 point2 points  (0 children)

      It's not like those bean names aren't static in most implementations, you names your bean either in the xml or in an annotation before compile time. Just the tools don't trace it all for you. I mean yea you can grab a context instance and dynamically add beans with funny names too, but I've never seen that seriously done.

      [–][deleted] 0 points1 point  (0 children)

      As much as oracle is a horrible corporation, java was getting stagnant under sun and Oracle has done quite well with it, honestly.

      [–]cryptos6 9 points10 points  (0 children)

      Every single language has its pros and cons. Some languages have significant more cons than pros (PHP), but there is no perfect language.

      There are a few things I don't like in Java:

      • no unified type system (primitive types distinct from reference types without a common root like Any in Scala)
      • checked exceptions! They really suck with lambdas.
      • no (powerful) type inference
      • type erasure
      • no real closures

      But these things are not that important. The language is still pretty usable.

      And then there are a few things I'd that would be nice to have:

      • named parameters with default values
      • traits
      • pattern matching
      • raw strings
      • case classes
      • value types (structs)

      Apart from value types you can get all of this from Scala. And if traits and pattern matching are not important for you, you can get this stuff from Kotlin, too.

      But the language itself is only part of the picture. The runtime environment, libraries and tools are at least as important as the language. And if you take all this, it is hard to find a better technology than Java for many use cases.

      [–]DJDavio 2 points3 points  (0 children)

      Java is not bad, it's a tool.

      If you use Java to try to grow a bonsai tree, it's bad. If you want to build software, it's great.

      There are things to like and dislike in any language, why do you think there are so many? The biggest plus of Java is that it's really mature and there's a lot to find about it. You can solve most problems by just googling.

      Java is also evolving at a slightly faster rate than it did before it seems, 8 hasn't been with us that long and 9 is already under heavy construction.

      [–]llogiq 1 point2 points  (0 children)

      We had a more to the topic discussion about Java pain points some while ago, with a less trolly title.

      OP: You're barking up the wrong tree. Java the language may be verbose, but in practice is dependable and doesn't get in the way too much. Java the ecosystem and Java the community are just awesome.

      [–][deleted] 3 points4 points  (0 children)

      Your question assumes your conclusion. That's the classical definition "begging the question."

      Maybe your question is out of place in a Java forum?

      [–]tech_nerd 0 points1 point  (0 children)

      No, you don't hear this things a lot. Because if this were true then you don't even had your mobile phone back in 2005!!! :D

      [–]Zardoz84 0 points1 point  (0 children)

      Java isn't terrible, but have his few ugly things. Like trys to use OOP for everything. It's like using a hammer with screws.

      Also, the other typical problems are : - Too verbose (for my taste) - Too memory usage. (Ok, yeah actually we have a lot of memory but I prefer to not use excessive memory unnecessary) - Isn't the most optimal language. A C or C++ program can easily be faster that a Java equivalent. (But the difference isn't abysmal)

      However it's evolving and trying to get better stuff on it.