I have a Scala domain class (intended for persistence to database)
like:
class Foo() {
var bar: Long = _ // or None or null ???
var jaz: String = _ // or None or null or empty string "" ???
}
How the answer is influenced if the fields bar and jaz are required fields as opposed to
being optional?
From Programming in Scala:
So your code above is the same as
Kim’s answer sounds correct – if a field is optional, make it an Option, if not, make the constructor set it.