|
Application Design
Applications architected for an ROC environment can have many different designs but they tend to share some common characteristics:
Information is modeled as resources, which are identified by URI addresses,
Resource addresses are organized into logical address spaces,
Logical address spaces contain endpoints which generate and/or accept resource representations,
Channels are created, through which information flows to and from external clients,
Logical address spaces are composed into layers which implement the goals of the application.
As a very brief illustration, the design of a forum application might begin with the identification of some sample actions and request URIs corresponding to these actions:
Action
Request URI
Show most recent posting
http://mycomp.com/forum/search/1
Return topic 512 in the first discussion area.
http://mycomp.com/forum/area/1/topic/512
Create a new topic with content of HTTP POST
http://mycomp.com/forum/update/topic
Once one of these requests enters the forum application, the difference between the ROC-based approach and a traditional object-oriented system becomes evident immediately. An ROC application will focus on routing the request to the resource or internal micro-service that can satisfy it. All the routing is done at the logical level; through logical to logical mappings, mapping services, and module imports.
The preparation of the representation to be returned to the external client is also different from a traditional application. It is accomplished by composing resources and, optionally, applying formatting transformations to the result. For example, a request from a browser for the display of a forum web page could result in a "mashup" operation, where information is derived from multiple sources. The mashup service could be driven by a page template which would include logical addresses for the required resources (menus, submenus, subject areas, topic summaries, etc.). Each of these resources would be identified by its URI address. When page assembly occurs, separate logical address space requests are issued for each constituent part. The decoupling of the logical from the physical means that the page assembly process has no idea whether a menu known as "resource:/menus/menu1" is static and stored in a file or is dynamically generated by Java code. And the same is true for all the other resources required by the template. In fact, the template itself is a resource and it could be based on a static representation or be dynamically generated by yet another service.
A Resource Oriented Computing architecture has another tremendous advantage over traditional applications: the ability to cache the returned representation for every request and to manage the cache for optimal performance. This ability is a direct result of the logical level properties of ROC applications: resources are logically addressed, logical addresses may be mapped to other logical addresses, responses are composed from logically addressed resources, and responses are transformed by logically addressed services.
In the forum example, if all resources are dynamically generated the first time they are requested, then subsequent requests run much faster because their representations are obtained from the cache. If a forum resource is updated (such as when a new item is posted) then all cached resources that are impacted by or dependent on the change are automatically and atomically flushed from the cache. The next time a forum page is requested, only those resources which were invalidated need to be recomputed - all other information remains available from cache.
Caching in an ROC architecture is similar to the use of memoization [7], except that it requires no extra work by developers and it is automatically applied across the entire system. Memoization is usually applied (if at all) to just a small corner of a selected application, for one specific data type, and only where someone has put in the extra effort to implement it. |
|