private methods

My privates are not public, they are protected - Stefan Koopmans...

Planet PHP  Sun, 07/18/2010 - 13:28

This week there was an interesting discussion on twitter between several people from the PHP community on the use of access modifiers, and why things should be public, protected or private, or why not.

The thing that triggered this was the fact that the new Symfony2 Coding Style disallows the usage of private methods.

This discussion earlier on triggered Lukas Smith to post his opinion. I commented there but the comment became thus long that I decided to write a blogpost about it myself.


 

Red tape and the art of ripping through it - Lukas Smith

Planet PHP  Sun, 07/18/2010 - 10:06

It seems like the Symfony2 CS is forbidding the use of private methods.

I think other frameworks have similar rules. Now I have argued along those lines myself in the past. But especially talking to the Doctrine2 dev's got me to reconsider .. a bit.

This all kinda of reminds me about the discussion over making it a fatal error to change method signatures during inheritance.


 

Chance Garcia's Blog: Visibility and inheritance

PHPDeveloper.org  Wed, 08/12/2009 - 08:40

In this recent post to his blog Chance Garcia looks at visibility and inheritance in PHP applications.

Specifically, it references a question that came up on IRC about the "default" visibility for methods and the open/closed principle.