Archives: February 2009

REST

No, it’s not what I suffer from the lack of (as in sleep). It’s Representational State Transfer. It’s been a buzzword for a few years now. I’m just now reading about it, and thought I would include some highlights here for my own reference.

Read all about it.

From the URL above, REST exhibits the following characteristics:

  • Client-Server: a pull-based interaction style: consuming components pull representations.
  • Stateless: each request from client to server must contain all the information necessary to understand the request, and cannot take advantage of any stored context on the server.
  • Cache: to improve network efficiency responses must be capable of being labeled as cacheable or non-cacheable.
  • Uniform interface: all resources are accessed with a generic interface (e.g., HTTP GET, POST, PUT, DELETE).
  • Named resources – the system is comprised of resources which are named using a URL.
  • Interconnected resource representations – the representations of the resources are interconnected using URLs, thereby enabling a client to progress from one state to another.
  • Layered components – intermediaries, such as proxy servers, cache servers, gateways, etc, can be inserted between clients and resources to support performance, security, etc.

Trying to make my CatalystX::CRUD project more RESTful.

If I needed to explain REST to my wife, I could refer her to this.

The Wikipedia CRUD article maps the RESTful verbs to CRUD and SQL actions like so:

Operation SQL HTTP
Create INSERT POST
Read (Retrieve) SELECT GET
Update UPDATE PUT
Delete (Destroy) DELETE DELETE

However, important to note that REST != CRUD.

update to original post: Another good REST article.

And REST for my kids.

Sentences

Long before I was a computer programmer I was an essay writer, a songwriter, a poet. When I discovered Perl, I found the transition to programming very natural. I had always played with computers, back to the IBM PC and Macintosh circa 1984. My first program was in BASIC, in 1985. It was a ‘choose your own adventure’-type program. Even then, I wanted to combine prose with code. It was just Making Stuff with Words. I didn’t differentiate.

chromatic suggests Perl programmers can improve their code by thinking in terms of sentences and paragraphs. Best practices. Makes perfect sense to me. When my friends ask me about my work I tell them I’m a writer, that a good piece of Perl code has the same structure and thought behind it as a well-written essay, and that I practice the art of writing every day. It’s just that the language I write in is Perl, not English. I know my metaphor is lost on most non-programmers. But I trust some people understand.