litany against fear
RESTful Possibilities - REST in Rails and Beyond Notes
Part of my series of notes from the Professional Ruby Conference. See them all here.
This talk is by James Golick from giraffesoft.
The Rails community has been outspoken about REST, but it’s starting to get a stigma where it’s associated with only Ruby/Rails/Java. However, that shouldn’t be the case. There’s plenty of other uses outside though.
Classic problem in computer science: two computers talking to each other over the network. Typically this has been done with Remote Procedure Call. The idea that you’re invoking a method on some service. Make the programmer feel like they’re writing regular old code, especially with SOAP and CORBA. Stack takes care of plumbing and isolates you from the complexities of distributed programming.
They have some big problems though, especially in today’s era of computer. Nearly 42,000 lines of code in the SOAP stack for Ruby. It’s huge. They create way more problems than they solve. Fail.
The web came around soon after these technologies, especially HTTP. Fielding described REST originally: representational state transfer. Absolutely anything can be resource. Used all the time: GET, POST. Don’t verb the noun though and complicate things.
Rails sought to standardize on REST. Based around the map.resources and routing system, which helps out a lot. Standardization is GOOD. New hires can be much more productive because of this. Cheap and clean API. Since there’s a standardization at a higher level, powerful tooling is available. Easy and refreshing integration. Ridiculously easy to use it, only a few lines of code to even integrate with Twitter. Even more, this makes happy developers, which can lead to a more profitable business.
Beyond Rails. Building on REST gets you a free server since there’s tons out there already, and a cheap client since they’re already implemented and easy to use. Looking at Starling as an example of this. 24% queue, 76% other shit LOC-wise with REST. Going through implementing a queue in Sinatra, which is really quite easy. Building apps on REST is good since there’s plenty of servers and clients out there that can easy consume and use the services without a lot of code.