Do we need getters/setters in our code?
Tags: Coldfusion, Java
After reading an interesting discussion on whether we should use getters / setters, and the views that have been discussed. Which is also a little close to my heart as well, and in some way my logical thinking asks the same question. The thing is that I can actually see both sides of the story, and depending on the job I am doing I will go with the quickest option. But is the quickest option always the best option?Anyway if you haven't already read it, have a read it is a rather interesting discussion.
Why bother Getters & Setters
-
Well,
One of the things I love about ActionScript is implicit getters and setters. You can not use them, then if you need a getter or setter later you can add it without changing the references.
so
object.myVariable
would just access the public variable myVariable
public function get myVariable():String{<br /> return myVariable;<br />}
and object.myVariable now calls the getter, love to see that in ColdFusion.
# Posted By Dale Fraser | 10/9/08 5:56 PM -
@Dale. If I'm not mistaken, I'm pretty sure that implicit getters and setters has already been annouced as a new feature in CF9
# Posted By Tony Garcia | 10/10/08 3:50 PM -
<p>Not that I have seen, but I hope you are right.</p>
# Posted By Dale Fraser | 11/20/08 7:13 PM



TweetBacks