Web application development has seen significant improvements over the years. With the emergence and improvements of JavaScript and introduction of JavaScript libraries like JQuery, web designers and web application developers have been able to develop more interactive and less boring web applications, pushing the limits of web application development.
I intend to push the limits of web applications developments further by introducing the ability to achieve distributed object environments using JavaScript (JQuery) and PHP (or any server-side scripting language).
Distributed object environments (DOE) are environments where object are shared among components of a distributed system. In DOE, distributed components (requestor) can request (via special calls, accompanied by object reference) for objects that are not physically present on the same machine or address space. With the help of middleware technologies, programmers are relieved of the pain of having to deal with the complexities associated with distribution. This request is served by generating the object (whose reference was passed along with the message) and sending it back to the requestor. Different implementations exist for the processes that take place between the request and the response. One of which I’ll be discussing in this article.
Since Google’s use of AJAX (Asynchronous JavaScript and XML) to make search suggestions in 2005, AJAX have become widely used to develop web applications with real-time capabilities. Via AJAX, requests for resources or section of the web page can be made to a server, and on success, the server’s reply can be applied to the required section usually a div tag within the html document. The communication between the server and client (in this case the web application) is usually asynchronous, in other words, the web application can continue with other tasks as soon as the message is sent. In this context, “Messaging refers to the communication model of asynchronous, possibly multi-cast message exchange for event notification, or request processing” (Tai & Rouvellou, 2000).
AJAX is based on messaging, and therefore could easily be used to make requests for objects. These objects have to be JavaScript compatible, as JavaScript is used at the client end. The server, in receipt of this client request, sends JavaScript compatible objects using JavaScript Object Notation (JSON). “JSON is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition – December 1999.” (JSON)
PHP, a server-side scripting language, supports JSON by default. It provides functions for encoding and decoding JSON objects.
Finally, JQuery, a JavaScript library, makes requests via AJAX really easy, taking out the complexities associated with JavaScript. It provides full support for JSON, with special functions for making AJAX-JSON requests.
In summary, using standard HTTP protocols, JavaScript (jQuery), AJAX, JSON and PHP, a web service that simulates a distributed object environment can be developed.
Bibliography
JSON. (n.d.). Retrieved 01 19, 2010, from JSON: http://www.json.org/
JSON Functions. (n.d.). Retrieved 01 19, 2010, from PHP.NET: http://php.net/manual/en/ref.json.php
Tai, S., & Rouvellou, I. (2000). Strategies for Integrating Messaging and Distributed Object Transactions. IFIP/ACM International Conference on Distributed systems platforms (pp. 308 – 330). New York: Springer-Verlag New York, Inc.
