On Sun, Nov 28, 2010 at 10:49 AM, Fabien Potencier <
[email protected]> wrote:

>
> On 11/28/10 1:53 PM, Jordi Boggiano wrote:
>
>> On Sat, Nov 27, 2010 at 4:36 PM, Lukas Kahwe Smith<[email protected]>
>>  wrote:
>>
>>> Now, translate this example with the HttpKernel component:
>>>>
>>>> Actual code:
>>>> $kernel = new AppKernel('prod', false);
>>>> $kernel->handle(new Request())->send();
>>>>
>>>> Future code:
>>>> $kernel = new AppKernel('prod', false);
>>>> $response = $kernel->handle(new Request());
>>>> $kernel->send($response);
>>>>
>>>
>>>
>>> just looking at the two above versions i agree i like the second one
>>> better.
>>>
>>
>> I have to disagree here. You don't need a Kernel to send a response.
>> The last line could be $response->send() and still it'd be clear. The
>> clarity comes from expanding it in 3 lines imo, not from the fact that
>> the Kernel has a send() method added.
>>
>
> exactly. The Response should be decoupled from the Kernel. You should be
> able to send a Response without a Kernel.
>

I have to agree with the original poster here. The S in SOLID [1] stands for
"Single responsability" [2]. Robert Martin phrases this as "A class should
have one, and only one, reason to change" [3].

Currently, the Response class has more than one responsibility. It is the
envelope, the content and the mailman. Although I'm not sure where the
"send" operation should occur because of my limited knowledge of the
framework's internals, I am pretty sure it's neither in the kernel nor the
Response class.

NABN.

[1] http://en.wikipedia.org/wiki/Solid_(object-oriented_design)
[2] http://en.wikipedia.org/wiki/Single_responsibility_principle
[3] http://www.objectmentor.com/resources/articles/srp.pdf

>
> Fabien
>
>  Cheers
>>
>>
> --
> 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]<symfony-devs%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
>



-- 
Nicolas A. Bérard-Nault ([email protected])

-- 
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