Monday, February 25, 2008

The REST Architectural Principle

After reading some articles about the REST architectural principle, I really think it is a very reasonable architecture, and I am a little surprised in the real world we somehow just don't do things in the way that they supposed to be done, also known as, the RESTful way.

Last semester when I was doing the
MyISERN project, the application was accessed through a serious of "action beans". Therefore, the URL is mostly something like /host/researchers.do, which is converted from the ResearchersActionBean. There are many problems with URL like this: one of the most common issues is that people cannot bookmark the page because the URL is always the same. Moreover, the URL does not represent the data on the page in a meaningful way.

Now since I know about REST, I would like to have my current
Informative Workspace project being RESTful. The idea of informative workspace is to make the software development process more transparent, and thus there will be many relevant data involved. The REST principle can provide a good way to represent these data in a more reasonable way. For example, we can have some URL like these: (well, with the assumption that the system is a web application)

host/projects/ambient-device/code-complexity
host/projects/iHacky/milestones/2008-02-20

Technically, REST refers to giving a unique URI to every resource, and URL is only a subset of URI. However, I believe the concept is the same. Through the composition of the URL, the user can have a better understanding of what data is being represented in the page. I believe the real problem would be how to represent all these data in a way such that they can be helpful to the development process.

On the other hand, the
SensorBase API pretty much obey the REST principle. For example, the resource is named using the URI specification: host/projects/owner/projectname. Also, it uses the standard HTTP methods such as GET, POST, and DELETE to control how the different data are represented, or, control how the different services are provided.

In terms of the
Project Viewer, it doesn't seem like it obeys the REST principle to me. At the moment, the URI does not give information owner of the project, as well as the projects. Also, the user doesn't have access to the other data of the project from the Project Viewer itself. (well, it does give the URI for the SensorBase and DailyProjectData, but it requires the users to enter it from the browser.)

No comments: