So are you using REST? if yes for which situations do you think the REST approach works the best?
| SitePoint Sponsor |

So are you using REST? if yes for which situations do you think the REST approach works the best?
I'm trying out but remain slightly skeptical. I think I'm coming around but I'm still yet to see anybody talk about using it on anything but a simple app.

what you are waiting for is exactly what I am looking for Luke!Originally Posted by Luke Redpath
REST doesn't seem to be that popular...does it?

RPC is definitely more popular then REST, though I do believe that REST was gaining popularity before it was made an option in Rails 1.2. If i'm not mistaken .NET supported it, faking HTTP's DELETE and PUT as well (Heard it during David Hansson's Rails keynote, someone mentioned .NET's implementation and how bad it's faking was.). Amazon's S3 also offers a REST interface, though that really wasn't the question.
It does seem to be in the Rails community. I appear to be in the minority of those who remain skeptical.Originally Posted by Dark Tranquility
Rails' PUT/DELETE faking is pretty simple really, its just a hidden form field in your form.

Even Vinnie doesn't seem to like it![]()




I can think of many applications where REST works really well, but not of applications where it wouldn't work (applications that you'd use Rails for, not an online calculator for example). Does anyone have examples of applications where REST doesn't work?
Applications that have to follow a strict workflow (as part of the business rules) probably aren't a great fit for REST.Originally Posted by Fenrir2
I like the concept of "simplify everything down to CRUD". I'm not 100% sold on the idea of having a REST API for every part of your webapp, but I also see it as of minor importance I guess.




Yes! Do you think it's a good idea to create a REST layer, and on top of that the actual application for the user? The workflow can be done by the topmost application, and you still have a REST API beneath that. You can then expose these APIs for users who want to create another front-end.Originally Posted by Luke Redpath
Well, whatever front end you have, it *must* interface with the workflow.
The important thing to remember about a workflow is that whilst it looks similar to a controller (i.e. it deals with the logic of where to go next) its actually part of the domain model. Any controller should simply delegate to the workflow to find out where to go next, then issue the redirect.
You could conceivelbly CRUD a Workflow object, updating the workflow with any important data, I suppose.
Code:class WorkflowController < ActionController::Base before_filter :load_workflow, :except => [:new] after_filter :persist_workflow, :except => [:update, :delete] def new @workflow = Workflow.new end def show redirect_to :action => 'new' if @workflow.nil? and return @workflow.invoke(params[:step]) render :template => params[:step] end def update @workflow.update(some_data) if @workflow.complete? redirect_to :action => 'destroy' and return end redirect_to :action => 'show, :step => @workflow.next_step end def destroy @workflow.destroy end protected def persist_workflow @workflow.save session[:workflow_id] = @workflow.id end def load_workflow @workflow = Workflow.find(session[:workflow_id]) end end
Bookmarks