Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public properties issue? #124

Closed
jim-parry opened this issue Jun 25, 2016 · 2 comments
Closed

Public properties issue? #124

jim-parry opened this issue Jun 25, 2016 · 2 comments

Comments

@jim-parry
Copy link
Contributor

A user on the IRC channel (crazywane) seems to think that public properties are a problem?
https://gist.github.com/Golpha/c64bc7a67db1ed9463f7fec13e1e6f4c

@lonnieezell
Copy link
Member

I can't see how. When used with intention, the public property is part of the class' contract. That link only shows a "high-performance" way to bypass said contract. I put high-performance in quotes because accessing a public property is still faster. :)

I have come across the rule in the past that "ALL THE THINGS MUST BE PROTECTED". And I usually fall into the camp that says that any rule that includes the words "all of the time", "always", "never", etc, is going to be wrong at some point. I agree in general that things should be protected, with getter/setter methods, and I have done it that way through the vast majority of the framework. When things are public, they typically needed to be that way for a reason.

@jim-parry
Copy link
Contributor Author

Good to know. I won't lose any sleep over 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

No branches or pull requests

2 participants