# Why should I use "get"/"set" functions?

**URL:** <https://forum.kirupa.com/t/why-should-i-use-get-set-functions/285983>\
**Category:** flash\
**Created:** [April 8, 2009, 2:00pm UTC](https://forum.kirupa.com/t/why-should-i-use-get-set-functions/285983 "2009-04-08T14:00:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpha\_Remex](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@Alpha\_Remex](https://forum.kirupa.com/u/Alpha_Remex)\
**Post date:** [April 8, 2009, 2:00pm UTC](https://forum.kirupa.com/t/why-should-i-use-get-set-functions/285983/1 "2009-04-08T14:00:23Z")

</div>

So I have been programming for two years and I have been using AS3 for about 5 months. I’m ready to start making my code a bit more sophisticated, so I’ve been getting into things like composition and design patterns.

With that in mind, I have been searching for coding standards that I can start implementing to clean up my code a bit. While searching for different ways to do this recently, I came across “get” and “set” methods.

So here is what I have been doing to make my variables changeable/retrieveable from other classes:

```auto

//getter
public function getSomething():String {
    return _something;
}

//setter
public function setSomething(setVar:String):void {
    _something = setVar;
}

```

Now, here is what I have recently found to be the standard:

```auto

//getter
public function **get** getSomething():String {
    return _something;
}

//setter
public function **set** setSomething(setVar:String):void {
    _something = setVar;
}

```

Notice the **only** difference is adding the words “get” and “set” to the signature…

So here’s my question: why does it matter if I add the words “get” and “set”? Does it change functionality at all, or is it kind of like binding a type to a variable in that it limits what the method can do?
