L
Lionel
One thing I have been pondering is where should errors be caught and
checked.
Say I have a JTable and it has rows with a cell for each of the
variables a, b, and c in an instance of the class VariableClass. If a
can only have a value >= 0 I currently only check this when the user
enters the value, the class VariableClass assumes it gets a correct
entry. I have done this quite successfully.
However I'm wondering if just checking user input is enough? Should I
check the values when the instance of VariableClass is instantiated and
when setters are used? Then should I perhaps throw an exception or
handle it some other way?
Thanks
Lionel.
checked.
Say I have a JTable and it has rows with a cell for each of the
variables a, b, and c in an instance of the class VariableClass. If a
can only have a value >= 0 I currently only check this when the user
enters the value, the class VariableClass assumes it gets a correct
entry. I have done this quite successfully.
However I'm wondering if just checking user input is enough? Should I
check the values when the instance of VariableClass is instantiated and
when setters are used? Then should I perhaps throw an exception or
handle it some other way?
Thanks
Lionel.