Hi folks,
I was writing some python classes the other day, and created a class like this:
class Option:
Name = ""
Description = ""
Criteria = {}
def __init__(self, name, descr):
self.Name = name
self.Description = descr
def addCriteria(self, cname, ctype):
...
In my program, I was accessing the data in the class directly, i.e.:
cname = opt.Name
While this was a conscious decision, I know a lot of classes would have abstracted this as:
cname = opt.getName()
Should I have taken the time to abstract all the data and not allow direct access? What triggers when you would add access methods for class data?
Mike