PDA

View Full Version : Best practice question : set and get



JFFortierQc
6 Dec 2011, 10:00 PM
Very simple question
Using set and get instead of the this.data.MyFieldsVar in a Model. I know that from the external of a Class we should always use the set and get just in case. But inside the Model, I don't find the advantage if the set and get does nothing else then a return. Accessing the var itself may be faster (milliseconds), I think.

Well, its more a discussion then a question, but always looking for best practice when there is a good reason to do something.

AndreaCammarata
9 Dec 2011, 9:49 AM
I actually prefer to always use the get and set functions.
However, inside a model could be also logically correct to use this.data...