Table of contents
No headings in the article.
Java, is it worth learning today, especially with all the new emerging programming languages? I like to evaluate decisions like this by listing out the pros, and cons, and comparing them.
Java, it's a high-level programming language developed in 1995 into one of the most popular languages in the world. It's open-source, and it runs on pretty much every operating system that's used to build everything from Android apps to server networks to video games. So Needless to say, it's a very powerful and merciful language, so let's start with the pros.
Java embraces object-oriented programming. It was basically a rebuild of C. However, with C, they basically took C and slapped the ability to have classes there. This made this syntax and just the overall feel of using classes. Plus, kind of awkward that Java was built from the ground up with classes in mind. Everything is an object and it's just an overall cleaner implementation.
So why is this a good thing? Well, it allows developers to easily reuse objects and their programs. It helps just the overall maintenance of your code.
The second thing is its platform independence. There's a famous saying in Java writing. Once, run it anywhere. Java runs on top of a virtual machine which is called a Java virtual machine or JVM. So as long as the JVM is installed on a machine, you can run Java code. So you can write and run your code on a windows machine take that same code, run it on Mac or Linux, and really technically you can just take the bytecode which is compiled Java code and run that on the JVM running on any machine so you don't even really need the original source code.
With Java, you also get automated memory management. Now if you're coming from a language like Python, you're going be like what's the big deal, but if you're like me. Your first language was C++. This is an amazing feature.
So, what does this mean? Well, if your program is running, you might need extra memory in a language like C. Once you're done using that memory, you need to deallocate this pace back and forgetting to do this will cause memory leaks in your program.
In a language like Java, once a chunk of code is no longer referenced, there's something called a garbage collector that runs and will automatically deallocate that for you.
So, the automated memory management just adds an extra safety net and just lets it upset you have to do it manually. Java has built-in support for multithreading. This means that you can have multiple threads running concurrently. A thread is just a unit of a process that can perform an action and the fact that Java has this built into it and in my opinion built into it very well. It just gives it a huge advantage over other languages.
The last Pro is that it's a very mature language. Java has survived for a few decades now. It has a great community. It's backed by Oracle, and they've really kept it up to date with features of competing languages like C Sharp and Kotlin. It seems like when one of these languages comes out with a new feature and the next Java update, they've you know built something similar and the Oracle website has some of the best documentation I've seen for a language, frameworks and libraries have been very well tested, and it's a language that's just probably going to be around for a long time.
All right? So those are the pros of learning Java. Let's take a look at some of the cons.
The first con is that it's losing popularity now, although it is such a widely used language, I do believe that its popularity will start to decline slowly over the years. Now it's not something that's going to happen overnight, but you know you still you have a lot of newer languages that are coming out. Like Go and rust that are getting popularity.
Then you think of Android as solely using Java and now they're moving away to start using Kotlin. Stackoverflow developer survey from 2017 and 2020 we see in 2017 it was the third most popular language in 2020. It went down to 5th now although it is slightly higher like half a per cent. We see the other mainstream languages like JavaScript went up from 62% to 67%. We see Python from 32 to 44%, so even though it went up by half a per cent, I do kind of see it kind like, you know, reaching its peak, and I feel like it's going to start declining over the years.
The next con is that it's a very verbose language, meaning you have to write a lot of code to do a little. Both languages are meant to be very declarative, and it's supposed to be very clear what you're doing. But in my opinion, it makes the code a little bit cluttered and actually harder to read, and it may not seem like a big deal to you know. Because you're just typing a little bit more, but if you're writing Java code all day, every day, it can get quite tedious and honestly, a little bit obnoxious, especially when you compare it to a language like Python.
Java is a slow language. Remember how I mentioned Java runs on a virtual machine? Well, this layer of abstraction slows things down. Virtual machines act as an operating system running on top of another operating system, so there's a lot of overhead there, but further away this software is from the hardware. The slower the performance, especially when you compare two languages like C which is very close to the hardware.
Anything where you need real-time operations like online gaming or like car operating systems. Java just isn't really going to be a good choice for that. We also mentioned the garbage collector well when that runs, your entire program suspends, then the garbage collector runs, and then the program resumes. Now, this is only a fraction of a second.
Users really aren't going to notice it, but again, if you're really looking for a speedy application take a slight performance hit.
### Conclusion
So with that being said, is Java still worth learning today now you know? Obviously depends on what you're looking to get into. But in general, I still think it's really good language. There's still a huge community behind it. Obviously, it's backed by a massive company like Oracle, and obviously, Oracle isn't going anywhere anytime soon. I think it's just a great language to pick up whether you're a beginner learning your first language or just a more experienced developer looking to add to your toolbox.