News Feed
Sections




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

Ivo Jansch's Blog:
Good use of public, private and protected in OO class design
July 19, 2010 @ 10:57:14

In a new post to his blog Ivo Jansch responds to some of the recent comments about scoping in PHP applications with some thoughts of his own (someone spurred on by the Symfony project saying that "private is evil").

I don't care much about Symfony as I'm not a user, but it turned to a discussion on OO theory when Stefan defended the position by claiming that you 'should have the right to extend a class's methods if it doesn't support the use case you have'.

He also mentions the agreeing opinions of Marco Tabini and Travis Swicegood. Ivo gives an example of a piece of code that uses all three states - public, protected and private - as a use case for his later statements. In his opinion, removing the private/protected scoping from the picture only helps those looking to make it easier to derive information from the class rather than fine-tuning what can be called.

Be sure to read the comments on this one - there's lots of great thoughts from community members in there.

0 comments voice your opinion now!
public private protected scope opinion use unittest


blog comments powered by Disqus

Similar Posts

Court Ewing's Blog: How PHP is Broken and How It Can Be Fixed

Sebastian Bergamnn's Blog: SeleniumTestCase Improvements in PHPUnit 3.2

Kamran Usman's Blog: Zend is going the Wrong Way I think

Test.ical.ly Blog: PHP 5.3 and the Symfony2 UniversalClassLoader - Where to load?

Chris Hartjes' Blog: How the Testing Sausage Gets Made


Community Events





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


interview symfony community voicesoftheelephpant conference release language podcast api laravel bugfix introduction tips list series developer framework library deployment zendserver

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