What's better, an empty non-nullable string or a null and nullable string?
Every Employee has a name, but not necessarily a boss. The CEO, at least, doesn't have one.
We then have two options. We could pinch our nose at using String? and minimize its use by writing String boss
class Employee {
String name;
String boss;
}
but that means that boss will sometimes be an empty string.
Or we could use String?
class Employee {
String name;
String? boss;
}
and pinch our nose at the continuing use of null to signal the lack of a boss.
What's better, an empty non-nullable string or a null and nullable string?
This is a sequel to an earlier question.
from Recent Questions - Stack Overflow https://ift.tt/3CqJ7Fy
https://ift.tt/eA8V8J
Comments
Post a Comment