+ 14

Is there any reason why Java should still exist?

I've been wondering about this for quite a few days now but I couldn't come up with a decent answer. Most programming languages that are used today have something that makes them unique and in certain situations better than other languages. For Java however, I just can't image any use case where it would be better than other languages. Portability doesn't count as an argument in my opinion because relying on a runtime makes it actually less portable than C or C++ for example. Of course you might have to compile C several times for multiple platforms but that's not a big deal and usually done automatically. For this question I also want to ignore the ecosystem around Java that makes it the most common language for Android development and some enterprise applications. This ecosystem doesn't actually rely on Java itself. There's no reason why not a different language could have become the main language for Android development for example. The internet couldn't help me with this question, but I hope you can :)

31st Dec 2019, 10:29 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
43 Respostas
+ 48
So anyway what's the argument that says it shouldn't exist? Alrighty let's see what can we do with Java: - No pointers, memory leaks are harder to create. - Has more abstraction - interfaces, abstract classes, easier to write object oriented code. - A lot richer API than what c/cpp has to offer. - Generics which are not cancerous. - Java is designed to be used as general purpose language, so it has a lot of tools to use in web dev as well as for Android apps. - Allows Reflection (I heard it is to be introduced in a new cpp standard, but it was earlier in Java) It comes from C# dev, have in mind I'm in holy war against Java, but making arguments like "This or that language shouldn't exist" are just pointless. Every mainstream language has something to offer and your lack of knowledge is no excuse.
31st Dec 2019, 11:11 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 23
~ swim ~ instead of "bad developers who don't know how to manage memory", you could look at it this way. Java allows the developer to focus on the business problem, instead of micromanaging hardware issues. A higher level of abstraction pays off if you can deliver software more quickly. The JVM and GC allow this via automation of the memory/OS handling - and in many cases this would be the ideal solution, except for some really sensitive and mission-critical software, where precise memory management is required. So far Java was mainly compared with C/C++ but I am also wondering why it wins against other high level languages, especially its main opponent C# and some very capable functional languages like Scala and Clojure. My guess is that functional programming paradigms are not yet mainstream enough, even though they provide many benefits, and even though they are slowly seeping through to the actual mainstream languages like javascript, java and c#. Developers need to grow up to appreciate them.
31st Dec 2019, 12:10 PM
Tibor Santa
Tibor Santa - avatar
+ 21
Heard about the Collections framework? It has inbuilt algorithms for- 1) Sorting - optimized merge sort 2) Searching - uses binary search 3) Data Manipulation 4) Composition etc. Then concepts like- 1) Generics 2) JDBC 3) JAXP 4) Internationalization and so many others that I cannot recall. The most basic and the best part in Java is that it is ROBUST. 1) Type checking is taken care 2) Garbage Collection 3) Exception handling There are endless reasons for it to be still in highest demand and use.
31st Dec 2019, 12:03 PM
Avinesh
Avinesh - avatar
+ 14
Tibor Santa On the other hand, in C++ RAII does 95% of the work and for the other 5% you use smart pointers which are basically a poor man's gc. Has the added bonus that you don't need an extra gc thread and it is deterministic too :) I prefer C# over Java aswell. Java generics are implemented pretty terribly and C# has more functional concepts with IEnumerables/LINQ and whatnot.
31st Dec 2019, 12:42 PM
Schindlabua
Schindlabua - avatar
+ 14
Props to Jakub Stasiak, ~ swim ~, Schindlabua, Tibor Santa, Fernando Pozzetti, and Avinesh for their answers. Aaron Eberhardt - I wonder if you meant to ask if Java has lost its relevance with the many strong alternatives today? Or perhaps you meant to ask how did Java become so popular considering the many alternatives? Either of these would make more sense than trying to find "any reason why Java should still exist." Even if there was a compelling case for C# or Kotlin or C++ etc over Java, the usage of Java wouldn't come to an end anytime soon. The sheer volume of legacy code would likely keep Java around indefinitely. That said, I do understand the nature of your question as I also think Java suffers from several horrible language design decisions. Having worked extensively with Java / J2EE, Kotlin, C#, and Javascript since each respective language has been around, I can say that Java started strong and eventually lost its steam while being surpassed by other languages.
1st Jan 2020, 7:37 AM
David Carroll
David Carroll - avatar
+ 12
There are so many languages out there that it would be really difficult to find any really unique feature, that makes Java stand out. I think that popularity does matter a lot. According to some statistics, there are more than 8 million Java developers, meaning more than 1 of every 1000 earthlings knows Java. It is very established in enterprise applications, means there is a high demand in companies to maintain and expand those codebases. Some enterprise software prevails for decades, even today many programs used in finance sector, were written in Cobol or Fortran ages ago. On the other hand, I also think that the JVM is one of the key success factors of Java, and platform independence also does matter. It is not unique (dotnet also has CLR) and there are other languages built on JVM that may be more suited to certain subdomains (Scala, Groovy, Clojure, Kotlin) but I think they rather complement Java than fully replace it, due to the strong interop capability, there is no need to rewrite all old java code.
31st Dec 2019, 11:50 AM
Tibor Santa
Tibor Santa - avatar
+ 10
Java is not the prettiest language but I think it did a lot of things right in the 1990s compared to other languages at the time so it became popular. In hindsight, annotations and reflection are a perfect match for business logic type code. It's easy to learn so there is that. Plus RMI is kind of cool even if maybe not that common. I wish it wasn't the biggest language and programming in java can be pretty annoying but of course at this point it's too big to fail.
31st Dec 2019, 11:43 AM
Schindlabua
Schindlabua - avatar
+ 10
Java has been called the modern day COBOL. It took COBOL ages to die. Java will take way longer than that.
1st Jan 2020, 3:50 PM
Sonic
Sonic - avatar
+ 8
I'm guessing this will soon be on Hot Today because there will soon be a war going on here 😆 {unsub before war begins}
31st Dec 2019, 11:17 AM
Ipang
+ 7
Jakub Stasiak good points. Some of them can certainly be discussed further, but generally speaking that sounds pretty convincing. Yet the question is still whether Java really wins against all other (commonly used) languages in these categories. But I fear this can't be answered as there are too many different approaches by too many different languages... Btw. I'm not a C# dev 😂. I don't see Java as a bad language I just wonder why it's still so popular though so many seemingly better language exist.
31st Dec 2019, 11:36 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 7
well basically because minecraft.
31st Dec 2019, 11:41 PM
yinhaodragon7
yinhaodragon7 - avatar
+ 7
Aaron Eberhardt You hit the nail on the head when you mentioned universities. Many graduates stick to what they know and often times it's going to be Java. Universities are slow moving dinosaurs that tend to trail way behind anything relevant in the constantly evolving software industry. Yet... universities have incredible influence on language trends. For example, I believe the hype around Python is more from universities than from professional software engineers. I blame the skewed hype on CS students. 😜 In defense of WORA, the premise for this has always been in the context of "run anywhere" the JRE is installed. So... it doesn't fail on that front - for the most part. 😉 Java is also very reliable, very consistent with deployments, and has a large work force - which can all be higher priorities over newer, better languages. I, for one, refuse to join any projects involving Java. Thank goodness C# and Javascript continue to be in high demand across the board in my market.
1st Jan 2020, 3:44 PM
David Carroll
David Carroll - avatar
+ 7
Two words: large footprint.
1st Jan 2020, 3:49 PM
Sonic
Sonic - avatar
+ 7
Another problem is the massive base of blindly loyal developers who genuinely believe Java remains the most capable and superior language of choice for general use development. Example: See all the random answers posted in this thread by people supporting Java with cookie cutter sound byte answers that don't actually address the question or consider the other answers. 🤔 Most die-hard Java loyalists I've encountered believe all the hate is expected in what they believe to be the biggest and best language. Many Java supporters think C# is just a Microsoft ripoff of Java or Kotlin is just a trendy alternative for people who prefer a different syntax for JVM software. Since many Java developers don't focus on other languages, many don't get the opportunity to experience these other languages. I've yet to meet a Java developer who didn't convert after working on a commercial C# project. However, this is all just anecdotal feedback. I could actually be on the wrong side of this as well. 🤷‍♂️😜
1st Jan 2020, 4:46 PM
David Carroll
David Carroll - avatar
+ 7
With the massive shift towards open sourced multi-platform support of C# in .NET Core and .NET Standard, Java will likely become less relevant over the next decade or so. It would be easier to build onto Kotlin than to try to fix Java at this point.
1st Jan 2020, 10:16 PM
David Carroll
David Carroll - avatar
+ 6
David Carroll I feel like my question was maybe a bit too provocatively expressed, but as you said, I just wondered why people use Java as much today because it seems to have lost its relevance. I also don't mean the legacy usage but there are quite a few new projects using Java and it seems like almost every university in Germany still teaches Java as the main programming language. Of course Java isn't particularly bad for educational purposes, but it rather feels like the system got stuck and no one even looked for better alternatives for years. Actually the reason however, why I started to think about this, was an annoying server install where a specific version of the JRE was required and I had some trouble with the configs to install it. I wondered, why can't this program just simply run? I think Java failed its promise "write once, run anywhere". No one should need a runtime to actually run a (native) program, in my opinion. Also something that claims to be run anywhere simply must not have a runtime.
1st Jan 2020, 10:46 AM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 6
Aaron Eberhardt one more reason for Java's prevalence, is actually the recent IT trends / hypes / obsessions around DATA (including data science, business intelligence, deep learning etc) and particularly Big Data (massive amounts of unstructured and sensory data) and IoT (Internet of Things). Companies try to harness this information to gain business value. And actually the most relevant framework to handle the analysis and distributed processing of Big Data, is the Apache Hadoop and related technologies, all built with Java.
1st Jan 2020, 4:20 PM
Tibor Santa
Tibor Santa - avatar
+ 6
Avinesh I completely understand what you mean. It's one of those situations where you don't know what you're missing until you've experienced something better. Until then, it doesn't make sense to fix or change something that's working fine. I've always been the type of developer who enjoys picking up new languages and working with new technologies for the fun of it. My first professional experience with Java was probably in 1998 or 1999. It was early enough for the language to still feel like it was this shiny, brand new thing which we were all pretty excited about. Don't get me wrong, it was still a bumpy ride as documentation was sparse, environment setup felt like a complete guessing game, JDBC drivers were still quite buggy, and it wasn't like we had rich knowledge sharing websites like Stackoverflow or YouTube to work through the unknowns. We were probably the last resourceful generation of developers who became masters at figuring things out on our own. (continued...)
1st Jan 2020, 9:38 PM
David Carroll
David Carroll - avatar
+ 6
Still yet, Java was still great compared to VB6 or C++ at the time. I was also one of the earliest preview developers to work with C# during its alpha releases. At the time, C# did feel like a complete ripoff of Java with only a few subtle differences in the language design. However, by the v1.0 release, I favored C# over Java solely based on the Visual Studio.NET IDE as the development tools and environment setup were a thousand times better than anything Java had to offer. Those subtle differences from v1.0 revealed the real genius behind Anders Hejlsberg's vision for C# with the v2.0 release and ever since, C# has been the superior language over Java - in my opinion. Java basically stagnated and has struggled to keep up with language improvements compared to C#. Kotlin, in my opinion, is what Java should have become but failed to deliver. If you want to gain more insight on the differences, checkout the following: https://www.sololearn.com/post/183509/ https://www.sololearn.com/post/117714/
1st Jan 2020, 10:03 PM
David Carroll
David Carroll - avatar
+ 6
Shtisim Lukshen While I've always preferred C# over Java, I was typically open to joining or leading an enterprise development team using Java based on how interesting the project was. As C# continued to rapidly evolve, I became more and more irritated with the Java experience. The differences between a C# and Java projects for me would be like comparing the experiences using a horrible IDE like Dr. Java with a powerful, modern IDE like IntelliJ. My refusal to work with Java again was locked in between 2012 and 2013 after nightmare experiences with 2 separate enterprise Java applications. In 2012, I inherited the Java application used for streaming Pay Per View programming over cable boxes for a large cable company in the USA. I experienced a massive package dependency hell like never before as we attempted to upgrade from Java 6 to Java 7. There was no upgrade path to Java 8 without gutting out tremendous amounts of code and middleware services like GlassFish. (continued...)
2nd Jan 2020, 9:04 AM
David Carroll
David Carroll - avatar