Re:Moving Java Forward Faster
by stickfigure on Thursday September 07, 2017 @01:47AM
(#15189392)
Nothing in OOP requires mutable state.
When you start writing code like this, Java can be quite pleasant.
[ Parent
| on HN ]
It's only very special circumstances where my POD types do not consist entirely of `final` fields. Though I usually skip defensive copying within PODs... One should know better than to trust values from random places. So I defensively copy at use time instead if I want to modify it.
Kotlin, Java's superior offspring, is even better, as the use of data classes provides an automatic implementation of a `copy` command. (Scala does too, but Scala also explodes when I look at it, so, enh.)