News for hackers. Stuff that matters.
Re:The golden age of Kotlin and its uncertain future by dehrmann on Thursday January 11, 2024 @02:12AM (#38948824)
The future is very certain. Mainline Java has been cherry picking the best features from these languages after there's sufficient traction and the issues have already surfaced. Since the tooling has to support both Java and some other contender, Java always gets first-class support. Using any of the alternative JVM languages (except maybe Clojure) gives you better syntax, somewhat better abstractions for a few years, and worse tooling. And syntax is overrated. Java might be verbose, but it's well-understood, and it's not actually what slows development.
Re:The golden age of Kotlin and its uncertain future by pkphilip on Thursday January 11, 2024 @02:36AM (#38948967)
Yep, all true.

These days Java isn't slow to develop on at all. There are plenty of very good frameworks where you can get going with developing a web app or rest service in next to no time with far better tooling support, sophistication etc.

.NET is a serious contender though.

Node isn't really on the same ballpark in terms of maturity.

Re:The golden age of Kotlin and its uncertain future by DeathArrow on Thursday January 11, 2024 @03:33AM (#38949410)
>.NET is a serious contender though.

It the other way around. Java has barely caught up with C#. C# team is typically introducing more features, faster.

Re:The golden age of Kotlin and its uncertain future by royjacobs on Thursday January 11, 2024 @03:55AM (#38949584)
I'm not sure language design should be a race to see who can add the most features, though.

I prefer Java's more thoughtful approach to introducing new features.

Re:The golden age of Kotlin and its uncertain future by keithnz on Thursday January 11, 2024 @06:24AM (#38950778)
in what way do you think it's more thoughtful than C#?
Re:The golden age of Kotlin and its uncertain future by za3faran on Thursday January 11, 2024 @01:26PM (#38956418)
No OP, but for example you still see the C# folks still struggling to add discriminated unions to the language because of complex interactions due to its too many features[1]. Virtual threads are easier to use than async/await is another example.

[1] https://github.com/dotnet/csharplang/issues/113

Re:The golden age of Kotlin and its uncertain future by neonsunset on Thursday January 11, 2024 @03:06PM (#38958205)
Performant implementation of discriminated unions in .NET (unlike any that you would see in JVM) requires modification of both the type system and the runtime to account for non-boxing representation of struct unions as well as unions in which GC references alias value types/structs. This is highly non-trivial and the people who could be working on this are currently busy with other features namely Rust-like traits called explicit and implicit extensions. Don't forget that .NET is worked on by at least 10x smaller community and teams than JVM implementations and yet delivers much better YoY degree of improvement and much nicer user experience (Gradle lol).

In addition, green threads approach is a strictly worse and a more limited solution that only solves thread blocking without unlocking the variety of terse concurrency patterns enabled by the way the tasks are handled in .NET. They also add significant overhead to interop with native code due to thread pinning/stack switching (also applies to Go).

Re:The golden age of Kotlin and its uncertain future by ShadowBanThis01 on Thursday January 11, 2024 @02:41AM (#38949008)
Not to mention that Node isn't a language, and Deno is cleaner.
Re:The golden age of Kotlin and its uncertain future by pkphilip on Thursday January 11, 2024 @08:14AM (#38951777)
I was referring to Java as a platform rather than just as a language. .NET isn't a language either
Re:The golden age of Kotlin and its uncertain future by ShadowBanThis01 on Thursday January 11, 2024 @04:51PM (#38959736)
Indeed, but I only wanted to include so much pedantry!
Re:The golden age of Kotlin and its uncertain future by esafak on Thursday January 11, 2024 @02:55AM (#38949124)
Kotlin has great tooling, and Java library compatibility, so why wouldn't you use it? When you work in Kotlin, you give the masses of Java programmers the ability to contribute and a licence to check their EnterpriseGradeFizzBuzzSolutionStrategyFactory mentality at the door. Do Java projects in industry even use the new stuff? Also, you can use virtual threads with coroutines.
Re:The golden age of Kotlin and its uncertain future by ivan_gammel on Thursday January 11, 2024 @03:07AM (#38949207)
>Do Java projects in industry even use the new stuff?

Yes. Kotlin fans need to understand that Kotlin is not competing with the old Java ways and stop mentioning bloody enterprise as an argument against Java, because bloody enterprise is largely ignorant to Kotlin‘s cause. EnterpriseStrategyAdapter anti-pattern is not a language problem, it is a management problem. It won’t be solved neither by new features of Java nor by new features of Kotlin. The real competition is in the new code in startups and Java has one big advantage there: faster recruiting, more reliability in tooling, better quality of business code for the money. Kotlin is a good perk for developers in late stage startups, where the teams are big, delivery timelines more relaxed and you can afford fancy but less mature language or tool to consume resources instead of delivering more business value.

Re:The golden age of Kotlin and its uncertain future by DeathArrow on Thursday January 11, 2024 @03:38AM (#38949446)
>Kotlin is a good perk for developers in late stage startups, where the teams are big, delivery timelines more relaxed and you can afford fancy but less mature language or tool to consume resources instead of delivering more business value.

The proof being?

Re:The golden age of Kotlin and its uncertain future by esafak on Thursday January 11, 2024 @03:11AM (#38949232)
Your sibling commenter said (s)he just got off Java 8 in 2023. My experience was similar; that's why I asked.

Also, it's hard to find Java programmers who haven't been tainted by that enterprise mentality, so in a way it makes hiring hard if you don't have the resources to filter the junk. When you see Clojure or Scala on a resume you know they're above that.

Re:The golden age of Kotlin and its uncertain future by ivan_gammel on Thursday January 11, 2024 @03:42AM (#38949472)
Well, my team is now on latest LTS (21) and we do use new features in our code. Hiring an engineer who can write modern code is not any more difficult than hiring without this requirement. It is generally a management problem, that any skilled senior manager should be able to solve. After all, enterprise anti-patterns are not uncurable poison, e.g. switching to record-style accessors is something people can do on their first day easily.
Re:The golden age of Kotlin and its uncertain future by msy on Thursday January 11, 2024 @03:21AM (#38949311)
I could count the number of startups I’m aware of building on Java on one hand, after a wood chipper accident. For perf it’s rust, for web it’s Go or node/deno/bun for single front/back language.
Re:The golden age of Kotlin and its uncertain future by threeseed on Thursday January 11, 2024 @03:53AM (#38949565)
Java is often faster than Rust on typical single-threaded code. Rust is faster when you want to leverage features like SIMD.

And when it comes to concurrency Rust is the worst language I've ever used by far. The type checker makes dealing with objects between threads extremely painful. With the JVM it's all just handed for you.

Rust is great when you want a tiny binary with minimal memory consumption.

Re:The golden age of Kotlin and its uncertain future by DeathArrow on Thursday January 11, 2024 @03:51AM (#38949537)
So you think Rust and Go are more frequently used than Java for new code? Do you have something to support you claim?

Looking at TIOBE and PYPL, it comes that for backend Java and .NET are huge, followed by .Node.js, followed by Python and then PHP.

Re:The golden age of Kotlin and its uncertain future by ivan_gammel on Thursday January 11, 2024 @03:35AM (#38949422)
I know a number of them, but that’s not really important. You didn’t mention Kotlin, right? :) Often enough whatever stack was used at the seed stage, it is eventually either replaced or complemented by Java, meaning that new code is written either on latest LTS or even on evergreen version.
Re:The golden age of Kotlin and its uncertain future by MrBuddyCasino on Thursday January 11, 2024 @04:46AM (#38949974)
I have never seen Golang being used for business logic backends, its Java, Kotlin or .NET, and then nothing else for a long while. It is not expressive enough but shines in other areas, mainly infrastructure.

Remember that "Systems Programming", which is what Golang was designed for, isn't necessarily just Kernel and device drivers, but everything that isn't "Application Programming", and that includes the whole K8S networking and container stuff where it is very successful.

Re:The golden age of Kotlin and its uncertain future by mustermannBB on Thursday January 11, 2024 @04:53PM (#38959756)
Kotlin is weird inclusion in that list with Java and .NET unless you'd include Android.
Re:The golden age of Kotlin and its uncertain future by the_gipsy on Thursday January 11, 2024 @04:56AM (#38950072)
> new code in startups and Java has one big advantage there: faster recruiting, more reliability in tooling, better quality of business code for the money.

You're delusional if you really think any of this is true. There are, proportionally to "enterprise", extremely few startups using java. For good reasons.

Re:The golden age of Kotlin and its uncertain future by ivan_gammel on Thursday January 11, 2024 @05:51AM (#38950511)
I have no idea what „good reasons“ are you talking about except fancy language as a compensation perk. Java is a good choice for startups, even if it is not the most popular choice (often for bad reasons). I have proven it several times by being able to ship working and scalable solutions quickly and hiring decent team with time to close open vacancy within 1 month.
Re:The golden age of Kotlin and its uncertain future by DeathArrow on Thursday January 11, 2024 @03:37AM (#38949438)
>Kotlin has great tooling, and Java library compatibility, so why wouldn't you use it?

As an average company what you want from a language is: your team already knows it or is fast to learn, it is arguably better in a measurable way (development is faster, codebase is easier to maintain), developers like it more, it has a large support and audience.

How many of these does Kotlin check?

Re:The golden age of Kotlin and its uncertain future by wiseowise on Thursday January 11, 2024 @11:58AM (#38954931)
All of them except first.
Re:The golden age of Kotlin and its uncertain future by dehrmann on Thursday January 11, 2024 @12:37PM (#38955594)
Kotlin is the Dvorak to Java's Qwerty. It looks better in theory, but not where it actually counts, and not enough to justify going against the grain.
Re:The golden age of Kotlin and its uncertain future by happymellon on Thursday January 11, 2024 @03:01AM (#38949164)
I'm allowed to use Streams but var isn't because it makes GitHub PRs difficult to parse.

We got to upgrade from Java 8 to Java 17 in 2023.

Re:The golden age of Kotlin and its uncertain future by throwaway13623 on Thursday January 11, 2024 @03:29AM (#38949373)
I've worked in "enterprise" and have a different experience. The enterprise projects that I was working on switched to Java 8 in 2015. There were some legacy services that remained on 5 or 6 for a while, but they were mostly in "maintenance" mode and nobody wanted to spend time on them.

I have over two decades of experience and there has always been room for trying out the "new" technologies and keeping up with the latest best practices, even in enterprise. I know that not everyone has this experience, but there are actually a lot that happens outside slow big American legacy companies...

In my current startup we use the latest JVM and have a mix of Java and Kotlin. It works really well and we have never experienced any problems with development speed that was related to code or language syntax. JVM + Spring boot + Postgres may be the "boring" choice, but it has enabled us to focus on getting things done and focusing on the product. It didn't take long for juniors to be productive in our stack either. Spring itself looks a bit scary at first sight, but once you learned the basic philosophy you have less issues than a Node project in my experience.

I know that my experience may not match your experience, so I recognize that I can't make a generic statement. It's just a bit frustrating to see similar statements made by people with bad experiences.

- Not all Java development happens in enterprise. There is a thriving eco system of small to middle sized companies and startups using Java

- Not all enterprises are the same. I've actually noticed a shift to the other extreme, where enterprise uses the latest technologies to attract new employees. Nobody who has a choice wants to work with factory patterns on an old version of Java

- Old Java patterns like factories and extreme use of inheritance is out of fashion. There is of course a lag like in any trends, but remember that Java is so widely used so you will always find companies that are slow to adopt, or have legacy software that is in maintenance mode.

Re:The golden age of Kotlin and its uncertain future by happymellon on Thursday January 11, 2024 @03:53AM (#38949563)
Luckily I don't have to deal with FactoryFactories either.

I have to keep alternating between startup and enterprise so that I can keep sane but also get pension contributions, so I do know there is a great world out there. Just not always great paid (am in UK).

Re:The golden age of Kotlin and its uncertain future by tpm on Thursday January 11, 2024 @03:44AM (#38949486)
We use Java 17 features on all our projects now, expecting to update the platform to 21 in a year or so. Allowed features vary by project, some reviewers don't like vars (though I do) because it makes it harder to understand the code for them.
Re:The golden age of Kotlin and its uncertain future by sho on Thursday January 11, 2024 @03:05AM (#38949197)
> syntax is overrated

Speak for yourself there good buddy. It's pretty important to me!

But I do agree with your broader point. From one perspective, Kotlin has been a great success if we define its mission as a test-bed and laboratory for improving Java proper. Unfortunately, while it has arguably succeeded in that mission, in doing so it might unavoidably fail in another mission, which is to thrive as an independent language.

I'd liken it to yarn and npm. Yarn was a huge success.. at forcing npm to massively improve and thus basically rendering itself irrelevant. A bittersweet success, but a success nonetheless..

I wonder if there's a term for this kind of self-sacrificial project which makes the world better for having existed but doesn't survive the process..

Re:The golden age of Kotlin and its uncertain future by hitekker on Thursday January 11, 2024 @02:46AM (#38949047)
> Java might be verbose, but it's well-understood, and it's not actually what slows development.

I think you're onto something. Maybe some Java-by-default workplaces lack technically interesting problems that engineers want to solve, so those engineers instead overfocus on the frictions of the parts they can control. Maybe those engineers desire expressiveness in their working programming language to compensate for the restrictions on the rest of their work.

Just a hunch though.

Re:The golden age of Kotlin and its uncertain future by throwaway13623 on Thursday January 11, 2024 @04:01AM (#38949613)
I think you may have a point. At mature companies, they have largely solved the product market fit and uses a stable stack that just works. I have worked worked for such companies, and developers jumped at the chance to use the latest (untested) technologies for greenfield projects if they had the chance.

In my startup we also use a "boring" stack, but the problems we solve are innovative and motivation in itself. The developers work closely with customers and can see the impact that the product has. They are no longer working in a Jira-factory and while they are still interested in technology they also find motivation in the product itself.

Re:The golden age of Kotlin and its uncertain future by gleenn on Thursday January 11, 2024 @02:59AM (#38949151)
Clojure is such a joy to use. I get the maturity of the Java ecosystem and the immutability, functional style, and concision of a lisp. If performance really matters, and Clojure does perform well, you can always dive into stuff with all the Java tooling and interop is extremely easy. I really wish more people picked it up.
Re:The golden age of Kotlin and its uncertain future by cryptos on Thursday January 11, 2024 @03:25AM (#38949335)
I feel no desire to use dynamic typing again, as nice as Clojure might otherwise be. While Kotlin is not strictly immutable, it is much better in this regard than Java. Collections are immutable by default in Kotlin (or more precisely you get an immutable view defined by the respective interface) and that is quite useful in practice.
Re:The golden age of Kotlin and its uncertain future by voidfunc on Thursday January 11, 2024 @02:22AM (#38948893)
This. I love the Kotlin language but Java had just caught up and the things that made Kotlin super exciting several years ago are less exciting now as Java advanced. Also I looked back at Kotlin recently and things have gotten way more complex than I remember around 1.0.

Kotlin needed to succeed on the native front to live beyond Java. It didn't and that puts it in a perilous long-term spot.

Re:The golden age of Kotlin and its uncertain future by MrBuddyCasino on Thursday January 11, 2024 @02:37AM (#38948974)
The one major thing Kotlin still has going for it is null safety, and IMO it eclipses every other „nice“ feature. But Java will get this too, and then I‘m not sure I can justify using it.

Oh and I wish Java would support „it“ in lambdas, very useful.

Re:The golden age of Kotlin and its uncertain future by cryptos on Thursday January 11, 2024 @02:49AM (#38949077)
Java will not have the same level of null safety as Kotlin. Instead Types can be explicitly marked as "not null", so the default is still that every reference type can be null.
Re:The golden age of Kotlin and its uncertain future by MrBuddyCasino on Thursday January 11, 2024 @04:00AM (#38949607)
Yes unfortunately, but I mostly miss null safety in domain classes, not in the stdlib. It remains to be seen if this is "good enough" or not.
Re:The golden age of Kotlin and its uncertain future by brabel on Thursday January 11, 2024 @02:49AM (#38949078)
Will Java have null-safety?? Can you link to that, I haven't heard anything at all about this.
Re:The golden age of Kotlin and its uncertain future by MrBuddyCasino on Thursday January 11, 2024 @03:55AM (#38949583)
See "Use of null-restricted types" which is part of Project Valhalla[0], the proposed syntax is the opposite of Kotlin, where everything is non-null by default but can be made nullable by adding a "?", eg "val s: String? = null".

The Java version instead looks like this, where you add an exclamation mark to mark it as non-nullable:

    class Cursor {
        private Point! position;
    }

[0] https://bugs.openjdk.org/browse/JDK-8251554
Re:The golden age of Kotlin and its uncertain future by brabel on Thursday January 11, 2024 @06:52AM (#38951037)
Ok, but notice that's not about making Java null-safe in any sense. It's about making "value types" (which will be introduced by Project Valhalla) possibly non-null, mostly for optimization purposes (though it should also benefit programmers reason about value types if they can't be null).

As mentioned in the relevant JEP[1]:

"A null-restricted type is a reference type expressed with the name of a value class followed by the ! symbol."

Goals: "Allow a value class to "opt in" to the automatic creation of an appropriate default value used to initialize fields and arrays that don't store null."

Non-goals: "It is not a goal to support null-restricted types for identity classes or classes that do not provide a default value."

So, I don't see how that's in any way going to threaten Kotlin's position as a null-safe language - Java will almost certainly always have "unsafe" `null`, removing it from Java seems simply impossible at this point (notice that Dart managed to do it, but it had a much, much smaller ecosystem than Java, and even then, it required multiple years of migration of every single Dart package in Pub - and the ones that were unmaintained were simply abandoned and no longer work with the latest versions of Dart which is fully null-safe).

[1] https://openjdk.org/jeps/8316779

Re:The golden age of Kotlin and its uncertain future by MrBuddyCasino on Thursday January 11, 2024 @07:05AM (#38951133)
I actually missed that it was restricted to value classes, thanks for the correction, this is unfortunate. To be fair null-checking (or just documenting null-safety) the data classes is the main use case, as other cases of nullability (class collaborators, eg a repository injected into a service) are usually a bug and quickly fixed.

The data that flows through the app at runtime is the big issue, and even just documenting null-safety at the API interfaces goes a long way in making refactorings safer and maintenance less of a pain. Those are usually records nowadays (DTOs, VOs, Entities).

Re:The golden age of Kotlin and its uncertain future by switch007 on Thursday January 11, 2024 @03:04AM (#38949192)
Will they cherry pick Kotlin’s null safety…?
Re:The golden age of Kotlin and its uncertain future by cryptos on Thursday January 11, 2024 @03:28AM (#38949366)
No, they will allow to mark types as explicitly not null (the other way around). The default in Java will still be that everything can be null.
Re:The golden age of Kotlin and its uncertain future by pharmakom on Thursday January 11, 2024 @02:35AM (#38948958)
Syntax may be overrated but expressiveness is not.