Everyone hates Java, even I did (once).
The memes, the videos, I mean literally everywhere there is spread one thing - java's popularity is decli...
For further actions, you may consider blocking this person and/or reporting abuse
Question is: why use Java, if C# or Kotlin can do everything it does better and with less boilerplate?
Don't know about C#, but Kotlin is not an alternative to Java in enterprise setup.
You might be having some POV right? I would love to hear that!
Why ?
There are more reasons, but even those listed above is enough to try to avoid Kotlin for enterprises.
Indeed great powers implies great responsibility... DSL and extension methods are valuable tools but should be used sparingly.
In Java because there is no extension methods and we can't define a function outside class, we must define a lot of util classes (*Util, plural classname) with their static import, I'm not sure it's better :/
IMO Kotlin offers interesting patterns to compensate some lacks in Java. But teams are free to define coding standard to avoid exotic code.
I'd rather say that all these are signs of poorly though out and inconsistent language. One laughable example is that code written with infix methods often can be made non-compilable by adding one more line feed.
Another (significant) disadvantage is that Kotlin encourages developer to write hacky, hard to read and understand code. Optional chaining and elvis operator are especially easy to abuse.
I'm not sure
user?.address?.streetName ?: "No street"
is weirder than
Optional.ofNullable(user).map(User::getAddress).map(Address::getStreetName).orElse("No street")
But I'm sure it's shorter :)
About infix notation, I'm not a big fan in everyday code but it can be handy for DSL. Again, great powers...
Your code is shorted for two reasons:
user
has typeString
, although for fair comparison it should have typeOptional<String>
User
internals). If you try to actually compose operations, your code will not look so short.You may try to rewrite code below with optional chaining:
For comparison, monadic version of this code looks so:
Just assumed User/Address were kt data classes / java POJO but Indeed callee could've been returned a Optional
Because companies are chilly ? 😁
In mine just replacing Java with Kotlin (keeping same framework, same supervision tools, same IDE...) is quite complex 😔
And has no sense. Kotlin "features" make keeping code clean and maintainable much harder, than with Java.
Lol.... Not sure if you're trolling , but in my experience it's exactly the opposite. Less code lines, using ADTs, powerful pattern matching make your code so much expressive and safer.
See my comment above.
yeah it's bit hard though
Simple, MS SQL and Window Server isn't free.
.Net Core may be mature now and it available on Linux
But migrate whole company infrastructure will not easy
I've been a Java developer for the past 7 years. Was even a C/C++ dev for another 4 prior to that. Yes, Java is a bit "hated", but it has some really good features and it evolved a lot in the past years. I heard many arguments against Java, like "it is slow" or "it uses a lot of memory" and I don't find them all true. JIT speeds things up a lot and Java is capable or working with big quantities of data without a problem. In today's age, hardware is cheap, engineers are expensive. I would rather pay 50$ more per month for a bigger instance, than pay a few thousand to try and optimize the code so much or use a more efficient programming language but with features or libraries that are not so widely available.
There is a reason why many web apps run on Java or JVM-compatible languages (Spring, Spring boot, Play), even high-profile ones.
Spring and Hibernate are two main reasons why Java considered "memory hog" and "slow". Applications built without these frameworks usually fast and consume reasonable amounts of memory.
Yes it's just that many newbies are scared of those class names. Even i was but then i dived deep into learning Java and found it pretty amazing!
Most of the reasons you cite:
More than that, there is no reason to hate almost any language: every language has its history, its ecosystem and its peculiarities. There is a problem only when you can't choose a language that is better suited to the job you have to do.
Moreover, Java has a very, very solid and high quality ecosystem, that is tamper-resistant by design: it is very, very hard to publish a java library that contains malicious code and getting away with it, because it is very difficoult to publish something on Maven Central without giving them a really good idea of who you are.
So, there are many jobs and use cases where Java is an excellent choice, and a pleasure to work with. And there are other options (Kotlin, Scala, Groovy) if you want to access the same ecosystem but want less OOP, more FP or simply less syntax.
Just keep on codin'!
Yeah, pretty much. Java has already realized that the world has moved on, and it has started to move on as well. The new features are so beautifully functional. It's great that Java is taking a few pages from the C# book. Though even with said features, I'd pick kotlin over java any day.
The problem, though, with any mainstream language, that is widely inferior but impressively improving, is adoption. The deed has already been done. The industry is mostly bound to the ugly chains of Java 8, and not many of them are going to upgrade.
More recent surveys paint a slightly different picture: Snyk JVM Ecosystem Report 2021 Finds Increased Usage of Java 11 in Production.
It looks like 11 has already surpassed 8 in production. And everone is waiting for 17.
Maybe they are waiting more for the JVM than the language, but Java remains an approachable and solid solution for many use cases and many teams.
Yeah you are absolutely correct😊😊
Try functional style with Java and you will see how concise and expressive Java could be.