Hi,

there is a simple reasoning for making as much as possible private and
there was a lengthy discussion.

the reasoning goes something like this:

public and protected methods and properties are accessible for
developers using the framework. their code becomes dependant on that
interface.
to avoid breaking BC these accessible methods and properties can not
be changed for future releases.

private methods however can be changed as no code other than framework
code can use them.

so the more public/protected the symfony interface gets the more api
code needs to be maintained and is in fact set in stone.

the current approach is to make as much as possible private but to
reopen some of the code upon request when there is a good reasoning.


cheers
/christian


On 9 Mrz., 08:29, Martin Hasoň <[email protected]> wrote:
> Hi,
> In recent commits has been moved most protected methods and properties to
> private. I think it's completely unnecessary step. In PHP I dislike the
> keywords private and final (I hate their implementation in PHP). Why?
> Private methods prevent reuse of code and keyword final kills reuse of code.
> Real private methods do'nt exist in Python and Ruby (it is possible to 
> callprivate methods or
> overload them). In my opinion, framework should have almost no private 
> methods.
> I don't want to use the class composition for every little thing.
>
> My tip: how to change value of private property in PHP 5.3 > ?
>
> class A {
>     private $a;
>
>     public function __construct() {
>         $this->a = new Foo(); //only one poorly designed place in class
>     }
>
> }
>
> class B extends A {
>     public function __construct() {
>         $reflection = new ReflectionProperty('A', 'a');
>         $reflection->setAccessible(true);
>         $reflection->setValue($this, new FooBar());
>     }
>
>
>
>
>
>
>
> }

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to