Prev | Current Page 311 | Next

Brad Ediger

"Advanced Rails"


The uniform registration and naming system of MIME types certainly
doesn??™t settle the debate, but it definitely simplifies it.
With those two corners of the REST triangle taken care of, potentially the biggest
gray area is in identifying and naming resources. Naming is one area where simplicity
really pays off, because it is very easy to get it wrong. However, if you stick with a
standard set of verbs and content types religiously, they will help constrain your
choice of nouns.
It is very important to define clean, readable, persistent URIs for your resources. The
REST FAQ (http://rest.blueoxen.net/cgi-bin/wiki.pl?RestFaq) makes a good observation
about naming:
GET is restricted to a single-URL line and that sort of enforces a good design principle
that everything interesting on the Web should be URL-addressable. If you want to
make a system where interesting stuff is not URL-addressable, then you need to justify
that decision.
This is what designers and architects mean when they say ???constraints are freeing.???
The principles of REST were derived from examination of how the Web and other
hypertext networks actually work. Rather than being some set of arbitrary restrictions,
they embody the way that the Web should act.
By working within the principles of REST, any pain you may feel should be treated as
a hint that you might be going against the grain of the Web??™s natural architecture.


Pages:
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323