News for hackers. Stuff that matters.
Re:Java 26 is here, and with it a solid foundation for the f... by lucketone on Tuesday March 17, 2026 @05:08PM (#47418344)
> for not embracing religion of OOP and FactoryFactory

Not the case today. Of course, crappy code (or questionable patterns) can be found in all languages, and java community had made some innovations in the area early on, but today we have a different picture.

FactoryFactory has gone mostly extinct, the most likely place to see it is “dailywtf.com”.

We now know that we prefer composition over inheritance, we have stream api - language and community evolved, old patterns are not neccessary anymore to solve same/similar problems.

Sample of one - junit (testing lib) source code, from quick glance it seems more procedural than dogmatic OOP: https://github.com/junit-team/junit-framework/blob/main/juni...

Re:Java 26 is here, and with it a solid foundation for the f... by dmix on Tuesday March 17, 2026 @09:18PM (#47420546)
It's still going to be hard to overcome the stigma of ex-Java developers coming into other languages and bringing their overly complex ideas with them. But I am happy to hear Java itself is evolving and I hope that limits the downstream effects of it being one of the most popular language a lot of devs start on.
Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Tuesday March 17, 2026 @10:25PM (#47420938)
> We now know that we prefer composition over inheritance

When people say "composition over inheritance" in Java discussions, they usually mean the trivial modeling rule: prefer has-a over is-a.

But that’s not what composition is really about.

The deeper idea is interface composition -- building types by composing multiple behavioral contracts behind a single cohesive surface.

Java provides inheritance and interfaces, but it doesn’t provide first-class delegation or traits. So most developers never really practice interface composition. They either subclass, or they wire objects together and expose the wiring.

The slogan survived. The concept mostly didn’t.

The manifold project, for example, experiments with language-level delegation to make interface composition practical with Java.

https://github.com/manifold-systems/manifold/blob/master/man...

Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @03:11AM (#47422501)
Well, what mainstream language has better tools for composition?
Re:Java 26 is here, and with it a solid foundation for the f... by fingerlocks on Wednesday March 18, 2026 @04:11AM (#47422982)
Rust with traits and Swift with protocols
Re:Java 26 is here, and with it a solid foundation for the f... by gf000 on Wednesday March 18, 2026 @04:52AM (#47423257)
So just type classes?

How does a type class help with composition? They do help with the expression problem (adding support for an "interface" after definition), and via parametric polymorphism they might give you a bit with regards to composing two traits.. but you do also have generics in Java, even if not as good as type classes.

So anyways, I don't see as big of a change here. But there was a Brian Goetz mail/presentation somewhere where he talked about adding "basically type classes" to Java? But unfortunately I couldn't find it for you now.

Re:Java 26 is here, and with it a solid foundation for the f... by joe_mwangi on Saturday March 28, 2026 @06:54AM (#47553424)
Re:Java 26 is here, and with it a solid foundation for the f... by megapoliss on Wednesday March 18, 2026 @07:50AM (#47424510)
kotlin
Re:Java 26 is here, and with it a solid foundation for the f... by owlstuffing on Wednesday March 18, 2026 @03:36PM (#47430413)
Kotlin's "delegation" feature isn't true delegation, it's just call forwarding, which is better than nothing, but it falls down pretty quickly as an alternative to implementation inheritance.

The manifold project provides true delegation[1] for Java.

1. https://github.com/manifold-systems/manifold/blob/master/man...

Re:Java 26 is here, and with it a solid foundation for the f... by haspok on Wednesday March 18, 2026 @06:01AM (#47423658)
> Java provides inheritance and interfaces, but it doesn’t provide first-class delegation or traits.

I'm not sure I am missing first class delegation much (not a lot of UI projects in Java these days).

But interfaces with default (and static) method implementations are actually quite usable as traits / mixins. Since Java 8 IIRC.

You can also pass around functions / lambdas (coincidentally also since Java 8) to compose functionality together. A bit harder to follow and/or understand, but another perfectly legitimate and very powerful tool nevertheless.

Re:Java 26 is here, and with it a solid foundation for the f... by chii on Tuesday March 17, 2026 @11:20PM (#47421258)
> FactoryFactory has gone mostly extinct

it really depends on your project, and what framework(s) and libraries you choose to use.

Java still has a tonne of legacy projects using old(er) frameworks that rely on such patterns - spring has some old versions which is like that, and i am certain plenty of java projects are retaining those old versions due to lack of desire to upgrade.

If you're starting a greenfield development in java, you surely would not befall into that factoryfactory pattern (unless you're just copy/pasting old projects around...). But i imagine there's way fewer greenfield projects compared to older projects requiring maintenance.