This is an interesting problem.
As a bit of background, the idea of the Aura.Framework package is to provide the glue between the various Aura packages and bind them into a coherent framework.
Now, I can see where people would want to switch out the view engine and use the one of their choice (e.g. Twig). We could in theory allow for that by changing the signature of `setView()` from `setView(TwoStep $view)` to just `setView($view)`. Then you could extend the AbstractPage and override the `setView()` method, without getting an E_STRICT error about the signature. You'd need to override `render()`, too.
However, I can also see where people would want to use their own signaling mechanism, too. That would mean changing setSignal(), along with all the methods that use a call to `$this->signal`.
And for the router.
And for the inflector.
So, while it seems like we should "make room" for other view engines in Aura\Framework\Web\AbstractPage, it opens the door to a lot of other things that would be difficult to be flexible for.
Maybe the real answer to all this is to extract the routing, inflecting, etc. behaviors to completely separate objects, but that is a level of abstraction that I'm not ready to tackle right now.
I'm happy to continue the discussion, though; I (or someone else) may think of a good solution here.
Hope that all makes sense.
-- pmj
This is an interesting problem.
On Apr 9, 2012, at 7:54 PM, Hari K T wrote:
> Hey guys,
>
> I was trying to incorporate Twig with Aura .
>
> I feel its a good idea to remove the setView from Aura Framework AbstractPage.php .
>
> And we can extend this class to make any type of view .
>
> Else I feel it will be binded with Aura.View and Di will try to inject it . As we are using another view , I feel the user don't need Aura.View itself .
>
> If we are not moving that particular method , the users needs to copy almost the same methods .
>
> Is there any better way to do else ?
>
> You can see still a work / try in progress
>
> https://gist.github.com/2345593
>
> Let me know your thoughts on this . As I don't want to break the API , I feel we can make this AbstractPage as the base itself and add another class as a middle one .
As a bit of background, the idea of the Aura.Framework package is to provide the glue between the various Aura packages and bind them into a coherent framework.
Now, I can see where people would want to switch out the view engine and use the one of their choice (e.g. Twig). We could in theory allow for that by changing the signature of `setView()` from `setView(TwoStep $view)` to just `setView($view)`. Then you could extend the AbstractPage and override the `setView()` method, without getting an E_STRICT error about the signature. You'd need to override `render()`, too.
However, I can also see where people would want to use their own signaling mechanism, too. That would mean changing setSignal(), along with all the methods that use a call to `$this->signal`.
And for the router.
And for the inflector.
So, while it seems like we should "make room" for other view engines in Aura\Framework\Web\AbstractPage, it opens the door to a lot of other things that would be difficult to be flexible for.
Maybe the real answer to all this is to extract the routing, inflecting, etc. behaviors to completely separate objects, but that is a level of abstraction that I'm not ready to tackle right now.
I'm happy to continue the discussion, though; I (or someone else) may think of a good solution here.
Hope that all makes sense.
-- pmj
This is an interesting problem.
As a bit of background, the idea of the Aura.Framework package is to provide the glue between the various Aura packages and bind them into a coherent framework.
Now, I can see where people would want to switch out the view engine and use the one of their choice (e.g. Twig). We could in theory allow for that by changing the signature of `setView()` from `setView(TwoStep $view)` to just `setView($view)`. Then you could extend the AbstractPage and override the `setView()` method, without getting an E_STRICT error about the signature. You'd need to override `render()`, too.
However, I can also see where people would want to use their own signaling mechanism, too. That would mean changing setSignal(), along with all the methods that use a call to `$this->signal`.
And for the router.
And for the inflector.
So, while it seems like we should "make room" for other view engines in Aura\Framework\Web\AbstractPage, it opens the door to a lot of other things that would be difficult to be flexible for.
Maybe the real answer to all this is to extract the routing, inflecting, etc. behaviors to completely separate objects, but that is a level of abstraction that I'm not ready to tackle right now.
Maybe what we need here is a RenderStrategy class (this would be a new class in the Web package). By default, it does nothing. Then instead of setView() and a render() method, we have a setRenderStrategy() in the controller, and pass in a RenderStrategy object of our choosing. The render() method then just calls the RenderStrategy and hands off to it entirely. Voila: you can have an AuraViewRender, a TwigRender, a MustacheRender, etc.