4 ms·
Some of the newer Java features are really nice for this: sealed interfaces, records, sealed interfaces, and record pattern matching
by Eldt 2mo ago
Some of the newer Java features are really nice for this: sealed interfaces, records, sealed interfaces, and record pattern matching
- sshine 2mo agoDon't forget sealed interfaces! I would say the killer features are records and pattern matching. Sealed interfaces/classes seem to mostly compensate for hypermobility caused by inheritance (that you can modify a superclass'es behavior and break abstraction boundaries). Stop relying on inheritance, and you don't really need sealed interfaces. Using records and thus lowering mutable state makes the problem of breaking abstraction boundaries lesser as well. This is a hot take paid for by the functional programming lobby.