Scala getters/setters - best practice?
问题 I'm Java SE/EE developer, but beginner in Scala. In Java, when I have some private fields which should be accessible to other code, I use getX() / setX() classic style of getters/setters. However, not sure how about Scala. I noticed that in Scala, naming convention of getter/setter for field is to use the same name as the field's one. So is it OK to simply set the field public , or should I use this style of getter/setter?: private var _value = ..... def value = _value def value_= (newVal:Int