Suppose I have a class Foo, with a private variable bar_ containing some state for Foo. If necessary, I may write public get/set metho
get/set should only be necessary when there is some sort of invariant, precondition or postcondition that must be upheld by the class. If the modification of the value doesn't have a 'ripple effect' throughout the rest of the class then the user should be able to modify it directly. However if changing the value will cause something else to happen (e.g., changing a cache size might cause cached items to be purged) then get/set is appropriate.