Ok, I think I will have difficulties to show you the problem.
I give you an other example: Yesterday, I sent you a message on this forum (the request). Yesterday or today, each one answered me by a message (the answer). Now, the question is: who read the messages, me or the messages themself? I think it is me, no? In fact, I just consider Request and Response classes as "transport" classes. They go from point A to point B. That is only their job. So the rendering of the response should not be done by the response it self, IMO. That's why I purpose this change. Nicolas have read in my thoughts. On 28 nov, 17:30, Nicolas A. Bérard-Nault <[email protected]> wrote: > 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
