r/linuxquestions • • Jun 12 '20

Resolved Why does everyone hate Java applications?

I see it generally everywhere I go as a Linux user: almost everyone has some kind of problem with Java applications. I understand Java as a development platform has some rather infuriating holes regarding its deployment methods, and the most common issue I've seen are memory leaks and just how memory hungry the applications can be by themselves.

Is it a concept of purity? Or is is just because of some other reason that seems to escape me? I use some Java applications almost daily without problems. So why the grudge?

Opinions, rather than absolute answers, are expected.

Resolved -- Technically, there have been several wonderful and informative answers here on this post. Some answer the question better than others. However, not one singular answer is fitting enough to answer this question, so I thank everyone who took the time out of their day to enlighten me about Java and its rather unfortunate history. Thanks again!

128 Upvotes

137 comments sorted by

View all comments

28

u/heaxyh Jun 12 '20 edited Jun 12 '20

From a programmer perspective: I personally ok with java. But for sure it isn’t my preferred language. Java lacks on modern features compared c#. To write applications it felt really verbosely. There are language out there, that require less code and are easier to maintaining.

11

u/VegetableMonthToGo Jun 12 '20

That was once, but later versions of Java, Scala or Kotlin have taken back the throne.

2

u/FredL2 Jun 12 '20

This. Java 13 is a vastly different language from what people generally remember (1.5-1-7).

0

u/PM_ME_YOUR_REPO Jun 12 '20

Too bad the tooling and development ecosystem still sucks.

6

u/SisRob Jun 12 '20

IntelliJ is so good that people use it for whole bunch of different languages and it's one of the most popular IDEs.

And about tooling - I think that maven is the best build management system I've ever seen.

9

u/ace0fife1thaezeishu9 Jun 12 '20 edited Jun 13 '20

Try looking at a second build system then.

  • Maven doesn't have a true task graph. It has multiple projects and a lifecycle, but you can't have dependencies across different sub-projects and lifecylce steps.

  • Maven mixes dependency descriptors with build files, so that every tool that wants to parse Maven artifact metadata needs to implement a complete Maven parser. Variables are not resolved during build, but the references go unmodified into the artifact metadata repository, so that any tool resolving dependencies has to download and evaluate an absurd chain of parent poms.

  • Maven does not implement hash caching of previous build results. Incremental builds are flaky, they fail to rebuild if they should and vice versa. This is an insane time sink. I have seen developers spending more than 50% of their work day waiting for Maven to recompile huge projects just to test several single line changes.

  • Maven does not return an error for impossible dependency resolutions, it just returns some version. A fix has been attempted with version ranges long ago, but no library uses version ranges. When specifying a version range, Maven will mix snapshots and releases and select the "highest" value. It should instead compare versions along multiple dimension, where one is the number, another is the stability.

  • Maven does not offer to programmatically create targets. If you have any tasks that are a cross product of inputs, for example architecture and optimization level, you cannot trigger a specific build, for example amd64 in debug mode, unless you manually define a target for each combination.

  • Maven reuses the local repository for dependency resolution for all projects built on the same machine. It does not check if a cached artifact is actually from a valid source for the current build. This means building one project can break the build of an unrelated different project, because a newer version of a transitive dependency shared by both projects has been downloaded.

  • Maven build files do not support source level debugging. Complex build processes are programs in their own right, sometimes you need to inspect what they do. Because Maven build files are declarative, it is basically impossible to debug the build process itself. Trying to trace the Maven implementation itself with a Java debugger is pure horror.

  • Maven does not check the signature of downloaded artifacts. Anybody who can intercept the https connection to Maven Central can hide payloads in jar files. Several untrustworhty governments have access to an ssl signature authority blindly accepted by Maven for any artifact.

  • Maven has no concept of dependency pinning. If you declare a semantic versioning dependency range like [2.5,3), once you release a new minor version of your application, you want all of those ranges to be pinned down to their current minor, so for example [2.6,2.7). If you have a particular tag, you want the range to be pinned to [2.6.1] exactly. This needs to happen across the entire dependency graph. Pinning is necessary to avoid introducing regressions in bugfix releases.

  • Maven has no concept of platform architecture. If you need a native library, you have to explicitly refer to an artifact with a particular classifier. If the native library is in a transitive dependency, you just have to divine that it would be included and manually refer to the native part. Maven needs to have a concept of multiple dependency dimensions. Building with dependencies on libfoo and amd64 means that if libfoo delcares a dependency on libbar, there must be an automatic inferred dependency to libbar-amd64, if that exists. Also forget building for the current platform only to just run stuff without building the same software for everything under the sun as well.

I can continue writing this list until sunset, but I'm starting to get bored, so I will stop here. Gradle is not perfect, but it does almost all of that correctly. Before Gradle existed, I wrote an entire build system myself, fixing most of the mistakes in that list, and it was still a net time gain over using Maven. Maven is the single worst designed build system I have ever seen.

1

u/iEliteTester Jun 12 '20

I have had to do a could of Java projects for uni and in the last one I tried using maven to make it work better. It was better but after reading this comment I think I'll just try gradle too.

1

u/PM_ME_YOUR_REPO Jun 12 '20

I had a short term gig in Java dev after years of work in the C# and Go worlds. Maven made me want to commit sudoku. Granted, it was a government contractor position, and someone higher up got it in their head that IntelliJ is a Russian honeypot, so we weren't permitted to use it. It was all Eclipse.

In any case, I have never had a worse experience as an enterprise dev than that role working with Java. They had lots of issues (git 2 hard, lel we use svn now, among others), but I cannot help but put a large amount of the blame on Java's ecosystem.

9

u/[deleted] Jun 12 '20

Not a Java dev here.

Seems like that someone higher up is just dumb. Wouldn't blame it on java's ecosystem.

1

u/d360jr Jun 12 '20

For Java? I haven’t really found a debugger as easy to pick up and use as beginner in any other languages. Eclipse Java is great.

I had a tough time finding a comparable environment for c/cpp that was just as easy to setup and run on any platform. It legit took like over four hours to get cpp boost libraries going for class in vscode just because the documentation and sucked coming from eclipse Java.

What’re you comparing it to that has such a good ecosystem?

1

u/TryingT0Wr1t3 Jun 12 '20

I think most people opinions on Eclipse are long before Oxygen or any newer versions of Eclipse. A lot of people dropped using Eclipse around the same time Android Studio switched to Intellij.

Newer versions of Eclipse are indeed good.

1

u/PM_ME_YOUR_REPO Jun 12 '20

Visual Studio beats eclipse in every way I can think of. Alternatively, taking things from a simpler angle, Go has excellent tooling.

1

u/d360jr Jun 13 '20 edited Jun 13 '20

Huh, VS looks alright if you’re on a supported platform. Go looks alright too.

I’m always going to be a bit salty that they taught us Java in class. The error messages and documentation made it so much easier to learn than other languages I’ve worked with. Take that with a grain of salt though cause I’ve been writing mostly HDLs the last year. Tools in that space are trash :/

Edit: Just realized the sub. I don’t think recommending VS to Linux app developers is the wisest choice haha. Unless you meant code but there’s no Linux support for classic.

Eclipse is basically identical for Java on every platform. Seamless between all of my machines (Linux and windows boxes, a MacBook) which is super nice. Just sync to git when I’m at home or away and everything is the same.