Now for the final section about these architectures. This post will cover the aspects concerning the REST Architecture. It really simple to grasp the concept of it, so lets take a look!
REST
REST, as you have probably already guessed, stands for REpresentation State Transfer.
REST is all about 'resources’. REST defines a resource as anything that can be named; so basically your computer is a resource, your game collection such as Mass Effect or Dragon Age – they are resources to. Even YOU are a resource!! :)
A resource can also have a number of representations. For example, Mass Effect is a resource, but the Guide to completing Mass Effect is another way of representing the same resource. Other ways of representing Mass Effect could be:
- The game itself.
- A guide to the game
- A Let’s Play of the game
- The source code of the game!
We also need to note that a resource can contain links to other resources. A simple example could be that a book – which is also a resource – has a link (reference) to another book – another resource – in it’s references section.
The general idea is. everything pretty much is a resource!
REST is also independent of any middleware. HTTP follows the principles of REST – Can you think why? :D
Representation, State and Transfer
Each representation of a resource, provides information about the current state of the resource.
As we already pointed out, resources contain links to other resources. On a bigger scale example, the Internet! Here we have clients who navigate from one resource to another via links. Each link transfers the client to another representation of another resource.
So this is how we have REpresentation State Transfer.
HTTP and REST
Above i made you think about how HTTP follows the principles of REST. Have any clues yet?
Well, an URL identifies resources. For example, http://computersciencesource.co.uk identifies the resource Computer Science: Source. Where as http://youtube.com identifies YouTube. In the same way that http://www.bioware.com/ identifies BioWare.
HTTP only shows the representations of the resources.
Remember: Resources can have many representations.
An HTTP also does this. We can have many representations of one resource, such as:
- HTML
- XML
- PHP
- JPEG
- BMP
- etc etc
No comments:
Post a Comment