You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rave.apache.org by Erin Noe-Payne <er...@gmail.com> on 2013/08/28 23:31:23 UTC

[Proposal] Use Restangular over $resource

Hey All,

Based on our discussion surrounding RAVE 1048 [1], I was looking at
how to improve our resource functionality to support PUT operations. I
came across the Restangular library [2], which offers an alternative
to ngResource. Restangular resources provide out of the box support
for PUT and PATCH methods, and return promises rather than empty
objects, which means they work better with the resolve arguments for
routing and controllers.

I'm going to try it out and submit a patch with the changes so anyone
who is interested can compare - but weigh in now if you have any
opinion.

Erin

[1] https://issues.apache.org/jira/browse/RAVE-1048
[2] https://github.com/mgonto/restangular

Re: [Proposal] Use Restangular over $resource

Posted by Chris Geer <ch...@cxtsoftware.com>.
Erin,

Thanks for the update. I think that is a good path forward.

Chris


On Fri, Aug 30, 2013 at 10:48 AM, Erin Noe-Payne
<er...@gmail.com>wrote:

> Ok, so I ran through a trial using Restangular and using the angular
> 1.2 release candidate's $resources.
>
> My complaints about restangular are that it feels a bit heavyweight
> for what we need, and that it makes me think about my models in http
> terms - all of the verbs in the api are .put, post and so on. Overall
> it gives good functionality but doesn't feel like a great fit -
> especially since by 1.2 all of the compelling arguments for using it
> mostly go away.
>
> 1.2 $resources cover what we need well, but unfortunately the 1.2
> release is not stable yet. Some fundamental functionality is broken,
> and I think it doesn't make sense to put us on snapshot builds at this
> point.
>
> In the end I've gone with us putting us on angular 1.1.5. I've written
> a base RaveResource class that delegates to $resource and implements
> the common functionality to all resources - an update method with PUT,
> the processing of api responses to remove the wrapper and so on. This
> does leave us with some future technical debt, in the sense that
> routing resolver is manually making promises at the moment. If / when
> 1.2 is stable and we choose to upgrade, we can simplify that code by
> using the resources exposed $promise attribute.
>
> On Thu, Aug 29, 2013 at 12:42 PM, Rohit Kalkur <ro...@gmail.com>
> wrote:
> > This looks like a really robust library for resources Erin! Has some
> > additional types of methods you can call on a promise as well. Looks like
> > it would be at least worth trying.
> >
> >
> > On Thu, Aug 29, 2013 at 11:31 AM, Michael Jett <mi...@gmail.com>
> wrote:
> >
> >> Good find Erin. I think this is definitely something worth exploring.
> >> "Restangular supports method chaining to build complex requests."
> (drool)
> >>
> >>
> >> On Thu, Aug 29, 2013 at 11:02 AM, Erin Noe-Payne
> >> <er...@gmail.com>wrote:
> >>
> >> > On Thu, Aug 29, 2013 at 1:28 AM, Chris Geer <ch...@cxtsoftware.com>
> >> wrote:
> >> > > On Wed, Aug 28, 2013 at 7:06 PM, Erin Noe-Payne <
> >> > erin.noe.payne@gmail.com>wrote:
> >> > >
> >> > >> Yeah all good points Chris. We are on 1.0.x which is officially the
> >> last
> >> > >> stable release, but maybe it makes sense to go to 1.1.6.
> >> > >>
> >> > >
> >> > > Erin, I trust you guys will make the right decision here. I was just
> >> > wanted
> >> > > to pass along what he said. He also said he wanted to try the
> library
> >> you
> >> > > suggested so who knows, he might want to switch us over as well.
> >> > >
> >> > Maybe. I actually prefer the $resource api but it felt like it was
> >> > lacking a bit. 1.2 has a release candidate out now so I'm going to
> >> > give it a try and see how it compares.
> >> >
> >> > >>
> >> > >> On Wednesday, August 28, 2013, Chris Geer wrote:
> >> > >>
> >> > >> > On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <
> >> > >> erin.noe.payne@gmail.com<javascript:;>
> >> > >> > >wrote:
> >> > >> >
> >> > >> > > Hey All,
> >> > >> > >
> >> > >> > > Based on our discussion surrounding RAVE 1048 [1], I was
> looking
> >> at
> >> > >> > > how to improve our resource functionality to support PUT
> >> > operations. I
> >> > >> > > came across the Restangular library [2], which offers an
> >> alternative
> >> > >> > > to ngResource. Restangular resources provide out of the box
> >> support
> >> > >> > > for PUT and PATCH methods, and return promises rather than
> empty
> >> > >> > > objects, which means they work better with the resolve
> arguments
> >> for
> >> > >> > > routing and controllers.
> >> > >> > >
> >> > >> > > I'm going to try it out and submit a patch with the changes so
> >> > anyone
> >> > >> > > who is interested can compare - but weigh in now if you have
> any
> >> > >> > > opinion.
> >> > >> > >
> >> > >> >
> >> > >> > FYI - I asked my UI engineer about this seeing if he wanted to
> use
> >> it
> >> > >> > internally and this was his response for what it's worth.
> >> > >> >
> >> > >> > One thing to note is that we are using angular 1.1.5 and the code
> >> has
> >> > >> been
> >> > >> > written in a way to easily move to angular 1.2 once it is
> finalized.
> >> >  In
> >> > >> > angular 1.2 the $resource does return a promise making it a
> tough to
> >> > >> beat.
> >> > >> >  Also the core angular team has focused a lot on the $http and
> >> > $resource
> >> > >> > during the 1.2 development resulting in several breaking changes.
> >>  So
> >> > I
> >> > >> > would be concerned that this plugin may not be on the same
> course as
> >> > the
> >> > >> > angular team.
> >> > >> >
> >> > >> >
> >> > >> > >
> >> > >> > > Erin
> >> > >> > >
> >> > >> > > [1] https://issues.apache.org/jira/browse/RAVE-1048
> >> > >> > > [2] https://github.com/mgonto/restangular
> >> > >> > >
> >> > >> >
> >> > >>
> >> >
> >>
>

Re: [Proposal] Use Restangular over $resource

Posted by Erin Noe-Payne <er...@gmail.com>.
Ok, so I ran through a trial using Restangular and using the angular
1.2 release candidate's $resources.

My complaints about restangular are that it feels a bit heavyweight
for what we need, and that it makes me think about my models in http
terms - all of the verbs in the api are .put, post and so on. Overall
it gives good functionality but doesn't feel like a great fit -
especially since by 1.2 all of the compelling arguments for using it
mostly go away.

1.2 $resources cover what we need well, but unfortunately the 1.2
release is not stable yet. Some fundamental functionality is broken,
and I think it doesn't make sense to put us on snapshot builds at this
point.

In the end I've gone with us putting us on angular 1.1.5. I've written
a base RaveResource class that delegates to $resource and implements
the common functionality to all resources - an update method with PUT,
the processing of api responses to remove the wrapper and so on. This
does leave us with some future technical debt, in the sense that
routing resolver is manually making promises at the moment. If / when
1.2 is stable and we choose to upgrade, we can simplify that code by
using the resources exposed $promise attribute.

On Thu, Aug 29, 2013 at 12:42 PM, Rohit Kalkur <ro...@gmail.com> wrote:
> This looks like a really robust library for resources Erin! Has some
> additional types of methods you can call on a promise as well. Looks like
> it would be at least worth trying.
>
>
> On Thu, Aug 29, 2013 at 11:31 AM, Michael Jett <mi...@gmail.com> wrote:
>
>> Good find Erin. I think this is definitely something worth exploring.
>> "Restangular supports method chaining to build complex requests." (drool)
>>
>>
>> On Thu, Aug 29, 2013 at 11:02 AM, Erin Noe-Payne
>> <er...@gmail.com>wrote:
>>
>> > On Thu, Aug 29, 2013 at 1:28 AM, Chris Geer <ch...@cxtsoftware.com>
>> wrote:
>> > > On Wed, Aug 28, 2013 at 7:06 PM, Erin Noe-Payne <
>> > erin.noe.payne@gmail.com>wrote:
>> > >
>> > >> Yeah all good points Chris. We are on 1.0.x which is officially the
>> last
>> > >> stable release, but maybe it makes sense to go to 1.1.6.
>> > >>
>> > >
>> > > Erin, I trust you guys will make the right decision here. I was just
>> > wanted
>> > > to pass along what he said. He also said he wanted to try the library
>> you
>> > > suggested so who knows, he might want to switch us over as well.
>> > >
>> > Maybe. I actually prefer the $resource api but it felt like it was
>> > lacking a bit. 1.2 has a release candidate out now so I'm going to
>> > give it a try and see how it compares.
>> >
>> > >>
>> > >> On Wednesday, August 28, 2013, Chris Geer wrote:
>> > >>
>> > >> > On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <
>> > >> erin.noe.payne@gmail.com<javascript:;>
>> > >> > >wrote:
>> > >> >
>> > >> > > Hey All,
>> > >> > >
>> > >> > > Based on our discussion surrounding RAVE 1048 [1], I was looking
>> at
>> > >> > > how to improve our resource functionality to support PUT
>> > operations. I
>> > >> > > came across the Restangular library [2], which offers an
>> alternative
>> > >> > > to ngResource. Restangular resources provide out of the box
>> support
>> > >> > > for PUT and PATCH methods, and return promises rather than empty
>> > >> > > objects, which means they work better with the resolve arguments
>> for
>> > >> > > routing and controllers.
>> > >> > >
>> > >> > > I'm going to try it out and submit a patch with the changes so
>> > anyone
>> > >> > > who is interested can compare - but weigh in now if you have any
>> > >> > > opinion.
>> > >> > >
>> > >> >
>> > >> > FYI - I asked my UI engineer about this seeing if he wanted to use
>> it
>> > >> > internally and this was his response for what it's worth.
>> > >> >
>> > >> > One thing to note is that we are using angular 1.1.5 and the code
>> has
>> > >> been
>> > >> > written in a way to easily move to angular 1.2 once it is finalized.
>> >  In
>> > >> > angular 1.2 the $resource does return a promise making it a tough to
>> > >> beat.
>> > >> >  Also the core angular team has focused a lot on the $http and
>> > $resource
>> > >> > during the 1.2 development resulting in several breaking changes.
>>  So
>> > I
>> > >> > would be concerned that this plugin may not be on the same course as
>> > the
>> > >> > angular team.
>> > >> >
>> > >> >
>> > >> > >
>> > >> > > Erin
>> > >> > >
>> > >> > > [1] https://issues.apache.org/jira/browse/RAVE-1048
>> > >> > > [2] https://github.com/mgonto/restangular
>> > >> > >
>> > >> >
>> > >>
>> >
>>

Re: [Proposal] Use Restangular over $resource

Posted by Rohit Kalkur <ro...@gmail.com>.
This looks like a really robust library for resources Erin! Has some
additional types of methods you can call on a promise as well. Looks like
it would be at least worth trying.


On Thu, Aug 29, 2013 at 11:31 AM, Michael Jett <mi...@gmail.com> wrote:

> Good find Erin. I think this is definitely something worth exploring.
> "Restangular supports method chaining to build complex requests." (drool)
>
>
> On Thu, Aug 29, 2013 at 11:02 AM, Erin Noe-Payne
> <er...@gmail.com>wrote:
>
> > On Thu, Aug 29, 2013 at 1:28 AM, Chris Geer <ch...@cxtsoftware.com>
> wrote:
> > > On Wed, Aug 28, 2013 at 7:06 PM, Erin Noe-Payne <
> > erin.noe.payne@gmail.com>wrote:
> > >
> > >> Yeah all good points Chris. We are on 1.0.x which is officially the
> last
> > >> stable release, but maybe it makes sense to go to 1.1.6.
> > >>
> > >
> > > Erin, I trust you guys will make the right decision here. I was just
> > wanted
> > > to pass along what he said. He also said he wanted to try the library
> you
> > > suggested so who knows, he might want to switch us over as well.
> > >
> > Maybe. I actually prefer the $resource api but it felt like it was
> > lacking a bit. 1.2 has a release candidate out now so I'm going to
> > give it a try and see how it compares.
> >
> > >>
> > >> On Wednesday, August 28, 2013, Chris Geer wrote:
> > >>
> > >> > On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <
> > >> erin.noe.payne@gmail.com<javascript:;>
> > >> > >wrote:
> > >> >
> > >> > > Hey All,
> > >> > >
> > >> > > Based on our discussion surrounding RAVE 1048 [1], I was looking
> at
> > >> > > how to improve our resource functionality to support PUT
> > operations. I
> > >> > > came across the Restangular library [2], which offers an
> alternative
> > >> > > to ngResource. Restangular resources provide out of the box
> support
> > >> > > for PUT and PATCH methods, and return promises rather than empty
> > >> > > objects, which means they work better with the resolve arguments
> for
> > >> > > routing and controllers.
> > >> > >
> > >> > > I'm going to try it out and submit a patch with the changes so
> > anyone
> > >> > > who is interested can compare - but weigh in now if you have any
> > >> > > opinion.
> > >> > >
> > >> >
> > >> > FYI - I asked my UI engineer about this seeing if he wanted to use
> it
> > >> > internally and this was his response for what it's worth.
> > >> >
> > >> > One thing to note is that we are using angular 1.1.5 and the code
> has
> > >> been
> > >> > written in a way to easily move to angular 1.2 once it is finalized.
> >  In
> > >> > angular 1.2 the $resource does return a promise making it a tough to
> > >> beat.
> > >> >  Also the core angular team has focused a lot on the $http and
> > $resource
> > >> > during the 1.2 development resulting in several breaking changes.
>  So
> > I
> > >> > would be concerned that this plugin may not be on the same course as
> > the
> > >> > angular team.
> > >> >
> > >> >
> > >> > >
> > >> > > Erin
> > >> > >
> > >> > > [1] https://issues.apache.org/jira/browse/RAVE-1048
> > >> > > [2] https://github.com/mgonto/restangular
> > >> > >
> > >> >
> > >>
> >
>

Re: [Proposal] Use Restangular over $resource

Posted by Michael Jett <mi...@gmail.com>.
Good find Erin. I think this is definitely something worth exploring.
"Restangular supports method chaining to build complex requests." (drool)


On Thu, Aug 29, 2013 at 11:02 AM, Erin Noe-Payne
<er...@gmail.com>wrote:

> On Thu, Aug 29, 2013 at 1:28 AM, Chris Geer <ch...@cxtsoftware.com> wrote:
> > On Wed, Aug 28, 2013 at 7:06 PM, Erin Noe-Payne <
> erin.noe.payne@gmail.com>wrote:
> >
> >> Yeah all good points Chris. We are on 1.0.x which is officially the last
> >> stable release, but maybe it makes sense to go to 1.1.6.
> >>
> >
> > Erin, I trust you guys will make the right decision here. I was just
> wanted
> > to pass along what he said. He also said he wanted to try the library you
> > suggested so who knows, he might want to switch us over as well.
> >
> Maybe. I actually prefer the $resource api but it felt like it was
> lacking a bit. 1.2 has a release candidate out now so I'm going to
> give it a try and see how it compares.
>
> >>
> >> On Wednesday, August 28, 2013, Chris Geer wrote:
> >>
> >> > On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <
> >> erin.noe.payne@gmail.com<javascript:;>
> >> > >wrote:
> >> >
> >> > > Hey All,
> >> > >
> >> > > Based on our discussion surrounding RAVE 1048 [1], I was looking at
> >> > > how to improve our resource functionality to support PUT
> operations. I
> >> > > came across the Restangular library [2], which offers an alternative
> >> > > to ngResource. Restangular resources provide out of the box support
> >> > > for PUT and PATCH methods, and return promises rather than empty
> >> > > objects, which means they work better with the resolve arguments for
> >> > > routing and controllers.
> >> > >
> >> > > I'm going to try it out and submit a patch with the changes so
> anyone
> >> > > who is interested can compare - but weigh in now if you have any
> >> > > opinion.
> >> > >
> >> >
> >> > FYI - I asked my UI engineer about this seeing if he wanted to use it
> >> > internally and this was his response for what it's worth.
> >> >
> >> > One thing to note is that we are using angular 1.1.5 and the code has
> >> been
> >> > written in a way to easily move to angular 1.2 once it is finalized.
>  In
> >> > angular 1.2 the $resource does return a promise making it a tough to
> >> beat.
> >> >  Also the core angular team has focused a lot on the $http and
> $resource
> >> > during the 1.2 development resulting in several breaking changes.  So
> I
> >> > would be concerned that this plugin may not be on the same course as
> the
> >> > angular team.
> >> >
> >> >
> >> > >
> >> > > Erin
> >> > >
> >> > > [1] https://issues.apache.org/jira/browse/RAVE-1048
> >> > > [2] https://github.com/mgonto/restangular
> >> > >
> >> >
> >>
>

Re: [Proposal] Use Restangular over $resource

Posted by Erin Noe-Payne <er...@gmail.com>.
On Thu, Aug 29, 2013 at 1:28 AM, Chris Geer <ch...@cxtsoftware.com> wrote:
> On Wed, Aug 28, 2013 at 7:06 PM, Erin Noe-Payne <er...@gmail.com>wrote:
>
>> Yeah all good points Chris. We are on 1.0.x which is officially the last
>> stable release, but maybe it makes sense to go to 1.1.6.
>>
>
> Erin, I trust you guys will make the right decision here. I was just wanted
> to pass along what he said. He also said he wanted to try the library you
> suggested so who knows, he might want to switch us over as well.
>
Maybe. I actually prefer the $resource api but it felt like it was
lacking a bit. 1.2 has a release candidate out now so I'm going to
give it a try and see how it compares.

>>
>> On Wednesday, August 28, 2013, Chris Geer wrote:
>>
>> > On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <
>> erin.noe.payne@gmail.com<javascript:;>
>> > >wrote:
>> >
>> > > Hey All,
>> > >
>> > > Based on our discussion surrounding RAVE 1048 [1], I was looking at
>> > > how to improve our resource functionality to support PUT operations. I
>> > > came across the Restangular library [2], which offers an alternative
>> > > to ngResource. Restangular resources provide out of the box support
>> > > for PUT and PATCH methods, and return promises rather than empty
>> > > objects, which means they work better with the resolve arguments for
>> > > routing and controllers.
>> > >
>> > > I'm going to try it out and submit a patch with the changes so anyone
>> > > who is interested can compare - but weigh in now if you have any
>> > > opinion.
>> > >
>> >
>> > FYI - I asked my UI engineer about this seeing if he wanted to use it
>> > internally and this was his response for what it's worth.
>> >
>> > One thing to note is that we are using angular 1.1.5 and the code has
>> been
>> > written in a way to easily move to angular 1.2 once it is finalized.  In
>> > angular 1.2 the $resource does return a promise making it a tough to
>> beat.
>> >  Also the core angular team has focused a lot on the $http and $resource
>> > during the 1.2 development resulting in several breaking changes.  So I
>> > would be concerned that this plugin may not be on the same course as the
>> > angular team.
>> >
>> >
>> > >
>> > > Erin
>> > >
>> > > [1] https://issues.apache.org/jira/browse/RAVE-1048
>> > > [2] https://github.com/mgonto/restangular
>> > >
>> >
>>

Re: [Proposal] Use Restangular over $resource

Posted by Chris Geer <ch...@cxtsoftware.com>.
On Wed, Aug 28, 2013 at 7:06 PM, Erin Noe-Payne <er...@gmail.com>wrote:

> Yeah all good points Chris. We are on 1.0.x which is officially the last
> stable release, but maybe it makes sense to go to 1.1.6.
>

Erin, I trust you guys will make the right decision here. I was just wanted
to pass along what he said. He also said he wanted to try the library you
suggested so who knows, he might want to switch us over as well.

>
> On Wednesday, August 28, 2013, Chris Geer wrote:
>
> > On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <
> erin.noe.payne@gmail.com<javascript:;>
> > >wrote:
> >
> > > Hey All,
> > >
> > > Based on our discussion surrounding RAVE 1048 [1], I was looking at
> > > how to improve our resource functionality to support PUT operations. I
> > > came across the Restangular library [2], which offers an alternative
> > > to ngResource. Restangular resources provide out of the box support
> > > for PUT and PATCH methods, and return promises rather than empty
> > > objects, which means they work better with the resolve arguments for
> > > routing and controllers.
> > >
> > > I'm going to try it out and submit a patch with the changes so anyone
> > > who is interested can compare - but weigh in now if you have any
> > > opinion.
> > >
> >
> > FYI - I asked my UI engineer about this seeing if he wanted to use it
> > internally and this was his response for what it's worth.
> >
> > One thing to note is that we are using angular 1.1.5 and the code has
> been
> > written in a way to easily move to angular 1.2 once it is finalized.  In
> > angular 1.2 the $resource does return a promise making it a tough to
> beat.
> >  Also the core angular team has focused a lot on the $http and $resource
> > during the 1.2 development resulting in several breaking changes.  So I
> > would be concerned that this plugin may not be on the same course as the
> > angular team.
> >
> >
> > >
> > > Erin
> > >
> > > [1] https://issues.apache.org/jira/browse/RAVE-1048
> > > [2] https://github.com/mgonto/restangular
> > >
> >
>

Re: [Proposal] Use Restangular over $resource

Posted by Erin Noe-Payne <er...@gmail.com>.
Yeah all good points Chris. We are on 1.0.x which is officially the last
stable release, but maybe it makes sense to go to 1.1.6.

On Wednesday, August 28, 2013, Chris Geer wrote:

> On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <erin.noe.payne@gmail.com<javascript:;>
> >wrote:
>
> > Hey All,
> >
> > Based on our discussion surrounding RAVE 1048 [1], I was looking at
> > how to improve our resource functionality to support PUT operations. I
> > came across the Restangular library [2], which offers an alternative
> > to ngResource. Restangular resources provide out of the box support
> > for PUT and PATCH methods, and return promises rather than empty
> > objects, which means they work better with the resolve arguments for
> > routing and controllers.
> >
> > I'm going to try it out and submit a patch with the changes so anyone
> > who is interested can compare - but weigh in now if you have any
> > opinion.
> >
>
> FYI - I asked my UI engineer about this seeing if he wanted to use it
> internally and this was his response for what it's worth.
>
> One thing to note is that we are using angular 1.1.5 and the code has been
> written in a way to easily move to angular 1.2 once it is finalized.  In
> angular 1.2 the $resource does return a promise making it a tough to beat.
>  Also the core angular team has focused a lot on the $http and $resource
> during the 1.2 development resulting in several breaking changes.  So I
> would be concerned that this plugin may not be on the same course as the
> angular team.
>
>
> >
> > Erin
> >
> > [1] https://issues.apache.org/jira/browse/RAVE-1048
> > [2] https://github.com/mgonto/restangular
> >
>

Re: [Proposal] Use Restangular over $resource

Posted by Chris Geer <ch...@cxtsoftware.com>.
On Wed, Aug 28, 2013 at 2:31 PM, Erin Noe-Payne <er...@gmail.com>wrote:

> Hey All,
>
> Based on our discussion surrounding RAVE 1048 [1], I was looking at
> how to improve our resource functionality to support PUT operations. I
> came across the Restangular library [2], which offers an alternative
> to ngResource. Restangular resources provide out of the box support
> for PUT and PATCH methods, and return promises rather than empty
> objects, which means they work better with the resolve arguments for
> routing and controllers.
>
> I'm going to try it out and submit a patch with the changes so anyone
> who is interested can compare - but weigh in now if you have any
> opinion.
>

FYI - I asked my UI engineer about this seeing if he wanted to use it
internally and this was his response for what it's worth.

One thing to note is that we are using angular 1.1.5 and the code has been
written in a way to easily move to angular 1.2 once it is finalized.  In
angular 1.2 the $resource does return a promise making it a tough to beat.
 Also the core angular team has focused a lot on the $http and $resource
during the 1.2 development resulting in several breaking changes.  So I
would be concerned that this plugin may not be on the same course as the
angular team.


>
> Erin
>
> [1] https://issues.apache.org/jira/browse/RAVE-1048
> [2] https://github.com/mgonto/restangular
>