Live data from Hacker News

Is it common for Java devs to wait 30s+ for a recompile after making any change?

news.ycombinator.com

11–20 of 20 posts

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#11
In most enterprise settings yes. You can make personal projects in Java fast if you don't use any of the build systems and call javac/jar directly with shell scripts, but then again, why would you ever chose Java in the first place.

The reason for Java building being slow is that for whatever reason, the community that develops Java has been inundated with people who are more concerned with flexing their theoretical computer science knowledge than actually making the language spec adaptable. As such, the core language is extremely lacking in features.

For this reason, people built systems on top of the language, such as build systems, dependency injection systems, testing systems, and so on. But again, for someone to dedicate time to building on top of the crap that is core Java requires a certain mindset, which lends itself to extremely bloated code, or things like making a log statement have code that can fetch code from the internet and execute it.

So when you stack all of these on top of one another, thats where you get long compile times from. You have gradle build system, which is Groovy, which then gets compiled to run on the jvm, which then compiles the annotation processors which often write code to a file on a disk, which then gets included along with the rest of the code, which then gets compiled into class files and then jar files.

Also, during execution, because the common guidance is to use extremely bloated and poorly organized 3d party libraries for basic things, all of these libraries have a startup time associated with it.

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#12
Absolutely not. @exabrial nailed it. Any modern IDE used for Java development does incremental compilation so fast you can't even notice it happening. Now if you trigger a full build of your project using Maven or Gradle or something, then maybe. But that would largely be true using any compiled language.

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#13
Yes, but its not as bad as it sounds!

It's pretty common to have quick unit tests so you can cycle thru TDD without having to recompile the world and start-up/reload the application. You can get a few hours of work done with TDD without ever opening the actual application. In legacy enterprise, you're rarely doing green field work. You usually spend time reading coding and planning a safe edit. When you do change a line and have to recompile the world, its common to actively read and plan your next change while waiting.

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#14

In most enterprise settings yes. You can make personal projects in Java fast if you don't use any of the build systems and call javac/jar directly with shell scripts, but then again, why would you ever chose Java in the first place. The reason for Java building being slow is that for whatever reason, the community that develops Java has been inundated with people who are more concerned with flexing their theoretical…

Most of the phenomena you describe are kind of the result of hiring students straight after or even during their Bachelor's degree.

Most Universities on the planet teach Java as an introductory language (which makes sense to be honest) but they stop after that.

And then students know how to quicksort in 10 different ways, but not how to MVC or even how to build a web app.

Personally I think that our education system is botched there, because most of the theoretical knowledge is only important in the "paper writing" context. Once it gets into applying that knowledge into practical use, most students are lost because their professor never taught them how.

Only the self-taught students who were bored to death in University are actually the ones capable of doing so.

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#16
The last project I worked on, the build took around 20 minutes.

The project before that the build took around 8 minutes.

In both cases I felt it was more how the build was set up rather than something that was inherent to Java. (The 20 minute build was a Spring/Groovy project, the 8 minute one was a Java Swing application.)

This is where using TDD really shined. Modifying the code and running a test took seconds instead.

Sadly I was always one of the few who used this approach. Even seniors would spend days or even an entire sprint doing something that would take me less than a day.

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#17
I use spring boot and java/kotlin, but professionally and for side-projects, changes are "instant" on side-projects and greenfield projects. Legacy enterprise is another story, there the answer is "it depends".

Use an IDE like Intellij. I have coded a lot of Python, back to java/Kotlin now, and I prefer it.

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#18

I use spring boot and java/kotlin, but professionally and for side-projects, changes are "instant" on side-projects and greenfield projects. Legacy enterprise is another story, there the answer is "it depends". Use an IDE like Intellij. I have coded a lot of Python, back to java/Kotlin now, and I prefer it.

What setup do you have that it's "instant"? I put a decent amount of effort into reducing my apps startup time for local development but it's still on the order of 3-10s

Re: Is it common for Java devs to wait 30s+ for a recompile after making any change?

#19

In most enterprise settings yes. You can make personal projects in Java fast if you don't use any of the build systems and call javac/jar directly with shell scripts, but then again, why would you ever chose Java in the first place. The reason for Java building being slow is that for whatever reason, the community that develops Java has been inundated with people who are more concerned with flexing their theoretical…

Most of the phenomena you describe are kind of the result of hiring students straight after or even during their Bachelor's degree. Most Universities on the planet teach Java as an introductory language (which makes sense to be honest) but they stop after that. And then students know how to quicksort in 10 different ways, but not how to MVC or even how to build a web app. Personally I think that our education system…

> Most Universities on the planet teach Java as an introductory language (which makes sense to be honest)

Respectfully disagree. Depending on what the introductory program wants to focus on Python, a Lisp or even C make more sense than Java.

Post reply on HN