# Getter methods good practices?

**URL:** <https://forum.kirupa.com/t/getter-methods-good-practices/306216>\
**Category:** Uncategorized\
**Created:** [March 11, 2010, 9:19am UTC](https://forum.kirupa.com/t/getter-methods-good-practices/306216 "2010-03-11T09:19:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stratboy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/stratboy/32/3054_2.png) [@Stratboy](https://forum.kirupa.com/u/Stratboy)\
**Post date:** [March 11, 2010, 9:19am UTC](https://forum.kirupa.com/t/getter-methods-good-practices/306216/1 "2010-03-11T09:19:56Z")

</div>

Hi!

I was wandering… If I’ve got a getter method, say a(), that returns the private variable \_a. Obviously from outside the class I call instanceOfClass.a. But from inside the class, should I use the getter or directly \_a? Suppose I’m writing a method that uses \_a: should I use \_a or a? var b = a; or var b = \_a?  
Maybe for performance reasons it’s better to directly access \_a? Or since there’s a getter a(), it’s a good practice using always and only the getter?

:write:
