Beruflich Dokumente
Kultur Dokumente
0 application architecture
Sas Jacobs
Page 1 of 6
The following diagram shows browser and server contact in Web 1.0 applications.
Web 2.0 applications, on the other hand, take advantage of technologies that dont require the full refresh of a page each time new data is requested. Instead, a page can be broken down into smaller components, widgets or sections. Events that occur within these component parts can trigger the loading of new data WITHOUT a full page refresh. Only the part of the interface displaying the changed data is reloaded. The fixed portions of the interface stay put. The following diagram shows the different approach taken in Web 2.0 applications.
An example
Lets use the example of a user login form to illustrate the differences between Web 1.0 and Web 2.0 approaches. In a traditional Web 1.0 application, the user fills in the form and clicks the submit button. Client-side code, usually JavaScript, determines that all entries are valid. If not, the user sees an alert box indicating that there is an error. Processing on the page stops until the user clicks OK to try another entry. If the JavaScript validation succeeds, the details from the form are sent to the Web server. The user waits while the server responds and updates the browser. The server checks the availability of the username. If the name is unavailable, the full application interface is sent back to the user including a message that indicates that the username is not available. If the username is available, the server returns the full interface including a message of success.
Page 2 of 6
If the user picks a username that isnt available, they dont find out until after the server has responded. That means they have to wait to find out that theyve been unsuccessful. Its possible that a user will have to repeat this process several times to find a username that has not been taken already. The diagram that follows indicates this process.
In a Web 2.0 approach, we still use the basic components of a Web application we have a page, form fields and a submit button. However, its there that the similarity ends. In this approach, there is no need to reload the page after requesting username information. After the username has been entered, the blur event (leaving the username form field) can trigger the validation of the entry. The first level of validation can check that the username meets requirements, for example, that it is of a minimum length. If the entry isnt valid, a message can be displayed in a small part of the interface, such as a <div> element. The application can also disable the submit button to prevent the page from being accidentally submitted to the server. If the entry is valid, JavaScript can then request information from the server about whether this username is available in the database. This request can occur asynchronously, as the user is entering their password. The application can display a message indicating that the username is being checked and can also disable the submit button while this process occurs. If the username is available, a success message can be displayed in a <div> element and the submit button can be enabled. Otherwise, the user can see an error message in the <div> element and the submit button can be disabled.
Page 3 of 6
In the
Web 2.0 approach, you can see that weve used: Small server-side tasks such as checking usernames Client-side events to trigger actions e.g. leaving a form field Asynchronous requests to the server i.e., they occur in the background and dont stop processing Updates to small parts of the interface e.g., a <div> element Enabling and disabling the interface in response to user and server events
These are classic parts of a Web 2.0 application. One of the key points to pick up from a Web 2.0 perspective is that there is a big change to the role of client and server compared with Web 1.0 applications. There is also a change to the role of pages and page components.
Page 4 of 6
Components vs pages
In Web 1.0 applications, each page is a state in the application. Events occurring within the application are tied to the reloading of a page. For example, new data is requested and displayed by reloading the page. The same is not true for Web 2.0 applications. These applications are made up of a set of components, widgets or page sections that can operate independently from one another. Any event associated with these components can trigger a request for new data. For example, a button click or entry into a text input can trigger a request for new data from the server. Because this can happen asynchronously, the user doesnt need to stop and wait for the page to reload to see the new content.
Asynchronous communication
A key concept behind Web 2.0 is asynchronous communication. This means that a page doesnt have to stop and wait for the communication from the server while data is being requested and provided. Web 2.0 approaches such as Flash/Flex and Ajax allow this to occur. When a user interacts with a component on the page, their interaction can trigger a script that requests information from the Web server. Another script can respond when the server sends back the information. Because the Web application doesnt wait around for the response, the user can continue working without being aware that data is being exchanged. In the previous example, after a user chooses their username, the act of tabbing past that input box i.e., losing focus, could prompt a request to the server to check if the username is available. While the user is entering their password, the response is delivered back to the page.
Implications
Using asynchronous communication in an application means that a developer has to be a little more aware of the application interface. The page refresh no longer acts as a cue to the user, indicating that something has changed. Web 2.0 developers need to consider the following when creating their interfaces: Providing notification that processing is occurring Marking changed information on the page Disabling and enabling interface elements appropriately In some cases, users need to be informed that processing is taking place. This might involve a simple message in a <div> element indicating that an action is taking place. In the login form, we display a message to indicate that we are checking the username. By displayed the message in a <div> element rather than in an alert box, the user does not need to stop processing to respond. After data is provided to the interface, users need to be able to identify whats new. This can involve changing the colour of the new data for a period of time or displaying a simple message, for example, indicating that the chosen username is unavailable. The interface could use other visual cues including flashing or blinking, or using a colour not used elsewhere in the interface, or any combination of these. Users also need to disable and enable interface elements so that only the available functionality is provided to the user. For example, if its not possible to submit a form until after the username is checked, the script calling the server to check the username should also disable the submit button. The button should not be enabled until its clear that the user can proceed. Web 2.0 application interfaces are likely to require a little more thought and scripting for developers compared with Web 1.0 interfaces.
Copyright 2004 DMXzone.com All Rights Reserved To get more go to DMXzone.com
Page 5 of 6
A caution
Developers need to be careful in their adoption of Web 2.0 approaches. Web 2.0 architecture is not suited to all types of applications and in some cases, a more traditional approach might be appropriate. Just because technologies are available, doesnt imply that they should always be used. Flash and Flex are great tools but shouldnt be used just because theyre new or cool. Similarly, Web 2.0 introduces us to a range of new user interface components and widgets, as well as encouraging applications to respond to a range of events. We need to be careful not to ignore existing controls as users are familiar with them. Completely reworking interface elements and relying on a wider range of events has the potential to confuse users and thus make Web applications harder to use.
Conclusion
In this article, weve looked at the architecture thats normally associated with a Web 2.0 application. Weve examined the differences in the roles of the client and server in Web 2.0 compared with Web 1.0. Weve also looked more closely at asynchronous communication and that implications arise for Web interfaces. If you want to determine if an application is really Web 2.0, try out the validator at http://web2.0validator.com/. Its a bit of fun!
Page 6 of 6