Separate names with a comma.
Discussion in 'Mac Programming' started by Darkroom, Jun 13, 2010.
i can never remember what is the other term for getters and setters. what is it?
accessors and mutators.
No. You should probably look that up.
Mutators just sounds so dark and scary!
Well, I know pointers and setters are hunting dogs, maybe getters should be renamed fetchers?
hahaha alrighty... sorry for the mistake. but setting up an iVar as a property and synthesizing it should provide you the setters and getters hehehe thats what I was thinking.
I know they're often useful and unavoidable, but when i was being taught OOP they were supposed to be scary. At the time the context was that you had a private/protected variable (if it was public, it would just be accessed directly... not good design, but this was the context we were given) that could be set using a public mutator. To me this seemed like nonsense, if you are letting the variable be set with a public method, why not just make the member public?
Obviously encapsulation, being able to change private variable names, types, etc. in the future, having a standard interface, etc. is the answer, but in this particular course those things were more ephemeral.