You need to sign in to do that
Don't have an account?
rucha
Variables vs Properties
Hi,
When should one use variables and when should properties be used? Does one have a technical advantage over other?
Thanks
Rucha
Jake Gmerek
Basically there is little technical difference between the two and really the decision should be based on code readability and reuse. My personal rule of thumb is that if I am going to use an object in more than one method I make it a property, but any object that is only used in one method I just use a variable for.
phani kumar 95
to add to above, another difference i found : if you have a controller class: properties are accissible from visual force pages (ex: {!class.property}) and variables are not.
phani kumar 95
yet another : if you are using variables, then you must have public getters/setters to use them in visulaforce page.the public properties are avaialble directly on apex pages.