<<

MASARYK UNIVERSITY

FACULTY OF INFORMATICS

Æ

Techniques and Tools for Building Web 2.0 Services

BACHELOR’S THESIS

Jaroslav Tesaˇr´ık

Brno, 2008 Declaration

Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source.

Advisor: RNDr. Tom´aˇsPitner PhD.

ii Acknowledgement

I would like to thank my advisor, RNDr. Tom´aˇsPitner PhD., for his worth advice and lots of incentive comments while working on this thesis. I am also much obliged to my parents for their support and encouragement during my studies. And, last but not least, I do appreciate my fianc´ee Pavl´ına.

iii Abstract

Web 2.0 is a broadly discussed term at this time. Nowadays, the is passing through a trasformation showing its new capabilities and web applications design con- cepts. Many Web 2.0 services are presently considered as platforms designed to support creating new ones – the so called mashups. Instruments like open and algorithmic data management form a quite new kind of web applications, sometimes titled infoware. The bulk of social sites has turned the Internet into a main market for processing applica- tions. This thesis is mainly focused on the analysis of the Web 2.0 and the steps leading to the current situation. It presents the principles the current Web stands on both from the view of a Web 2.0 service structure and technologies it is built on. Finally, based on these principles, general rules for Web 2.0 service development are proposed.

iv Keywords

The Internet, web, Web 2.0, web service, Web 2.0 service, , user, content, data, , widget, mashup, open API

v Contents

1 Introduction ...... 1 1.1 Thesis Structure ...... 2 2 The Way towards The Web 2.0 ...... 4 2.1 The Beginning ...... 4 2.2 The Server Side Scripting ...... 5 2.3 The Client Side Scripting ...... 5 2.3.1 JavaScript ...... 5 2.3.2 DynamicHTML ...... 6 2.3.3 DOMScripting ...... 6 2.4 AJAX ...... 7 2.4.1 History...... 7 2.4.2 BasicPrinciples ...... 7 2.4.3 XMLHttpRequest Object...... 8 2.4.4 HowAJAXWorks ...... 8 2.4.5 Disadvantages ...... 10 3 The Web 2.0 Principles ...... 11 3.1 Step by Step: Talking about the Web 2.0 Core Principles ...... 11 3.1.1 TheWebasPlatform ...... 11 3.1.2 HarnessingCollectiveInteligence ...... 12 3.1.2.1Hyperlinking ...... 13 3.1.2.2Blogging...... 13 3.1.3 Creating Data-driven Applications ...... 13 3.1.4 ThePerpetualBeta ...... 14 3.1.5 Cooperate,Don’tControl ...... 14 3.1.6 SomeRightsReserved ...... 15 3.2 The Web 2.0 – The Most General Principle ...... 15 3.3 The Web 2.0 and SOA ...... 15 3.3.1 BrieflyaboutSOA ...... 15 3.3.2 Comparison...... 16 4 Advanced Techniques for the Web 2.0 Development ...... 17 4.1 Widget ...... 18 4.1.1 HowWidgetsWorks ...... 18 4.1.2 DesigningWidgets ...... 18

vi 4.1.3 PlatformsforBuildingWidgets ...... 19 4.1.3.1Widgetbox ...... 20 4.1.3.2Googlegadgets...... 20 4.1.3.3Comparison...... 21 4.2 Mashup ...... 21 4.2.1 MashingProblems ...... 22 4.2.2 LayeredModelofaWebService ...... 23 4.3 ...... 24 4.3.1 POSH...... 24 4.3.2 MicroformatPrinciples...... 25 4.3.3 MicroformatExample ...... 25 4.4 Web Content Syndication ...... 26 4.5 Tagging ...... 26 4.5.1 TagCloud ...... 27 4.6 Infrastructural Web 2.0 Services ...... 27 4.6.1 GoogleMaps ...... 28 4.6.2 GoogleAnalytics ...... 28 4.6.3 MediaWiki...... 29 4.6.4 OpenID ...... 29 4.6.5 AmazonWebServices ...... 30 5 The Web 2.0 in Practice ...... 31 5.1 Content Sharing ...... 31 5.2 Web Application Building Tools ...... 32 5.3 Social Sites ...... 32 5.4 ...... 33 5.5 Content Creating ...... 33 5.6 Overview ...... 34 6 General Rules for Web 2.0 Services Development ...... 35 6.1 General Recommendation ...... 36 7 Conclusion ...... 39 ListofFigures ...... 40 Bibliography...... 42

vii Chapter 1 Introduction

Like many things, the Internet has been evolving since it arose. The times when it was a thing only for exchanging academic information are irrevocably gone. Nowadays, the Internet is different and provides a wide variety of services for its users. It has become a lucrative field for all kinds of business. It offers many people entertainment at arm’s length and is a free place for presenting opinions. Along with evolving services, which the Internet provides, the application framework for supporting these services and its de- velopment is also changing both on the client-side and the server-side. The rapid spread of broadband internet connections has enabled many people to use the Web in another way: as an instrument for their everyday life. And there is just one important thing which has lately emerged and turned the Internet into the new dimension: social networks. So- cial networks join people who are interested in similar or the same things and offer them services to fill their needs – for each other’s communication, presenting their opinions and so on. So that the users themselves have become contributors and formers of the web site they want to contribute to. A good example of such a service, still favourite at this time, is the personal . These events have slowly led to transformation of the Web from the relatively simple system of links to the new Web, today titled Web 2.0. In his famous Web 2.0 article, Tim O’Reilly said Web 2.0 is “the network as platform, spanning all connected de- vices” or “software as a continually-updated service that gets better the more people use it, ...” And a way of “creating network effects through an architecture of participation” is one of the key principles of Web 2.0 ([16], 2005). The Internet has turned into a serious platform for developing applications based upon entirely new concepts distinct from ordinary desktop applications. The Web 2.0 brings many new capabilities and web application design concepts. A user is not only a pedestrian in the Internet’s field any more, he is becoming a contributor by his own intention. Foremost, The Web 2.0 revolution is powered by users themselves. There are many web services called Web 2.0 at this time. Along with the growing use of such services it is quite useful to describe their offers and facilities and show their possibilities for further usage.

1 1. INTRODUCTION

1.1 Thesis Structure

This thesis is divided into four main chapters, not including the introduction and con- clusion. Only general knowledge of web-related technologies is expected. However, the reader should also be familiar with HTTP, HTML, XML, CSS, JavaScript and AJAX for successful understanding of this thesis. Before having a closer look at this thesis structure, we need to show the basic structure of the Web 2.0 in general. There is a concise description of the Web 2.0 structure in the picture below. Relations to appropriate chapters are marked so that we can better under- stand the thesis structure. The chapter titled The Way towards the Web 2.0 briefly describes

Figure 1.1: Basic Web 2.0 structure

the technologies and events which led to the current situation in the field of the Internet, such as AJAX or Dynamic HTML. Likewise, it presents actual principles which creates a face of the Web 2.0 services. In the next chapter, The Web 2.0 Principles, main features of a web 2.0-based sevice are introduced. This chapter covers each of the possible ways of creating a content of the Web 2.0 services as well. The keystone is to encourage users in creating content. The following chapter titled Advanced Techniques for the Web 2.0 Development presents several useful kinds of techniques for building Web 2.0 services in general and shows how to realize the principles introduced in chapter 2. These techniques are also very worthwhile if there is a need to spread content of a web site over a wide range of other web sites. The goal of the chapter called The Web 2.0 in Practice is to compare the Web 2.0 services

2 1. INTRODUCTION offered by two present large companies – Google1 and Yahoo!2. In the chapter General Rules for Web 2.0 Services Development, the several useful points for successful building Web 2.0 service are proposed.

1. http://www.google.com 2. http://www.yahoo.com

3 Chapter 2 The Way towards The Web 2.0

To understand some circumstances around the evolution of the Web 2.0 phenomenon, the following several sub-chapters concisely summarize some software techniques which have innovated web services. These techniques branched out capabilities of the Internet and helped to start the Web 2.0 revolution. This chapter also briefly enlightens us about technologies which currently form a face of the Web 2.0. Furthemore, they aid us to make the content of any web service as well. However, we will quietly omit one essential fact – the user and methods of how to involve them in creating a useful content of any web service. However, remember that the use of the following technologies does not automatically make any web service the Web 2.0 service. As we will see in the chapter 3, the Web 2.0 is more than a collection of various web technologies used together.

2.1 The Beginning

HyperText Markup Language1 – HTML – is the first basic structure used to build the Internet and its content. It provides a straightforward functionality based on the simple principle of hypertext links which enables us to bind and to navigate between particu- lar information sources. The essential feature of HTML is the passivity: users are only readers and a creator of the content is a remote authority burdened with complicated ad- ministration and updating content. Because of this, there are natural tendencies to reach certain parts of interactivity on the Internet. HTML has gone through several revisions since it set in. The version 4.01 was re- placed by XHTML nowadays in version 1.1. Togetherwith CSS2 (Cascading Style Sheets), XHTML creates the footstone of any web page layout (both content and visual compo- nents). But there are many useful technologies for the web devolopment which have appeared during the Internet’s life. They add a dynamic behaviour to web pages both on the server and the client side.

1. For more information about HTML, see http://www.w3.org/html/ 2. To find out more about CSS, see http://www.w3.org/Style/CSS/

4 2. THE WAY TOWARDS THE WEB 2.0

2.2 The Server Side Scripting

The first technology which enabled us to respond to users’ requests dynamically was the Commonn Gateway Interface (CGI) in 1995. A web server processed a user’s requests by executing the service script and the result was sent to the user via HTML. It was possible to generate a unique web page depending upon the user’s request. The connection to a provided a way to separate data itself from the way of its presentation. The service script could be written in any programming language, such as C, C++, Fortran or Perl. The only disadvantage of CGI was the execution speed – the one user’s request requires to execute just one process on the server. Despite this drawback, the Commont Gateway Interface brought an essential im- provement and created the support for the efficient management of large data systems presentation. CGI made it possible to originate miscellaneous on-line discussion forums and groups.And as we will see below, the opportunity for a user to participate in creating web service content is the motivating power of the Web 2.0 revolution. However, there are many server side technologies which have appeared since CGI, such as ’s engine Active Server Pages (ASP), Java Server Pages (JSP) or PHP. All of these work in the same way more or less. There is no need to discuss them more for our purposes.

2.3 The Client Side Scripting

The technologies for the client side scripting have been continuously evolving all the time of the Internet’s life together with improving the server side ones. The effort to achieve a more piece of interactivity and a faster response while the user is operating a web page led to the creation of the relevant technologies. These techniques enable us to change a face of a web page without reloading the whole page.

2.3.1 JavaScript

JavaScript was the first browser-based scripting language for client-side web develop- ment. It is a dialect of ECMAScript standard, weakly-typed, object oriented and inter- preted language having syntax similar to C/C++. It is not important to discuss the details of Javascript for our purposes. It is enough to have an idea about the possibilities to use it for the inovation of web services. To find out more about JavaScript, see e.g. [3]. At first, JavaScript was mainly used to

• check data that a user had put into a webform • open pop-up windows • create dynamic menus

5 2. THE WAY TOWARDS THE WEB 2.0

It can be seen JavaScript itself is not as powerful as we may have expected. However, the cooperation of JavaScript and Document Object Model (DOM) finally brought the real break-trough in client-side scripting.

2.3.2 Dynamic HTML Dynamic HTML is a collection of technologies for creating animated and user-interactive web pages. The main feature is its ability to response to user’s events by changing the face of a web page directly without reloading all the page. In order to attain this, Dynamic HTML incorporates:

• the static part of a document (represented by HTML) • the presentation part of a document (almost always represented by CSS) • the structure of a document – Document Object Model (DOM) and JavaScript binds them all together. DOM is the programmable document structure. Each HTML element is considered as a node within the tree strucuture of a web page. DOM offers a functionality which provides a means to access, change and create or even delete these nodes. In this way it is possible to work with the DOM structure of any web page and modify it so that its face can be dynamically changed. The whole page then looks more lively and attracts more people to use it. More about DOM can be found in [7]. Dynamic HTML was first introduced in the Microsoft 4 . Because of this, DHTML became a sacrifice of the browser war in the end. There are serveral facts which swept the classical DHTML away below:

• script dependence (merely JavaScript could be used) • mixing presentation and functionality • mixing HTML and JavaScript • DHTML scripts do not play well with other scripts

Different implementations by different browsers caused Dynamic HTML to be re- placed by more progressive methods.

2.3.3 DOM Scripting

DOM Scripting has its roots in Dynamic HTML. In the same way as DHTML, it enables developers to access nodes of DOM structure of any valid HTML, XHTML or XML doc- ument. DOM Scripting is not limited by the browser’s implementation (in contrast to DHTML) and is not bound to a particular scripting or programming language. In this it exceed DHTML and offers the equivalent functionality. In order to achieve this, DOM

6 2. THE WAY TOWARDS THE WEB 2.0

Scripting works with the standardized DOM model (the W3C recommendation, see [7] for more). It is important to note that DOM Scripting and the programmable access to the struc- ture of a web page in general is the integral part of current Web 2.0 services when we refer to their face and layout.

2.4 AJAX

The next kind of a technology (it is not a technology in the common sense) which greatly increased the facilities of web pages is AJAX – Asynchronous JavaScript and XML. AJAX stands between server-side and client-side scripting – AJAX script is executed on the client side, but it can communicate with a server-side script by means of the HTTP pro- tocol and allow users to exchange data with the server. Thereby, it makes possible a quite new thing – to update part of a web page dynamically as a reaction to users’ events with- out reloading the whole web page. This essential improvement is the key to the Web 2.0 revolution. That’s why we will describe AJAX in detail.

2.4.1 History

The term AJAX was the first used by Jesse James Garrett in February 2005 (see [13]) as the abbreviation for Asynchronous JavaScript and XML. AJAX itself as a new way of web development was the first used by Google (in and Google Suggest) in 2005. When AJAX was issued, facilities of web services approached common desktop applications.

2.4.2 Basic Principles

For a better idea, we will show what AJAX incorporates:

• presentation by XHTML and CSS • exchanging data by using XML • interaction with the DOM structure • usage of XMLHttpRequest object • any clone of ECMAScript like JavaScript binding them all together

As mentioned above, AJAX itself is not a technology. It binds existing technologies together in a new powerful way and brings many new capabilities for web development. It looks like DHTML or DOM Scripting, but there is something new – XMLHttpRequest object. Let’s have a closer look at what it is.

7 2. THE WAY TOWARDS THE WEB 2.0

2.4.3 XMLHttpRequest Object

This object is the core of AJAX. It behaves as an inter-layer between client and server side and transforms JavaScript calls into HTTP requests (or responses). It enables a client- side script (e.g. JavaScript) to communicate with a server-side script (e.g. PHP). When getting a request, a server is able to send data back to a client in various formats, such as XML, (X)HTML or plain text. To attain this, XMLHttpRequest involves a support for processing HTTP requests of all possible methods like POST or GET. The specification of XMLHttpRequest object is controlled by the W3C recommenda- tion and it is perfecly covered in [4].

2.4.4 How AJAX Works

We will show how AJAX works in the following piece of JavaScript code. We will omit differences in implementation of the XMLHttpRequest object by various web browsers and checking AJAX availability. This is our example below: function foo() { var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4) { // the request is complete // by calling xmlHttp.responseText you can // process content you have recieved from server } } xmlHttp.open("GET", "some.file", true); xmlHttp.send(null); } // do other things

The function foo() can be called as a reaction to a user’s event. We will briefly ex- plain how this function works in the following steps:

1. The variable xmlHttp refers to an instance of XMLHttpRequest object by which we can process HTTP requests and communicate with a server-side script.

2. Theproperty xmlHttp.onreadystatechange specifies the function which will be accomplished when we have received the response from the server we called. In this function we can handle the recieved data and do what we need, e.g. to update a node of the DOM structure.

3. Theproperty xmlHttp.readyState indicates a state that the current request is in.

4. Themethod xmlHttp.open()returns the data received from the server. We could also receive thedata in XML format. In thiscase we have to usethe JavaScript func-

8 2. THE WAY TOWARDS THE WEB 2.0

tions to parse the XML document represented by the xmlhttp.responseXML property.

5. The xmlHttp.open() performs the request. The parameters have the following meaning:

• The first argument is the HTTP request method, such as GET or POST. • The next parameter specifies the name of the server-side script we call. It is not possible to use 3rd party domain names. • The last argument is true if we require asynchronous processing, i. e. the JavaScript function we defined above is working although we have not re- ceived any response from the server.

6. The xmlHttp.send() method sends the server any data if the HTTP request we used is POST.

Apparently, AJAX is the powerful tool increasing interoperability with a user’s activ- ity. However, keep in mind the use of AJAX does not make any web site the Web 2.0 site. To find out more about AJAX and some more examples of how it works, please see [13] or [2]

Figure 2.1: How AJAX works

9 2. THE WAY TOWARDS THE WEB 2.0

2.4.5 Disadvantages Having many advantages and technical innovations, AJAX has several drawbacks as well. We will mention just one main disadvatage because it is important for our pur- poses (others you might find in [2]). The search engines cannot effectively index web pages that use AJAX (and as we will see in the following chapter, this might be a possible problem). This entails some web pages may be inaccesible and web servers have to issue the sitemap – the file in XML format informing the about on that server being available for crawling.

Note: The Web 1.0 Term

The Web 1.0 term retroactively originated as the title for a period before 2004. It involves a use of plain HTML, frames, animated GIF buttons and various HTML extensions (such as the marquee ) in the so-called first browser war.

10 Chapter 3 The Web 2.0 Principles

In this chapter we will explain the meaning of the Web 2.0 term. We will summarize several features and principles by which we can make any web service be more like the Web 2.0 service. Althought this chapter covers most of the typical Web 2.0 principles, the web service need not have each of these to be considered as the Web 2.0 service. We deal with the issue of how to build a structure of the web service. Furthermore, we show how to interest users in creating content of the web service because data is an in- separable part of the Web 2.0 application functionality. Omitting little technical details, we only track the philosophy of the Web 2.0 services and their connection with the user- generated content. At this time the Web 2.0 term is well-known by many people in spite of the fact that it is very loosely defined and has not got any exact boundaries. Rather it has a compact core and the more a Web 2.0 service holds these principles, the better it is. In other words, the core of the Web 2.0 involves a set of design patterns used for the effective building of the Web 2.0 service structure. That is what we try to discuss in the next parts of this chapter.

3.1 Step by Step: Talking about the Web 2.0 Core Principles

The following parts of this section explains the core properties of the Web 2.0 in general. These properties was formulated a posteriori and we should understand them as the out- come of innovations in the field of the Internet which led to a success. In other words, these principles are the consequences of better understanding the capabilities of the In- ternet and their massive re-usage is simply called the Web 2.0. A good example is the transformation of common personal web pages into dynamical personal . Another one is using SEO (Service Engine Optimalization) instead of the domain name specula- tion. The following principles are perfectly covered and broadly discussed in [17].

3.1.1 The Web as Platform Previously (in the Web 1.0 era), the web as platform was limited by the facilities of browsers and server-side technologies. The browser war (Netscape versus Microsoft In-

11 3. THE WEB 2.0 PRINCIPLES ternet Explorer) was waged so the leading companies (like Microsoft) could define trends for better web development. The web browser was only a market for services offered by various companies. It was the key element in the Web 1.0 era. The essential fact is that regular software updates both browser and server-side application frameworks were the only innovations moving web services on. By contrast, Google started its life as a native web application. It is not updated reg- ularly, but it is the continuously expanding service. A user is not bound by the platform they work on so that they can use it anywhere. The user is not required to keep any li- cence agreement. The only thing they can do is to use Google and its service as much as he want. And there is another important fact – Google is not just the web application, it is a database as well. Data itself without a corresponding application is unmanageable, the application without the data is useless. This fact is the essential distinction between the Web 1.0 and the Web 2.0. Services must only be performed and without data are of little use. The data is one of the key parts of any Web 2.0 service. It can also be seen how it is important to involve the users in creating content. The value of the web application is proportional to the size of data it keeps. This is the master feature of the Web 2.0 as platform – its power lies within the inner web structure, not only on the client or server side. Its power dwells on the way by which web software is built and administered. Software is not a product any more, it is a service. Google is the great example of this approach.

The Web 2.0 principle #1: Treat with the web as platform, build your web applications so that they can be considered as another platform. This should be the base of every web application development process.

3.1.2 Harnessing Collective Inteligence Harnessing collective inteligence is a way of generating unique masses of data. A typical example of such a service using this principle is the online encyclopedia Wikipedia 1. It benefits from the user’s activity and the result is the large information database being broadly available. Another good illustration is Panoramio2 – the service for photo man- agement connected with Google Maps. When a user adds a photo, anyone in the world can see it by using Google Maps. The basic scheme of Web 2.0 services to encourage users to create content is sketched out in the following two points: • It is useful to offer a user a benefit in return for performing a web service. • The user generates unique data by which they increase the competitive advantage and the functionality of this service.

1. http://www.wikipedia.org 2. http://www.panoramio.com

12 3. THE WEB 2.0 PRINCIPLES

Therefore, the user is the essential element in the Web 2.0 game. So we could say that the service automatically gets better the more people use it (see [17]). The web is becoming a kind of the global brain. Let’s show yet another examples of harnessing collective inteligence in practice.

3.1.2.1 Hyperlinking

Hyperlinks still are (and it seems they will also be) the basic structure of the whole web. When we allow the user to make a hyperlink (on their personal blog or anything else) whenever they are participating in creating content (e. g. when they are making a reply to a post in someone’s blog), we strengthen the growth of the web at the lowest level. The web thus branches organically in reaction to users’ activity.

3.1.2.2 Blogging

The blogging phenomenon exemplifies the consequences of the approach when users add a value. Bloggers makes the huge amount of data both by posting their opinions and by reacting to other bloggers’ posts. They are always shaping the results of search engines by increasing the number of hypertext links used by search engines to determine the usefulness of the given page. Because the is highly self-referenced, the bloggers amplify their visibility to each other by their activity.

The Web 2.0 principle #2: Allow the users visiting your site to leave feedback at least. The more chances you give the more you can obtain.

3.1.3 Creating Data-driven Applications

This principle results from the one above – data is the inseparable part of the functionality of Web 2.0 services. But it is well-known a small percentage of users participate in creating data. The term data-driven application says we should construct web services so that in the best case, the users produce lots of data as a secondary effect of using the web service. The created data must be unique, hard to recreate, which is the main competitive advantage. In the context of this mechanism we are also talking about the architecture of partic- ipation. The key is to let a user participate as much as possible. Therefore, the Web 2.0 as platform gives us a quite new concept of application development. Sometimes we call this way of application development “the infoware”.

The Web 2.0 principle #3: Treat the data as the user event and let it drive growth of your web application.

13 3. THE WEB 2.0 PRINCIPLES

3.1.4 The Perpetual Beta

This term results from the desktop software development process. It is well-known a soft- ware product is called beta when it needs to be tested before it is officially released. A Web 2.0 service should use this procedure more continually. As we have seen above, the Web 2.0 service is not a product any more, but a service. A service which should be updated constantly at short intervals. The service should hold the motto “often and in small pieces” and be updated as an echo to users’ needs. Therefore, the user is considered as a real-time tester, he is shaping the service just by using it. We can understand this behaviour more widely in the sense of open source software principles – the user can be treated as a co-developer of our web service. Therefore, any Web 2.0 service is bound to the user’s activity. In the picture below we can see the basic components of the Web 2.0 service.

Figure 3.1: Basic Structure of Web 2.0 Service

The Web 2.0 principle #4: Update your web application regularly in small pieces. The label “perpetual beta” refers to the continual development of the web service.

3.1.5 Cooperate, Don’t Control

As we have seen above, data is the inseparable part of any web service. In order to in- crease the value of this data, it is necessary to design the web service so that they can enable the re-use of the data by 3rd party web services in a simple and lightweight way. To attain this, the web service should issue a public API or a kind of interface by which the 3rd party web services are able to access its data resources. These possibilities will be discussed in chapter 4. A typical example and the first pioneer is Google Maps. Its application structure al- lows users to create the so-called mashups – a kind of the Web 2.0 service built by mixing data resources from other Web 2.0 services so that the outcome service brings something new. Apparently, this perfectly accords with Aristotle’s statement“the whole is more than

14 3. THE WEB 2.0 PRINCIPLES the sum of its parts”. The Web 2.0 is not just about “harnessing collectiove inteligence” but also about “harnessing other services”. A Web 2.0 sevice itself ought to be the plat- form for developing other web applications and loosely-couple systems.

The Web 2.0 principle #5: Build your web application in a way that anyone can use your data resources in new unintended ways. Do not control, but cooperate.

3.1.6 Some Rights Reserved

This term shows the main issue of the previous mechanism: intelectual possession of data resources. If the limits for re-using the data resources are high, there is the real barrier to the possible adoption by 3rd party services. The solution is plain enough: to reduce this limitation as much as possible. Notice the term “some rights reserved” is the restriction of the well-known phrase “all rights reserved”.

The Web 2.0 principle #6: Make restrictions for re-using your web service as low as possible.

3.2 The Web 2.0 – The Most General Principle

As we can see above, the Web 2.0 and the “web 2.0-ness” property of a web service is not only about improving software tools for web programming though it is also important. The key principle is to understandthe whole potential of the web as platform. We are only limited by our ability to make the best of available resources, to grasp the web platform more fully.

3.3 TheWeb2.0andSOA

The Web 2.0 principles are very close to the model of business applicacations develop- ment called SOA – Service Oriented Architecture. At this time these architectures con- verge and that’s why we briefly deal with the comparison between these ones. As we already know, the Web 2.0 principles were formulated as the best worked techniques on the Internet, but SOA is a properly defined standard of developing applications. Both ar- chitectures says an application is a part of the system which is bigger than the application itself. The divergence is in understanding the core of either architecture.

3.3.1 Briefly about SOA

The centre of the Web 2.0 architecture is data, but SOA put a service into the centre. SOA defines the properties of the business application development process in the following

15 3. THE WEB 2.0 PRINCIPLES way:

• an application must be decomposed into small and functional pieces called ser- vices • other (business) applications are created by loosely coupling those services

The SOA services cooperate by sending information, which is similar to the object- oriented programming paradigm. SOA is not bound by any explicit programming lan- guage. It is not important to describe it in detail for our purposes. To find out more about SOA, see the SOA reference in [1].

3.3.2 Comparison In this table below we can see some similarities between the Web 2.0 and Service Oriented Architecture (this table is taken from [14]).

Web 2.0 SOA Software as a service Software as a service Interoperability based on web standars Interoperability based on web standars Applications are platforms Applications are platforms Encourages unintended uses Permits unintended uses Mashups Composite applications Rich user interfaces Little guidance Architecture of participation Little prescription of user participation.

Table 3.1: Differences between Web 2.0 and SOA

So, the Web 2.0 can be considered as a global instance of SOA. In contrast to SOA, the Web 2.0 is free managed and emphasizes the social aspect of its services. It also involves the layer to interact with users, but SOA looks like faceless architecture. We have mentioned SOA because of its similarity to the Web 2.0 and more information can be found in [1].

16 Chapter 4 Advanced Techniques for the Web 2.0 Development

In this chapter, we will meet some ways of implementing the Web 2.0 principles described in the previous chapter. We will show some techniques by which it is possible to make the web a dynamic platform enabling 3rd party services to re-use one’s data resources in new unintended ways. Thus, we will focus on technical issues around the content part of a Web 2.0 service. The picture below recapitulates the Web 2.0 structure in the context of topics we deal with in the following parts of the text.

Figure 4.1: Web 2.0 Story

When being considered as platform, the web brings many services containing useful data. These services may be considered as other platforms used for creating the new ones, e.g. mashup. Mashup consists of various data sources connected by means of miscella- neous techniques. It might be another gate which can be re-used by the rest of the world. We are only limited by our inventions to get something new.

17 4. ADVANCED TECHNIQUES FOR THE WEB 2.0 DEVELOPMENT

4.1 Widget

Widgets are a very simple and widely used mechanism to distribute content and ele- mentary functionality among web pages. The widget is a portable piece of a web page designed to be simply re-used. It is very efficient from the point of view of the user’s adoption – the integration of the widget into one’s web page is of two basic steps only: modifying the web page layout and updating the source code of the web page, in the best way by using cut and paste only. The widgets allow web services to effectively offer the rest of the Internet’s world (and mainly common users) their content and functionality and thus leverage networks effects. Historically, there were already many widgets in the Web 1.0 era. Advertising banners or very popular web counters are very good examples. An idea when a web page uses a snippet of HTML code from another foreign web page to provide added functionality is well-known longer. Internally, the widget is an embedded piece of HTML (or XHTML) code cooperating with a remote web service script providing its functionality and information about its look and feel. The essential feature of the widgets (in contrast to public APIs which are much more richer) is their simplicity – both in the range of functionality and in the way of consumption. There are several kinds of the widgets according to technology by which they are built: • JavaScript/HTML widget, sometimes called gadget (mainly by large web services like Google or Microsoft). are a typical example. • Flash widgets. They are used with HTML tag to incorporate into a web page. YouTube flash widget allowing to share any video content in any other web page is a great example.

4.1.1 How Widgets Works

We can see a simple interaction between a web page and a server offering a piece of its data as a widget in picture 4.2 below. A web page source code contains an embedded link to the remote web service operat- ing a widget. When the request to display the web page (contaning the widget) has been sent, the remote script processing the widget is called. Then the client receives the data necessary for successful rendering and working the widget. One can see the widgets may overload the server processing the widget if it is popular.

4.1.2 Designing Widgets When you are creating a widget, it is recommended you hold a few principles discussed below. Do not forget the widget is the simplest way of spreading content of a web service over a wide range of other web sites (see [15]).

18 4. ADVANCED TECHNIQUES FOR THE WEB 2.0 DEVELOPMENT

Figure 4.2: How Widgets Works

• Security – Prevent your widget from a use which might affect its common nor- mal or make possible accessing someone’s private data (if any exists). Remember, widgets are public.

• Reliability – the popularity of a widget can grow exponentially fast the more peo- ple use it. Because the widget is called from a remote web server but not from the web service that uses it, it may overload the parent web server. Be aware of this.

• Intellectual property issues – State clearly the terms of use of your data. Protect your data properly so that no-one can take it out from the widget or you might loose control of this data.

• Easeof consumption– Make usage of yourwidget as easy as possible. The simplest way is to apply mere cut and paste.

• Leveraging network effects – Let users expand your widget on the other web pages. Encourage them in this.

• Motivate users – Motivate users so that they want to use your widget. Offer them a useful functionality or content, enable them to share their private data.

• Make various looks and feels – Enable usersto modify look and feel of your widget so that it can correspond with the face of their blogs or web pages.

4.1.3 Platforms for Building Widgets

Although there are lots of possibilities to build your own widget, there are also platforms and web services dealing with building and managing widgets. They provide us with an interface suited for building and sharing widgets. We will present two of these platforms to illustrate the term web as platform.

19 4. ADVANCED TECHNIQUES FOR THE WEB 2.0 DEVELOPMENT

4.1.3.1 Widgetbox Widgetbox1 is a complex web application for building, sharing and managing widgets. It contains visual tools for creating various kinds of widgets with the possibility to edit the source code. Widgetbox widgets can be integrated with foreign web services such as MySpace2 or Facebook3. One can create various kinds of widgets: • JavaScript and HTML widget • Flash widget. All you have to do is to enter the flash file (source file) URL from which Widgetbox builds up the flash-widget. • Web page widget. It contains widget-sized web page hosted on your server. In order to build it, it is enough to enter the source web page URL. • Blog widget (the so-called blidget). It is build by entering your blog’s RSS or feed source file. It displays actual content of your blog in compact form. • Import Google gadget. Only XML source file of your gadget is needed to make up the Widgetbox widget. After building, the widget is put into the public widget gallery. It is possible to watch the statistics of its use and manage it in other ways. The widget is also assigned a unique URL address within the Widgetbox.com domain by which anyone can access the widget (and then find out how to use it, i. e. how to get HTML code calling the widget script). For more information about Widgetbox, see [9].

4.1.3.2 Google gadgets Google gadgets are widgets built by means of HTML and JavaScript. They can be embed- ded in any web page within