DEV Community

Discussion on: Avoid getters and setters whenever possible

Collapse
 
xtabdeveloping profile image
Márton Kardos • Edited

Yeah, one of my friend does this thing constantly in Scala, where basically all the fields he creates are immutable val-s. So there exists an immutable field, as well as a getter for it, which doesn't make sense at all, especially because the functional approach implies, that an immutable variable is basically the same as a constant function.