Sunday, April 10, 2005

Presenting: ME - An AJAX Pioneer!!!!

Latly there has been a lot of talk about something called AJAX. The basic ideas behind it are not new - what is new is that it has now been identified as an appropriate patern for building web applications. Anyways around the 1999-2000 timeframe I came up with a design for a toolkit that accomplished pretty much the same thing. The difference betwwen current implenentations and my design is that the current stuff uses standard browsers and controls etc... while my design called for a custom built browser or a plugin to an actuall browser.

I actually went as far as builidng a rudimentry browser that could load a chat, shop cart or stock quote page. I also worked a bit on a server based framework that allowed a developer to respond to events fired from the client (similiar to the way ASP.Net does it). But then someone pointed me to "asp+" (the precursor to ASP.NET) and while it did not have the out of band communication features it did have a robust RAD tpe development model that was way better then what I had envisioned (I had envisioned the developer hand writting the HTML (or APML as I called it) with the APML controls inline with event handling attributs (i.e. HandleOnClick = "true" etc...) as if they were regular controls - then the deveoper would run this file thru a pre processer and the pre processer would output a delphi source code file with stubs for the developer to fill in. The end result would be similiar to asp.net in basic functionality (you would set the text property by saying label.text = etc...).

Here is a simple introduction that I wrote describing my ideas in Dec 2000.
--------------------------------------------------------------------------
AMAP/APML
Active Markup Application/Application Presentation Markup Language

What is AMAP
AMAP is a method of delivering and executing a browser based client server application over a Internet type network connections. AMAP applications have 2 parts (1) The Server (2) The Client.

The Server:
The Server software is a CGI or ISAPI DLL that runs behind a standard Internet HTTP Server and provides APML pages to clients that request it using standard http URL requests. Once the client has loaded the APML page the server then stands by to service any events transmitted by the client. These events also arrive in standard HTTP requests and the server responds to them by passing any property changes or procedure calls

The Client:

There are 2 possible client types:

Special Browser:
An AMAP client is a specially equipped web browser that requests APML pages from a AMAP Server and displays the formatting and control layout described in it. The client starts a session in which it monitors the controls on the page for any events that would be transmitted back to the server. When such an event takes place the event is transmitted to the server together with any other properties of objects that were specified (Probably using XML). When the call is returned the client updates any control property changes that may have been sent by the server and executes any script code returned. This data stream is separate from the stream used to originally download the page.

Standard browser
Controls are embedded in the HTML file as plugin objects. The plugins communicate with a background DLL that keeps all the controls together, and will do the actual communication.

What is APML
APML is a SGML type markup language that describes an applications look and behavior. It contains standard HTML markup to describe the text formatting of the page and any html Links. It also describes where and how APML controls should be created and what their properties are. AN APML control can respond to many unique events. For Example a button can respond to a click event while a TextBox can respond to a change event. Etc… Controls declerations are similar to HTML input declarations except that the tag is used. Unless the plugin method is used in which case the embed tag is used.

Differences between HTML and AMAP/APML
HTML uses a static connection to the server. When the user enters the web address a web page is retrieved and displayed by the browser. The connection is then cut off. In order to transmit the form data back to the server the user must submit the information in a HTTP Post (or similar) event. There is no connection between the client and the server during the time that the user is actually entering the information into the controls and the web page. If the information on the web page needs validation then that has to be done either in the actual webpage using a scripting language or on the server after the whole page has been submited. If some data was not entered correctly then the webpage has to be downloaded all over again and filled out.
APML on the other hand provides feedback to the server on every action the user takes. Once the APML browser downloads a webpage it can restart a connection to the server any time a specified event takes place. The server can then change a controls property or take other action that will be reflected on the webbrowser. This allows for instant data validation. This connection is in the background and does not affect the current page as a whole.

Take for example a case in which the user enters an invalid credit card number and clicks the submit button. In standard HTML the whole page is transmitted to the server and then validated. If the number was invalid then a new web page would be transmitted back to the user with a message that the number was incorrect and a input box to type the new information. In a typical APML session when the user clicks the submit button – only the credit card information is sent and validated. If the credit card is incorrect then the server sends the client a set of commands – this could include a command that a message box be displayed notifying the user that the number was incorrect and that the text box with the incorrect information be blanked out and have the focus. (alternately the color of the box can be changed to indicate error). All this is done without the page reloading.

The apml page can also specify a interval where the client will contact the server for any updates to apply to the page.

Differences between a Java Applet and AMAP/APML

A JAVA applet is a self contained program that is downloaded and run in the browser. APML is an enhanced webbrowser that contains enhanced standard controls. (there is no need to download extra controls (as in ActiveX)). If plugin controls are used then they have to be downloaded only once. Their behavior changes based on the properties and javascript embeded in the control declaration and on the code and properties sent during events. ActiveX and Java require that you download a separate control for each webpage containing the specified behavior for that page.

An Analogy
Suppose you were applying for a passport or other document. When you approach the counter there are 2 ways to do it. The HTML or the APML way.
In the HTML scenario you would ask the clerk for the required application then you would go to one of the tables at the side and fill out the form. After you had completed filling out the form you would line up again at the counter. When it was your turn to see the clerk you would give the clerk your application and the clerk would scan it for any mistakes. If there were mistakes the clerk would hand you a new form to fill out and send back to the tables to fill it out again. This process would continue until you had satisfactorily filled out the form and the clerk accepts it.
In the APML scenario you would approach the counter and fill out the form there, under the clerks watchful eye. The clerk can notify you of your mistakes as you write them and correct them for you or inform you of the need to correct them.

A Sample Use
Lets take a typical session On-line shopping and explore how it would be executed with HTML and how it would execute with APML.
Typically an on line shopping session requires you to add items to your “Shopping Cart”. Using HTML every time you would hit the “Buy This” button the entire web page would clear and be sent back to the server. A new and updated webpage (including all of the advertisements and formatting information) would then be downloaded with an updated shopping cart and price line. To remove something from the shopping cart you would have to click on the link next to that item and again the whole process would repeat itself, the webpage would be sent to the server where the processing would take place and then an entire new webpage would be downloaded.
Using APML , when a user hits the “Buy This” button an invisible message is sent to the web server and the webserver instructs the webbrowser to add that item to the “Shopping Cart” part of the site and update the price line. No new page downloads are needed. The same applies for removing an item from the shopping cart ,the user clicks the remove button and that item gets removed from the shopping cart.
--------------------------------------------------------------------------------------------
those were the days - I actually thought about patenting this thing :-) )

This page is powered by Blogger. Isn't yours?