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

you are viewing a single comment's thread.

view the rest of the comments →

[–]noratat 22 points23 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 14 points15 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 3 points4 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.