Re:New Features in Java 14
by dmitriid on Wednesday March 04, 2020 @02:13AM
(#22481803)
Can't understand the need for records when C# solves the problem of boilerplate with regular classes and some syntactic sugar.
[ Parent
| on HN ]
Apparently immutable classes in a functional streams is a new hotness and nobody uses POJOs anymore. They'll slap pattern-matching on top of that, to complete the circle.
I completely agree as I, myself, see very few instances where I could use records in my code. But properties to remove getter/setter boilerplate? That would remove thousands of LoC. But it's not hot.
Fashion-driven development, that is.
It's an easy and zero-boilerplate way to have immutable data-only structures with some useful tidbits like structural comparison, meaningful hashcodes etc.
I say this as a C# developer that would desperately want them supported in C# and was super pissed off when they were discarded from C# 8.0 (I actually need them right now, they would save me a whole day of typing today)
Records are coming https://github.com/dotnet/csharplang/projects/4#card-1849391.... Will be in C# 9