I was rather thinking of the case where you just put a get and a set
methods. Those are the only 2 properties exposed and all the rest is
"protected".

On Fri, Aug 26, 2011 at 10:49 PM, Scott Sauyet <[email protected]> wrote:
> xavierm02 wrote:
>> I'm doing a lib of my own, mostly to learn more about JavaScript and one of
>> the things I like is having a minimum of things available from outside my
>> objects.
>> Therefore, I use getters and setters.
>
> Right off the bat, I don't follow how this means having a minimum of
> things available from outside an object.  If you have an object `foo`
> with one property `bar`, how does using `foo.getBar` and `foo.setBar`
> minimize your surface area?  If your setters and getters do nothing
> more than setting and getting a property, you haven't encapsulated
> private data, and you have actually increased the size of the
> interface exposed by your object.
>
> As a learning exercise for the language, the techniques you discuss
> might be useful.  But I'm not sure I really see the real-world
> application of them.
>
>  -- Scott
>
> --
> To view archived discussions from the original JSMentors Mailman list: 
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here: 
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to