r/programming • • Sep 15 '20

Java 15 released!

https://jdk.java.net/15/
214 Upvotes

130 comments sorted by

View all comments

215

u/Ravoos Sep 15 '20 edited Sep 15 '20

Java devs: Cool.....I'm still using Java 8 tough.

Edit: Okay, I got a lot of interesting comments here when I just made a joke. Still, it is fun to read it all and to see just bow dedicated the Java guys are to their language

42

u/Bartolomev Sep 15 '20

I'm happy that in our company we moved (still moving actually) to Java 11, newer projects at least. My colleagues are still afraid of using var though, so nothing changed really.

38

u/pron98 Sep 15 '20

so nothing changed really

Except lower footprint, higher performance and better profiling with JFR, all of which can save you real money (to make even more money, use JDK 15).

7

u/[deleted] Sep 16 '20

> Except lower footprint

This was not my experience when my company migrated java 8 -> 11. We saw a number of our services increase RSS size by around 1gb. There was oddly no accounting for the increase in memory size in the heap dumps or native memory tracking, we eventually just accepted that some services would use more memory.

9

u/pron98 Sep 16 '20 edited Sep 16 '20

Do you mean that there's more heap consumed by data or that the Java process takes up more RAM from the OS? If it's the former, it is indeed strange and does require investigation (e.g. the footprint of most strings has been nearly halved in JDK 9, and this is the general trend of overall footprint we see). If the latter, it's probably a simple matter of different defaults. Remember that a Java process takes as much RAM as you tell it; if you don't, it will take up some heuristically-chosen default value that can change significantly from one release to another (I think that the default for G1, which is the default GC since 9, is to now take up 1/4 of total RAM unless you tell it otherwise).

→ More replies (2)

5

u/CoffeeTableEspresso Sep 15 '20

They'll get there, at least you're on the newer version

12

u/Certain_Abroad Sep 15 '20

My colleagues are still afraid of using var

Look on the bright side. Better than that having colleagues who just sprinkle var everywhere.

17

u/Programmdude Sep 15 '20

Var is good when you already know the type.

var x = 0; // Good
var y = new FooBar(); // Good
var z = ProcessRequest(); // Bad

Personally I use resharper (or intellij, webstorm) and so it just inserts the type anyway.

8

u/Ameisen Sep 16 '20

Already know the type, or don't care about the specific type. getObjects() obviously returns a container of Objects, you probably don't care what kind of container.

4

u/Programmdude Sep 16 '20

To an extent, assuming names are sensible. Personally I'd use var everywhere if it was just myself, but when working on a team I need to assure everybody can figure it out quickly.

8

u/Ameisen Sep 16 '20

My rules for using var/auto:

  • Really long or hard to read generic/template types

  • Where it is required (C++ lambdas for instance)

  • Where the type is obvious due to either the assigned value or the function name

  • Where the explicit type doesn't matter due to usage, but the "kind" of type is obvious (a container, for instance).

  • Where the type really, really doesn't matter, like a guaranteed intermediate between two closely-tied routines.

I get really annoyed seeing things like List<FooBar> fooBars = getFooBars();.

I tend to be fond of type inference as it also makes the code more resilient during refactoring and propogates exact types.

→ More replies (2)

7

u/eeperson Sep 16 '20

Why is the last one bad? The type should just be a mouse over away.

9

u/Atulin Sep 16 '20

"I burned my mouse years ago on a stake and exclusively use heavily modified VI running on a Raspberry clone I built with silicone dug up in my backyard"

→ More replies (2)
→ More replies (9)

4

u/vytah Sep 16 '20

My colleagues are still afraid of using var though, so nothing changed really.

I remember when C# got var, some programmers were against it as they didn't want any dynamic typing in their language.

17

u/AndreasTPC Sep 16 '20

They are idiots if that's their reasoning, because type inference is not dynamic typing by any means.

With dynamic typing the type is determined at runtime and can change during execution. In a statically typed language with type inference the type is still determined at compile time and can't change during execution, all the guarantees from the type system are still there. The only thing that changes is how readable the code is.

→ More replies (1)
→ More replies (9)

37

u/BoyRobot777 Sep 15 '20 edited Sep 15 '20

I work in a large corporation, and I have been advocating for newest Java versions. I am also running all my domain's microservices on Java 14. Will move to Java 15.

10

u/[deleted] Sep 16 '20

Honestly for my company, the migration wasn't too bad. The most painful part of migrating over from Java 8 was JavaFX

18

u/rydan Sep 15 '20

Where I work we were using Java 6 when I joined. 7 had just released 9 months earlier. Earlier the next year I went to a conference at Google about all the cool features that would be in Java 8. At the end of the year we upgrade our new stack to Java 7 but most of the company is stuck on the old stack. 6 years later they make the new stack with Java 7 mandatory company wide. We just released a new stack earlier this year that uses Java 8. We've been migrating to it all year just for our one team.

→ More replies (1)

9

u/BerniesMyDog Sep 15 '20

I mean, yeah, JDK 11 was the last long term support version. Using JDK 15 just means you will have to move off of it in like 6 months if you want security updates.

3

u/AVGunner Sep 16 '20

Thought every 3 versions were lts now? 8, 11, 14, 17?

7

u/BerniesMyDog Sep 16 '20

I think it’s one LTS version every ~2.5-3 years. Wikipedia lists the LTS versions and the next one after 11 is 17: https://en.m.wikipedia.org/wiki/Java_version_history

→ More replies (1)

3

u/OctagonClock Sep 16 '20

JDK 11 was not a "long term support version", there are no LTS versions of Java.

→ More replies (1)

6

u/gvozden_celik Sep 16 '20

I'm still maintaining a Java 7 Swing application, because it has to use a Microsoft Access database, and the JDBC driver for Access was removed from JDK in Java 8. When I first encountered I was tasked to add a new report for some new classification number and not do any work on upgrading or porting as the application would be obsolete "by the end of next year"; this was in 2016. I was kind of surprised to see that the driver was removed from JDK, especially considering how big of a selling point backwards compatibility is for Java.

5

u/Supreme654321 Sep 17 '20

I think backwards comparability is not very good for the industry. I like what google has done with angular where they might depreciated or remove one function per release and make upgrading very easy or adding tooling you can run to auto upgrade code. This was back in Angular2/4 though so idk if it has changed now.

I understand why backwards comparability is good and not disagreeing its bad in any way, just that it can really stagnate you as a whole if your language / framework is not willing to keep up with the times.

We see c++ where they keep just adding stuff. At least java is trying to clean-up some.

→ More replies (2)

4

u/taostudent2019 Sep 16 '20

And I'm out of the Java game! Wooohoooo!!!

Got in w/ Java 8 and finished my whole run w/ Java 8!

→ More replies (28)