Although I like Kotlin better, I'm really impressed how Oracle continues to improve Java. Some developers think Java is an old, cumbersome language, but it is indeed such a productive language and ecosystem with outstanding quality! Java has quite good support for functional programming, concise and immutable structs (called "records"), pattern matching, string templating, virtual threads, structured concurrency (pre…
Java 22 Released
131–140 of 178 posts
Re: Java 22 Released
#132Earlier quoted context omitted.
My problem with gradle is I never use it enough to get familiar with it, once the problem is solved I promptly forget everything.
It's the perfect example of a bad DSL. A "DSL" like SQL that you use hundreds of times a year you'll learn the model of. A DSL like groovy that you use once for project setup (and for that you'll one-off it likely and stackoverflow the rest of the question) is not. And it isn't really natural, it's a bunch of arcane steps that at the end might superficially look a bit consistent, but still really isn't. Groovy really…
Re: Java 22 Released
#133Earlier quoted context omitted.
I've never seen a java codebase I thought couldn't be better in kotlin
For reading it, I believe that. For authoring it, yikes it is slow. I'd guess due to all the implicit and implied and coercion and ... and ... and. Now I'm cognizant that I'm running my mouth without trying it on 1.9.x and a similarly recent IJ so maybe it got infinitely better, but my life experience with languages is that they only get more fancy swooshings not QoL improvements due to Moore's Law and yearly refresh…
Re: Java 22 Released
#134Maybe my favorite feature in this release: https://openjdk.org/jeps/463 Finally solves the inscrutable Hello World program! Yes, it's just ergonomics for early beginners. But could be the difference in whether or not someone new to programming sticks with Java or not.
C#'s got even better version of this feature since Nov 2021. Hello world is just a true one-liner. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...
I can only think the reason why they did this was to compete with python, as our scripting languages that do not require a main/Main entry point.
Personally, it just feels wrong for compiled-based languages.
I think they could improve on C# with their namespace. Rather, for example, a typical C# file looking like:-
using EFG;
namespace ABC
{
public class XYZ
{
}
}
They could just :- using EFG;
using namespace ABC;
public class XYZ
{
}
Pretty much taken from the C++ way.. but it saves on space availability.Re: Java 22 Released
#135Earlier quoted context omitted.
C#'s got even better version of this feature since Nov 2021. Hello world is just a true one-liner. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...
I really disliked this the first time I saw it. I was like "WTF is this?" I can only think the reason why they did this was to compete with python, as our scripting languages that do not require a main/Main entry point. Personally, it just feels wrong for compiled-based languages. I think they could improve on C# with their namespace. Rather, for example, a typical C# file looking like:- using EFG; namespace ABC { pu…
Re: Java 22 Released
#136Earlier quoted context omitted.
C#'s got even better version of this feature since Nov 2021. Hello world is just a true one-liner. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...
I really disliked this the first time I saw it. I was like "WTF is this?" I can only think the reason why they did this was to compete with python, as our scripting languages that do not require a main/Main entry point. Personally, it just feels wrong for compiled-based languages. I think they could improve on C# with their namespace. Rather, for example, a typical C# file looking like:- using EFG; namespace ABC { pu…
Re: Java 22 Released
#137Earlier quoted context omitted.
I really disliked this the first time I saw it. I was like "WTF is this?" I can only think the reason why they did this was to compete with python, as our scripting languages that do not require a main/Main entry point. Personally, it just feels wrong for compiled-based languages. I think they could improve on C# with their namespace. Rather, for example, a typical C# file looking like:- using EFG; namespace ABC { pu…
The second option is what C# defaults to since a few versions ago.
Re: Java 22 Released
#138Earlier quoted context omitted.
I really disliked this the first time I saw it. I was like "WTF is this?" I can only think the reason why they did this was to compete with python, as our scripting languages that do not require a main/Main entry point. Personally, it just feels wrong for compiled-based languages. I think they could improve on C# with their namespace. Rather, for example, a typical C# file looking like:- using EFG; namespace ABC { pu…
Namespace declarations have been a thing in C# for a while
Re: Java 22 Released
#139Earlier quoted context omitted.
But Java has all those features...?
Oops, sorry those are features java "stole" from groovy. Java has the nullsafe operator now and the elvis too, doesn't it? I don't use the spaceship operator much, implicit sorting works pretty well. Groovy's closures have a lot less GOTCHAs. They simply work as expected, at least to me. Half the time I use java closures and I get complaints in compilation that I don't get in Groovy, but maybe they've improved closur…
Don’t forget traits! When are we getting traits in Java? Probably never.
Optional semicolons and parentheses to cut the line noise and enable internal DSLs.
Though Java has improved implicit typing with `var` and now we have reasonable lambdas, Java is still not a high-level language, but maybe it is now medium-high.
Re: Java 22 Released
#140Maybe my favorite feature in this release: https://openjdk.org/jeps/463 Finally solves the inscrutable Hello World program! Yes, it's just ergonomics for early beginners. But could be the difference in whether or not someone new to programming sticks with Java or not.
It's better to just say "we will come to this concept later", rather than make a fake syntax that does this (taken from the JEP) behind the scenes:
new Object() { // the implicit class's body }.main();
It adds more confusion, as you are left explaining that you could not really run an instance method without instantiating the class -- it was just something fake for beginners.