|
I'm learning Ruby, and specifically "Ruby on Rails". The concept of a "RESTful" app seems to be important, at least to my employer.
I'm trying to understand the concept of "REST". Googling around the web, I can't really find a clear explanation. It strikes me as another poorly defined buzz word.
According to Wikipedia, HTTP and the Web itself are RESTful. Not much help there.
The acronym "REST" stands for "Representational State Transfer". Okay, so we're talking (I think) about about moving representations of states from point A to point B. How can we represent a state with anything other than a "representation"? It seems like a tautology.
So, literally it means "moving around information". I guess that vindicates Wikipedia, but it also reduces the term to meaninglessness.
But let's set aside the rants about the poor use of language. From what I can tell, in current real world usage "REST" usually involves the use of XML... but not necessarily. The "but not necessarily" again reduces it to meaninglessness - "it either uses XML or it doesn't". :crazy:
Okay, in the context of my current employment it does seem to involve XML but I'm trying to understand how and why.
Apparently, at least in the context of what I'm doing, it means making available via a URI, an XML representation of the data which is extracted from a DB on the server. This representation is not intended for the end user but is used in another URL to present the data as, for example, a grid.
What is the purpose of this? I'm used to using PHP to extract the data from a database and then including it in a generated HTML page, possibly utilizing Ajax and Javacript. Rendering it as XML on a separate URL first seems to be an unnecessary intermediate step. If you are presenting the data to an end user who requires XML then it would make sense, but what's the sense in having a step where it's represented this way when the intended user interface is a web page that includes the data in, for example a grid?
What am I missing here? Am I understanding it correctly?
Also, what about changes to the database? Do updates, deletes, and inserts require going through an intermediate XML representation?
|