Continuing the series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used Java before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
Continuing the series! Feel welcome to dip in and weigh in on a past question.
Let's say I've never used Java before. Can anyone give the run down of what the language does and why you prefer it? Feel free to touch on drawbacks as well.
For further actions, you may consider blocking this person and/or reporting abuse
Oldest comments (60)
It seems like a good professional choice to know Java.
Let's say your a Python developer — Ruby probably won't expand your skills and professional opportunities that much, but Java likely will on both fronts.
@goyo I'm calling you out! I know you got some thoughts on this topic. 😀☕️
Well, a lot has been said here already but I'll chime in.
Java, especially the newer versions, is a very good language for server-side applications - it's fast, reliable, has powerful tooling and libraries, and virtually every question you may have has already been answered online.
On the other hand, it is not the most sleek language so if someone really cares about punctuation or the number of characters they have to write, they may be put off.
The language is ubiquitous among enterprises, so it's a pretty solid bet if you want to get a job or switch companies. It also means you're likely to work with enterprise applications and deal with complex business issues. IME, if you're biased towards solving interesting domain problems, you'll be happy doing it with Java (and probably any other language). If you're more biased towards doing cool technical stuff, you're probably going to look for something else.
Personally, I'm in love with Kotlin and I see it as an obvious replacement for Java, as they work in the same ecosystem.
I have been trying to find statistics on Kotlin backend adoption. I don't have a good way of measuring it right now. I see it occasionally in backend job descriptions. I suspect it will take over java marketshare, but not sure.
Pros of Using Java:
Cons of Using Java:
Java is not slow.
Java is not for desktop apps.
Java is reasonably verbose, which makes support and maintenance of long-living projects much simpler. As a consequence, Java dominates enterprise software development. Needless to say that it means virtually infinite number of jobs, constant high demand and great salaries.
P.S. Java is very expressive and simple language with very straightforward, consistent and well thought out syntax.
"Slow and Poor Performance", "Poor GUI", "No backup facility" - are you talking about Java on the desktop? (applets, swing, JWT) ... that's a disaster, and always has been, but Java on the server is a different story, it'd well-respected.
(scalability and memory management of the JVM in server environments are arguably strong points ... verbosity of the language remains an issue, but you can use other languages on top of the JVM)
Apache Cassandra is written in Java and it's fast 🤷♂️
Slow and poor performance? Where is it came from?
Compared to which language? JavaScript? Python? Ruby? PHP?
Do you have a benchmark?
Java is among fastest languages. For some tasks it is comparable to C++. With much simpler memory management.
Verbose - yes, but it is feature. All your fancy JavaScript oneliners should be well commented to be understood. Java code that follows conventions is self explained.
Writing GUI is not simple in Java, but it is possible. Check Eclipse and Netbeans. Those apps are among most complex GUI applications you ever seen and they written entirely in Java.
Pros:
Cons:
Verbosity is not a bad thing. There is no behind the scene magic, which means you are in control, and can optimize code and its performance. Also in large enterprise, verbosity is encouraged because it will make it easier for the next guy who will replace you, to understand what is happening in code. Some companies even have code guidelines that prefers you to not show-off your special tricks and stick to basics.
At beginners level, With verbosity, you will learn concepts at a great details because you have to write every step of that concept. Every line of code that you write, you will ask yourself "have I covered all edge cases"
At intermediate level, your IDE will take care of a lot of stuff for you, You will have learnt the reason for any line of code you have written. So you will create generic snippets, and write a lot more code by writing a lot less.
And once you reach advance level of skillset, you will look beyond IDEs, You will use libraries like project lombok to replace boilerplate code with rich annotations. You will embrace annotations because you know what code compiler will generate based on those annotations. You will play with different JVM flags to optimize bytecode. All because you have a clear understanding of code that was verbose.
It is a robust and solid programming language.
You can build web APIs, Android applications and even GUIs with it.
The ecosystem is great and very mature!
There are well maintained libraries for nearly every use case.
I can only second that. Performance is actually very good, in fact it outperforms natively compiled C++ code in many situations as the hotspot VM aggressively optimizes at runtime.
Also I don’t understand what „backup facility“ means.
If you’re into something longer, I wrote about it here…
dev.to/stealthmusic/java-is-dead-l...
…and here…
dev.to/stealthmusic/modern-java-de...
I never coded in Java but used many internal developed Java softwares and every single one was slooow. We had the same app later rebuilt with Electron which was fully written in JavaScript/Node and it felt like 50 times faster.
Slow apps could be written in any language. Java is not an exception.
Those "internally developed Java softwares" were likely desktop apps ... let's be frank, Java on the desktop (applets, JWT, Swing and all that) sucks ... do not, I repeat do not, use Java on the desktop - should only be used server side!
@ivanjeremic
If you think electron was faster, you can't imagine the performance of tauri, or webview.
I have worked on Java desktop app. They can be really fast if you compile it for production, which uses compiler optimization flags. Yes startup time can be slow in some cases, but JVM has been improving a lot in past few years. Memory footprint of J9 is also in league of its own.
It also depends on framework used, In my experience, If animations are avoided, Fx is really fast, compared to swing. That said, Swing is really performant library. Eclipes IDE uses SWT which is built upon on swing.
Good to hear a bit of a different view, the huge amount of bashing that Java gets (often not based on actual knowledge) can be tiresome ...
If Python is a car, Java would be a truck.
IMHO it's not made to make small programs and toy projects. It adds to much overhead for that. However, as the codebase grows in complexity, the benefits will come back more and more. It's something you want to build something big, large that will still be running in ten years.
Cons:
Pros
From what I understand, golang wouldn't exist if it wasn't for this disaster.
Java is a great language to learn and use for the following reasons:
It is one of the most widely-used languages there are, consistently placing in the top three most popular alongside C++ and Python
It powers most of the major web apps you know--everything from Twitter to Google Maps to eBay
As a result, it has a huge ecosystem of open-source libraries and frameworks around it. You can leverage the advantages of widely-used and well-maintained libraries for every kind of programming task imaginable from concurrency to testing (caveat: this also means you can experience analysis-paralysis about which library/framework to use to accomplish a task)
It has great performance and scalability, particularly in web services and applications (caveat: it is slow to load and does not support autoscaling as well as a language like Go)
Java is always backwards-compatible, even across major versions, so code that was written twenty years ago can (and does) still do its job today (caveat: this sometimes means it is slow to adopt modern language features or does so in unexpected ways)
A real advantage of Java is not the language itself, but the Java Virtual Machine. The JVM both allows Java to run atop any underlying hardware (you can run Java on your phone or your microwave, for instance) and allows you to use wholly other languages like Clojure, Kotlin, Scala, etc. in case you prefer a different idiom (functional, for example)
HIH