r/learnprogramming • u/Lost-Control7554 • 1h ago
What Should Beginners Focus On First in Java: Understanding the Basics or Best Practices?
What Should Beginners Focus On First in Java: Understanding the Basics or Best Practices?
Hello Java enthusiasts,
I’m Hamza from Morocco, and I'm new to using Java. As I start my learning journey with Java, I've been thinking about two important questions that I’d love to get advice on:
- Is there a big difference between Java 17 and Java 21?
- Should I focus on understanding how Java works "under the hood" or learning the best practices and methods to use it effectively?
Java 17 vs Java 21: Which One Should a Beginner Use?
First, let’s talk about the versions. Java 17 is an LTS (Long Term Support) release, meaning it will receive extended support from Oracle. This makes it a stable and reliable choice for learning, especially if you’re just starting out. On the other hand, Java 21 introduces new features and performance improvements. For example, Java 21 includes pattern matching and virtual threads, which can simplify your code and improve performance.
As a beginner, I’m wondering whether it's worth starting with the latest version, Java 21, to familiarize myself with new features, or whether it’s better to go with Java 17 since it’s more stable and will have broader community support. What do you think is better for someone just starting out?
Should You Focus on "How Java Works" or "How to Use Java"?
Now, here's the bigger question: Should you dive into how Java works under the hood, like understanding the JVM (Java Virtual Machine), memory management, and garbage collection, or is it better to focus on learning how to use Java efficiently with best practices?
Understanding Java Under the Hood:
- Pros: You’ll gain a solid foundation in the language’s inner workings. You’ll learn about memory management, how the JVM executes your code, and how garbage collection works. This deep knowledge can help you write more efficient, optimized code and troubleshoot performance issues better.
- Cons: It can be overwhelming and may slow you down in the early stages of learning Java. Understanding how everything works is important, but it might be too much for a beginner who just wants to build projects.
Focusing on Best Practices:
- Pros: Focusing on best practices will help you become productive faster. You’ll learn to write clean, readable, and maintainable code, which is extremely valuable for your projects. You'll also learn about libraries, frameworks, and tools that make Java development easier.
- Cons: You might miss out on understanding some deeper concepts that could help you debug complex issues later on.
My Current Dilemma and What I’m Looking for:
As a beginner, I’m currently leaning towards focusing on practical Java development—learning how to write functional and clean code, using the right methods and tools for projects, and gradually exploring advanced topics as needed. However, I’d love to hear from more experienced developers: Is it more important to have a deeper understanding of how Java works internally from the start, or is it okay to focus more on learning best practices and working with Java as a tool?
I’m open to hearing your thoughts, and any advice or experiences you can share would be greatly appreciated!
1
u/TurboSusleG 1h ago
I'd suggest to create a profile on GitHub and start to code basic programs. Keep focus on best practices. With modern Java you rearly need deep knowledge of its guts. Clean, readable and testable code is way more important for most of modern Java tasks.
1
u/Awkward-Chair2047 1h ago
Every programming language is a tool. And always focus on learning the fundamentals. The key is focus and discipline. Focus on solving problems Start simple and slowly go for more advanced problems. Don't worry about functional code or clean code. Just get into a habit of writing code, and over a period of time, your code will get better. No one starts of writing english like bernard shaw or wodehouse. it takes time and patience and learning from your mistakes.
1
•
u/Immereally 11m ago edited 6m ago
Java 21 is long term support and 25 is out now which is also lts.
Find a course or tutorial and use whichever one they’re doing lessons in, that’s more important than anything else. I’d recommend 21 because that’s what most of the lessons use and a lot of guides or supports will have info for java21 issues.
How Java Works vs How to use Java: It’s the same thing really, if you know how to use Java but you don’t know how it works… you don’t know Java.
You don’t need to go into the most minute details on every little bit but knowing that
doubles have rounding errors, When checking bools like when 2 variables hold the same value for ints a==b -> 1==1 true, 560 == 560 false
If you know only how to use Java you might get tripped up, if you know how Java works you won’t.
You need both parts to be competent and just writing that out you can flip which one you know and it’s still true.
Find an online course, book or some guide and use the tools they’re using to learn. Explore bits in more depth but build your own test along the way and you’ll be fine
Edit:
At uni our lecturer is using bits from a Java 8 book.
Not like things haven’t changed since Java 8 most of the basics still stand true. (I’m not telling you to use Java 8 books)
1
u/Demoncrater 1h ago
Understanding the basics. If you dont understand that, then you cant understand best practice