Alright, I admit C# is my primary language.
but this is my unbiased opinion on Java and the ecosystem surrounding it.
so it goes like this~
I used to bash java quite a lot, pointing out all its weaknesses,
such as java doesn't have properties. it doesn't natively have events, it doesn't have structs, no operator overloading, and until java 10 there was no inference so no 'var' either. All of which C# has!
Until a while ago, I used to bash java quite a lot for not having LINQ and 'var' and enums
And yet I write java quite a lot! especially when I'm writing android apps, but for other things too! Heck, my first coding project was also in java!
So this Friday night, due to the urgency of delivery I had to write Java for 8 hours straight.
and guess what I discovered? STREAMS!
apparently, Java 8 introduced Streams! and I had no clue about it!
for those of you who don't know, Streams is java's Implementation of LINQ.
Also, I discovered Java 10 has type inference so 'var' is a thing now in java!!
(I can't believe how outdated I've been and trust me there's a reason for that.)
Discovering these 2 things changed my mindset a lot!
did you know java has always had checked exceptions and C# does not!?
I admit It's a feature I quite miss in C#!
Yes, it doesn't have structs or properties, etc but boi is it elegant!?
I think Java will, by design, impose on you to write more robust applications. Whereas in .NET world, it is mostly left up to the developer to be careful. [Now some devs like this imposing
and restrictions where others might prefer freedom]
Albeit, both of them are quite secure but clearly, Java might have an ever so slight edge here!
So, why do big organizations prefer java?
Yes, Maybe I get it now. 😃
What hurts me the most is that... in most of the code examples you see online, these advanced features aren't always used.. heck I think if a fairly new java developer sees 'var' written all over a codebase they'll go mad! 😂 and streams? what are streams? Java devs love their For loop! in fact, even foreach loops are quite rare in the java world. (and there maybe a reason for that, For loop, is much more optimized!)
But these are good features! I'll go as far as claiming that they are awesome features! it hurts me to my core when I write Android apps and notice, there is no usage of enums almost anywhere in the android API! and that's fair because android was written ages ago. What triggers me the most is when I have to use constants every time I have to use the 'Activity for Results' feature in android
eg: int PICK_IMAGE_FROM_GALLERY = 3000
Bro that is madness! and yet people all over the world have come to accept it. and by contrast even me :D
Java is lacking native implementation of events too! if only it had events & delegates like C#...
(hey java language designers if you guys are reading this, you gotta add events! and if you already have or it is in the works, do let me know 😃)
Anyways I think I know what might be the biggest flaw in the Java ecosystem
The jarring unhelpful documentation on the Oracle website. it is stupid! it looks old! straight from 2007.
Also, it doesn't always have example snippets. if you go look up a relatively uncommon language feature or API Method, you'll find a boring function definition, declaration, arguments, which package it belongs to and that's it!
I think that's absurd. don't you think it's absurd? no code snippets?
Therefore we the developers have to rely heavily on forums like StackOverflow or other programming websites like TutorialsPoint.. sometimes they do help with nice code examples highlighting the feature but other times, they aren't that helpful either.
I mean seriously go evaluate Microsoft docs on C# with oracle docs on Java.. there's no comparison!
(don't believe me? Go check : Oracle Microsoft )
MS Docs are beautiful! heck, they even have a 'dark mode! omg, the dark mode 😂 we devs go crazy for the dark mode
what about Oracle docs? like I said, straight from 2007. there was no dark mode concept back in 2007 was there?
So, what I am saying is, Java is Amazing! but it suffers a lot from aging documentation. mostly old docs and old tutorials. which do not highlight the hot new features like streams and var and enums
Now people go about saying Java is beginning to get old and it'll be replaced with Kotlin and I Disagree. Because even if that is true. It won't just replace it right away, not until at least many many many years from now!
I mean Scala tried that? didn't it? what happened there? Java is still ruling all over the JVM Ecosystem. although I do admit Scala is quite different from Java, it is Functional first where Java is object-oriented.
Now finally.. there's this one thing that triggers me more than anything within the Java world and I mean "anything". And that is obtaining the JDK
Why the hell is so hard to get JDK????
I mean if I need the JDK, a simple Google search will point to Oracle's website, I go there and I find the JDK version I need. relatively easy so far, but then, to download it, I have to sign up.
WHAT? WHY? why would I make an account on oracle and then deal with their email junk every week, just to freaking download the JDK!? mind you Java has been open source from Day 1!!!
unlike C# which became open source very recently in 2015
So, I get frustrated and switch to the second website on google's search results. it points me to the OpenJDK website. I find the JDK there and hit download. but surprise surprise they give links to implementations of JDK from other sites!
Among those sites, there's that bloody oracle one but then there's also a link to Red Hat's website.
Now RedHat is amazing. They are truly one of the pioneers among open source companies in the world.
So I go, alright! I'll download it from there then!
I click that link, find the JDK version I'm looking for, and guess what? I have to sign up there as well. (dramatic pause)
Now that is just sad...
And to hell with that! What is wrong with these people?
Finally, I give in and I install Chocolatey. (it's like apt-get but for windows. I think it is the first widely accepted and used package manager for windows)
and so, after that, I have to write a simple command in PowerShell
eg: choco install jdk-1.8
and I'm done.
(if you are a C# developer, you'll know how easy it is to get the .Net SDK, just 2-3 clicks, no signing up and you are finished)
To conclude my long rant; Java is a great programming language. It is beautiful it is robust and it has (in my opinion) the best IDE in the world, JetBrains infamous 'IntelliJ IDEA', Java has a very helpful community, a vast and diverse ecosystem
and all of this is coming from a C# developer.
But we need to update the docs! the code examples! the APIs!
we need to make getting the JDK easier!
All in all, Java is heading in a good direction, its popularity may have suffered a bit recently but that won't make java go away. it is currently, and has been for a decade, among the top 10 languages in the world!
I do use java on a regular basis and I will continue to do so in the future as well.
To all the awesome Java devs out there, You have my respect!