r/learnjava • u/Cuervolu • Feb 13 '24
Does Java versión matter?
Hello everyone, I have a beginner's question: does the version of Java I chose to learn matter?
A bit of context: I'm from Chile, and I've been studying computer science for a few years now. In my university, I learned Java 8, Python, and other languages, and because of that, I dismissed Java and went for Python, C#, or TypeScript. But now that I'm on vacation, I've taken another look at Java, and I must admit I really like it. Not only that, but in my country, they pay well for Java programmers, although they require a lot of experience. The downside is that I heard they use an old tech-stack here. For example, some systems use Java 8, others Java 11, and I even heard of one using Java 1.5 - I think. Anyway, I've been focusing on learning Java 17 or Java 21, and I wanted to know if that's a bad decision since, would it affect anything?
As extra context, my focus is to specialize in backend development, either in Java, Node, Go, or C#. But for now, my favorite is Java with Spring Boot, and that's why I'm somewhat confused about whether the versions would pose a problem if I just focus on learning one.
13
u/hrm Feb 13 '24
If you enjoy the modern language use one of the newer versions. Java 18 or Java 21 are good choices. Professionally you might need to code for older Java at some point but adapt to that then when the need arises.
1
u/FoxyHikka Feb 14 '24 edited Feb 14 '24
It mostly depends on your project and your teammates. Let's say you have a 5-7 years old legacy project then it's probably gonna be using Java 8. Second case, assume most of your teammates are using Java 8 then you can't just start using such things as
switch (shape) {
case Human h -> "Name: %s, age: %s and profession: %s".formatted(h.name(), h.age(), h.profession());
case Circle c -> "This is a circle";
case Shape s -> "It is just a shape";
case null -> "It is null";
default -> "It is an object";
};since new switch format is not supported in 8-th version. Even tho it can be used for easier call backs...
From other hand, you can use version 8 if the whole project is a higher version.
1
3
u/krisko11 Feb 13 '24
It’s hard for a beginner, but try to find out the difference between java versions. Java 8 includes lambda expressions and a few functional interfaces that help you do functional instead of OOP. In later versions you get a lot more goodies. Java 21 includes virtual threads which help in computation-heavy projects or concurrent/realtime stuff. For most companies learning java 11 would guarantee you’ll be busy for years to come.
5
Feb 13 '24
Java 8 is where most of the industry is stuck at. Java 9 is the last breaking version. Newer versions have better/more APIs in the JDK.
Syntax remains largely the same
1
u/nutrecht Feb 15 '24 edited Feb 15 '24
Java 8 is where most of the industry is stuck at
This really isn't the case. The vast majority of companies don't just have a single application; but loads of them. And anything that's not completely in maintenance mode will have moved to 11 or later now. Most libraries/frameworks have already dropped support for 8 so "the industry" has mostly moved on.
Of course there's legacy stuff that's more or less at the end of it's cycle and not worth upgrading that people sometimes have to work on, but the industry is in no way "stuck".
If you look at actual usage reports, for example this one, Java 8 usage is dropping fast.
1
Feb 15 '24
Someone else quoted a Jetbrains survey on this thread where 60% of respondents use Java 8 regularly
1
u/nutrecht Feb 15 '24
You're right that 8 is in use in a lot of places still. But that doesn't mean the industry is 'stuck' and also doesn't mean that 50% of applications run Java 8.
1
Feb 15 '24
Well, that’s probably just semantics of what “stuck at” means and what I meant by it.
Overall, Java 9’s breaking changes meant almost everything avoided upgrading like the plague. And eventually, as LTS versions have dried up, more and more software is upgrading. Now that Oracle is keen on fully leaving Java 8 behind (which has outlived a few later LTS releases) almost everything is either upgrading or being left behind.
Still, the overall point is versions don’t really matter that much and while a lot of the industry probably has moved on, it is still a sizeable if not major chunk of the industry that is still on Java 8.
I guess it’s the IE11 of backend haha
1
u/nutrecht Feb 15 '24
Overall, Java 9’s breaking changes meant almost everything avoided upgrading like the plague.
This wasn't what I saw at all the clients I worked for. Of course, there was some ancient WebSphere stuff that was stuck on 8, but anything somewhat modern was not hard to migrate past 8.
Of course, there are shitty companies that have mostly ancient outdated stuff they all outsource, but I don't work for these kinds of companies. It's not hard for a decently experienced developer to not have anything to do with Java 8 anymore.
Still, the overall point is versions don’t really matter that much and while a lot of the industry probably has moved on, it is still a sizeable if not major chunk of the industry that is still on Java 8.
Like I showed in the report; it's below 33% of applications currently. So while it's sizeable, it's definitely not a majority. So it's clear the industry isn't 'stuck' on 8 at all :)
-1
u/hrm Feb 13 '24
That’s just not correct. Looking at a number of different surveys. For instance jetbrains from 2023, 45% of the repondants say that they regularly use java 17. In my own experience much is still on Java 8 but they are converted to Java 18 or similar at a steady pace. Around here new services are not made using Java 8.
4
u/CleverBunnyThief Feb 13 '24
That same survey you mention also shows 50% of developers still use 8 regularly.
1
u/nutrecht Feb 15 '24
Sure, but that doesn't mean the industry is "stuck", just that some applications are not worth migrating.
There is also a big difference in how many developers "use" Java 8 versus how many applications are running on that version.
1
u/hrm Feb 13 '24
Yes, I’m not claiming Java 8 is unused. But the post made it sound like nothing past 8 was even touched at all. I mean, some places still run code from the 80s so legacy code is hard to get rid of all together.
1
u/flowingice Feb 13 '24
Java 8 was the most used version in that survey, even if you want to get pedantic, his words were "most of the industry is stuck at" which is correct, it's a version with most projects. So yes, literally most of the industry is using almost 10 years old version.
1
u/hrm Feb 14 '24
50% of something that adds up to about 160+%. Yes Java 8 is still a huge legacy, but most code newer Java as well.
2
Feb 13 '24
Perhaps new modules have modernized. But it’s a testament to Java 8 the fact that at least until very recently was supported by Oracle. Unsure about the current status so I don’t want to check but I believe it is still in extended support
Also, lots of libraries are still compiled for much older versions of Java for compatibility. I know of modern libraries that are still compiled against Java 8 or even Java 5.
1
u/an_actual_human Feb 13 '24
For instance jetbrains from 2023, 45% of the repondants say that they regularly use java 17.
I would expect people who use newer versions to be overrepresented in surveys.
2
u/glablablabla Feb 13 '24
Stick to java 21, LTS 17 only if necessary. Most companies either already have migrated or are currently migrating their stack to those versions.
2
u/plastikbenny Feb 13 '24
Yes it matters. Libraries and frameworks have been migrating to newer versions of java, for instance spring 6 requires jdk 17 as a minimum, jakartaee 10 requires jdk 11. Typically organisations use the long term supported versions. That would be 8, 11, 17 and 21. But you don't need to master the whole language to use it. The Java language itself started out in the early 90s with a stated goal to be simple OO c-like, but has developed into a complicated behemoth that an ambitious developer can still spend a substantial part of their life studying.
3
u/4r73m190r0s Feb 13 '24
Start with Java 8, learn it well, then add functionalities from newer version per preference or task requirement.
0
Feb 13 '24
[deleted]
0
u/keefemotif Feb 14 '24
Until you have to manage multiple JVMs on the same machine. The number of codebases still in java8 is mind boggling, though they did speed up release cycles after that.
1
u/nutrecht Feb 15 '24
Until you have to manage multiple JVMs on the same machine.
Complete non-issue and it's also something you only need to do on your local dev machine, and for that you have tools like Jenv and SDKMAN.
•
u/AutoModerator Feb 13 '24
Please ensure that:
Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
You include any and all error messages in full - best also formatted as code block
You ask clear questions
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.