Last active
August 29, 2015 14:09
-
-
Save pdougall1/9122c96c2ea7bab47c31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REST? Hypermedia? Do I know what I'm talking about? | |
I like to think I'm a smart man. I work hard to understand the technologies I use. Embarisingly I haven't ever really looked into REST. | |
The embarasment isn't that there's a technology I don't know about, there are a lot of technologies I don't know about! There are so many technologies I'll never be able to deep dive into them all. It's embarasing because I don't know a foundational premise for the work I do. I end up working with a lot of APIs, so I'm makeing calls to and fro, making POST requests with JSON and parsing GET responses. I feel like I know what I'm doing when I have all the right verbs in my controller. I can be helpful when I see this: | |
``` | |
class UsersController < ApplicationController | |
def create | |
# create a user | |
end | |
def password_update | |
# update a user's password | |
end | |
end | |
``` | |
"Hey budy, you're throwing a different verb in there! Are you sure you don't need a seperate controller for that password?" | |
That's great! If nothing else it's helping with the single responsability principle, but isn't there more? What all this about hypermedia? Is Rails not RESTful? Just as I've knew there was more to a back end Ruby program than Models, Views, and Controllers, I also get the feeling there is a lot more to the archetecture of the web than having only 7 verbs. | |
The purpose of this is to build an understanding of web archetecture that I can use in my daily life, to help me build tools that fit well into this larger web archetecture. A commot catch phrase for this is "don't break the web." I don't want to break the web. Like most of the complex systems I deal with everyday, if I don't understand it, I'll likely break it. | |
I'm going to mainly look at [Roy Fieldings dissetation](https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation.pdf) and work to summarize it here, very briefly. Then I'll look to some Rails sources on how it interprets REST, likely citing a lot of [DHH](http://david.heinemeierhansson.com/). Lastly I'll look at Hypermedia, and see how falls into the mix. I hope to be able to itegrate these all into a single understanding of web archetecture that makes useing it easier and more fun. | |
### Row Fieldling's Dissertation | |
Short sentance about what's going on in each section | |
In relevant sections describe them in a way that is relatable to Rails if possible | |
### Hypermedia | |
When we talk about hypermedia whata we really mean is [HATEOAS, or Hypermedia As The Engine Of Application State](http://en.wikipedia.org/wiki/HATEOAS). This is discussed in [Roy Fielding's dissertation](same link) but I think the idea really needs some elaboration, which is pretty successfully done by [Steve Klabnik](http://words.steveklabnik.com/) in [this article](http://timelessrepo.com/haters-gonna-hateoas) and by [Martin Fowler](http://martinfowler.com/) in [this one](http://martinfowler.com/articles/richardsonMaturityModel.html). | |
Hypermedia is that part that sends a description of how to interact with resources in each request. | |
as well as others. In that article Steve describes | |
HTTP verbs, may need to be a seperate post. | |
### Is Rails bad? | |
Depending on the circles you run in, Rails can get a bad rap. Is it really RESTful, in terms that Roy Fielding meant. The truth is definitely no, it is not. There is no Hypermedia (refer to the discussion in above section). We, as Rails developers, do not provide instruciton for a resource in the get request for that resource. | |
My initial reaciton: | |
"What!? I'm doing it wrong!? Roy Fielding wrote the spec for REST, he invented it right? So I should do it the way he said to right? How come no one told me how to do it" | |
what to do now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment