Skip to content

Conversation

paolocarrasco
Copy link
Contributor

Hi @hshoff,
Don't you think that binding a private variable to the this object makes the variable/property be public? Although the name makes it obscured, a new team member could access to these members and change them directly. It'd be better to deny that possibility.
http://javascript.crockford.com/private.html

@paolocarrasco
Copy link
Contributor Author

any comment about this issue? is it ok to consider private a property that could be accessed from outside?

@hshoff
Copy link
Member

hshoff commented Jan 2, 2014

This is one of those conventions that is specific to us at Airbnb. It's true that they aren't truly private properties when attached to this. When you have a convention in place to indicate that something is a private property and messing with it can have unspecified consequences and everyone on the team honors it, we've found it can work well and is easily explained to future developers that might not be well-versed in javascript.

It just depends on how you're team wants to handle private properties. For us, we like to keep it simple like this.

🍻

@hshoff hshoff closed this Jan 2, 2014
@paolocarrasco
Copy link
Contributor Author

👍

@netpoetica
Copy link

@hshoff #145 (comment) major +1 on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants