I’m not into RESTful yet, as I haven’t understood it completely. So my
question might fall back on that. I’m trying to learn it but I can’t see
it will be useful for me.
Who uses RESTful? I mean often an app is not that straightforward. A
simple RESTful setup is more like an interface to the db, not a real
world scenario. And often you will use plain html and not other format
outputs, such as xml. A real app will have many different custom actions
and solutions that breaks the RESTful setup, right? What’s your view on
RESTful?
Kiran Soumya wrote:
Clean URLs. REST URLs represent resources and not actions.
Yes that’s good. But does it really matter? And my point is that it
might often be broken when you have all your custom solutions. At least
that’s the case for me. Many web apps is not that simple that a RESTful
interface will do it. RESTful is more a UI for interacting with the db.
Correct me if I’m wrong.
Different Response Formats. REST controllers are developed in a way
that actions
can easily deliver their results in different response formats.
Depending on the requirements
of the client, the same action can deliver HTML, XML, RSS, or other
And how often do you use that? And if you do use it it will be for a
specific set of data which is really simple to implement for that simple
purpose.
Less Code. The development of multi-client-capable actions avoids
repetitions in
the sense of DRY2 and results in controllers having less code.
That’s a plus.
If we want to make a distinction between REST- and non-REST-based
Rails applications, we use the
word traditional. Traditional does not mean old or even bad, it’s only
used to make a reference to an
equivalent non-REST concept. This comparison should help to better
explain the new technology.
Feature list of REST-based Applications makes clear:
Clean URLs. REST URLs represent resources and not actions. URLs always
have the
same format: first comes the controller and then the id of the
referenced resource.
The requested manipulation is independent of the URL and is expressed
with the
help of HTTP verbs.
Different Response Formats. REST controllers are developed in a way
that actions
can easily deliver their results in different response formats.
Depending on the requirements
of the client, the same action can deliver HTML, XML, RSS, or other
data
formats–the application becomes able to handle multiple client
demands, cleanly
and simply.
Less Code. The development of multi-client-capable actions avoids
repetitions in
the sense of DRY2 and results in controllers having less code.
CRUD-oriented Controllers. Controllers and resources melt together
into one unit–
each controller is responsible for the manipulation of one resource
type.
Clear Application Design. RESTful development results in a
conceptually clear and
maintainable application design.
Reference document:
http://media.quilime.com/files/pdf/restful_rails_en.pdf
Regards,
Kiran.
On Aug 4, 1:11 pm, Pål Bergström [email protected]
Hi –
On Mon, 4 Aug 2008, kiranH wrote:
and solutions that breaks the RESTful setup, right? What’s your view on
RESTful?
Different Response Formats. REST controllers are developed in a way
that actions can easily deliver their results in different response
formats. Depending on the requirements of the client, the same
action can deliver HTML, XML, RSS, or other data formats–the
application becomes able to handle multiple client demands, cleanly
and simply.
That’s not specific to resource-routed controllers, though. You can
use respond_to and so forth with traditional routing.
CRUD-oriented Controllers. Controllers and resources melt together
into one unit– each controller is responsible for the
manipulation of one resource type.
They can melt together, but it depends a bit on what your resource is
and how it maps to its persistence mechanism (if it has one). Here’s
some elaboration of some of this:
http://dablog.rubypal.com/2008/3/23/splitting-hairs-over-resource
http://dablog.rubypal.com/2008/4/24/splitting-hairs-over-resource-part-2
David
–
Rails training from David A. Black and Ruby Power and Light:
- Advancing With Rails August 18-21 Edison, NJ
- Co-taught by D.A. Black and Erik Kastner
See http://www.rubypal.com for details and updates!