FlameDuck:
a) set methods are useful to perform error checking, other validation, or secondary functions when a variable is set. In my 'position' example, it may be useful to check for collision or bound when setting the x or y coordinate.
b) there may be a time in the future where you realize that a single property field was not the best way of handling the data. Maybe you realize that the data needs to come from a different place, like a contained member, to weed out redundancy, or that it needs to be calculated on the fly. In this case, using a get method instead of simply accessing the variable directly allows you to change how the value is handled behind the scenes without changing any of your source that uses the type/module in question.
Separation of interface and implementation is GOOD.
a) set methods are useful to perform error checking, other validation, or secondary functions when a variable is set. In my 'position' example, it may be useful to check for collision or bound when setting the x or y coordinate.
b) there may be a time in the future where you realize that a single property field was not the best way of handling the data. Maybe you realize that the data needs to come from a different place, like a contained member, to weed out redundancy, or that it needs to be calculated on the fly. In this case, using a get method instead of simply accessing the variable directly allows you to change how the value is handled behind the scenes without changing any of your source that uses the type/module in question.
Separation of interface and implementation is GOOD.