News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Stefan Koopmanschap's Blog:
My privates are not public, they are protected
July 19, 2010 @ 13:58:12

Stefan Koopmanschap has spoken up in response to some of the comments about OOP design, specifically in using the private scope in your applications. Overall, Stefan agrees and thinks that this access prevents possible extension which goes against the whole point of writing open source software.

I agree with pro-private people that it is important to have a good API design and to use that to protect less experienced developers from making mistakes, however one should never assume that the developers using your libraries, especially Open Source libraries, are less than yourself. [...] I definitely am not in favor of simply opening up the complete library to every developer though. By making a clear decision on which methods are public and which methods are protected you will ensure that people simply implementing your library will use the API that you have taken the time designing.

His does note, however, that there are cases when a private scope is valid - usually when it involves a planned, architected product where it is someone's responsibility to have that access controlled.

0 comments voice your opinion now!
private protected scope access modifier opinion


blog comments powered by Disqus

Similar Posts

Slava Vishnyakov: PHP the Nice Way (Ever-evolving Huge Retailer Website Story)

Brian Jones' Blog: If You Code, You Should Write

DevShed: Defining Public and Protected Methods with Member Visibility in PHP 5

CohereCommunity.com: Where (And Why) Do Communities Happen?

Liip Blog: Of HHVM, Hack and the future of PHP


Community Events











Don't see your event here?
Let us know!


release facebook unittest symfony2 podcast opinion component install introduction package security composer series language application hack hhvm database framework performance

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework