Friday, May 14, 2010

Fancy Image Slider on fluent JS, as a JQuery Plugin and as a YUI3 Port

Here lies the story…

First I decided rewrite my old BlogSlideShow JS-class. In fact I have a plan to rewrite all of my old works gaining to update functionally and appearance regarding to nowadays fashion and make better their code. You can see what I got at the demo page. So, after I finished with implementation on fluent JS, without use of any external library I ported it on jQuery. After that I wrote also implementation on YUI3. I’m fond of both those frameworks and found that is a good practice top have the same task solved thrice in different ways. So here is my observations experienced the task.


Doing the same with different tool

Fluent implementation and the jQuery plugin don’t differ too much. jQuery just already provides all the helpers I need and solves the troubles caused by different browser peculiarity. Thus, working without jQuery I had to write a simple Dom-element selector, functions to bind and unbind event handlers, CSS loader, helper for inserting HTML into DOM-tree and viewport state detector. And of course I was obliged always remember of IE specific requirements.

As for YUI3 implementation, it had taken me longer. That’s not just about porting of the code, but another philosophy of coding, if I may to say so. But YUI3 force you to write more maintainable code with explicit structure and logic. Briefly that is a declaration of a widget where parsing rules, rendering and UI binding are standardized. Though I’m going to make an article especially about this someday.


Blog Slide Show


So what about the slider?

Actually the component when it’s initialized scans DOM-tree for the occurrences of the A elements (links), that provided with attribute rel of blogslideshow value ('a[rel=blogslideshow]' selector). It attaches to them handler on click events. The handler creates an overlay with the image of Url specified in href attribute of clicked link. On hovering event (mouseover) the handler shows tool bar with navigation buttons over the image. On click event handler change image with next or previous in the collection derived during the links scan. Though if the effect type is specified the image change is attended by some fancy show. For that I use a sort of asynchronous queue and isolated class (effect) with effect callbacks.


How to make my own effect?

The queue has following public methods:

  • add(options) - adds an asynchronous iterator into the queue, which will call 'iteratedCallback' of 'iterations' times and then invoke 'completedCallback'
  • run – starts processing of the queue
  • stop - use it, when you need to cancel the queue immediately

Options:

object options {
startedCallback : function, // OPTIONAL. Invoked before iterations started
iteratedCallback : function, // invoked when every iteration
completedCallback: function, // invoked when the bunch of iterations completed
iterations : int, // number of expected iterations
delay: int // delay in msec
reverse: boolean //- OPTIONAL. When reverse is true, decrementing, otherwise incrementing
scope: object // context of use
}

So, having this tool we can declare effect implementation in the following fashion:

aQueue.add({
startedCallback: effect._fadeStarted,
iteratedCallback: effect._fadeIterated,
completedCallback: effect._fadeCompleted,
iterations: 3,
delay: 100,
scope: this}).run();

Here in effect._fadeStarted handler we can overlay the current image with next one, which opacity style is about zero (it’s totally transparent). effect._fadeIterated receives as parameters counter and number (iterations number). So we can use them to change opacity of the appearing image till it becomes pretty solid. effect._fadeCompleted can be used to clean background picture (we don’t need it anymore) and align image overlay to the viewport center according to the new image size.

Another case, when you want during the effect a sequence of transitions. E.g. the old image is disappearing ad then the new one starts showing up. So here are two of iterators :

aQueue.add({
startedCallback: effect._fadeStarted,
iteratedCallback: effect._ fadeIterated,
completedCallback: effect._ fadeHalfCompleted,
iterations: 5,
delay: 150,
scope: this,
reverse : true}).add({
iteratedCallback: effect._ fade Iterated,
completedCallback: effect._ fadeCompleted,
iterations: 5,
delay: 150,
scope: this}).run();

Well, I hope you’ll find it pretty easy to apply a new effects on the slider and looking forward see them. Now when CSS3 provides us with new amazing features, that seems the only limitations we still have is in our imagination. Enjoy!

Tuesday, October 23, 2007

Social Network of New Generation

Some days ago I found an invite for Yahoo! Mash in my mailbox. I had noticed both Google and Yahoo announced social networks of new generation. Still there is not much information about Google’s trial – Social Stream. We only have a low-grade screenshot (http://www.hcii.cs.cmu.edu/M-HCI/2006/SocialstreamProject/index.php) and scanty description.



So it seems as some sort of aggregator, which allows you to use your contacts and services from third-part projects (Youtube, blogs, flickr and so on). Since I’ve got an invitation to Yahoo! Mash I was not to fail to discover that solution. There we are. Mash is obviously a breakthrough service among social networks. Calling of such every network is giving you ability to create you own page in order to present yourself, draw there your friends and organize your contacts.



Where is the trouble? Such a service has to be simple to understand and at the same time rich of user services. Mash developers managed to give both those advantages to their network. It’s enough to fill some lines to get your home page within Mash. Then you add new bars onto you page if you wish. Mash has a gallery of applications like Facebook.com. You can choose and pick up any you see fit to your page. Moreover you are able to structure application bars on you page with Drag&Drop like on Netvibes.com. But what is really “know-how”, your friends on Mash can edit your page (if you allow that). Now imagine, a girl has got an invitation. She got her home page, but she doesn’t know what to do with it. She is ready to put it away and forget it. A friend of hers adds some nice applications there and setup a glamour decoration. Now she is happy. She invites all her numberless friends to the page. Then she discovers a Pet gadget of her page. As she sees the Pet may be fed and petted she forces all her friend to give it a treat. That gives boundless potential of service spreading.



Mash looks as a well thought-out service, but I see an improvement the developers let pass. What all these social networks are about? To help a user to get new friends, help to choose from millions the people, who are really interesting for the user. The people who what to expand their circle of acquaintance wish to know before start of a conversation who is the potential interlocutor, would be he or her really conversable and interesting. MySpace asks users “describe yourself” to let others know you. Is it so easy to be honest with it? Somebody answers “I’m tall, strong and handsome”, somebody says “I’m so complicated”. That all is nothing for the one who is keen to form own opinion of a person. Well, Yahoo! Mash suggests to answer some questions like “If I were an animal, I would be”. As for me it hardly uncovers somebody to me as a person. Besides those questions rather remind me of job interview, but they don’t induce me to answer. Recall how pleasant conversations start in real life. You are in a train roomette amidst unknown people. Somebody starts with “By the way I had the other day such an interesting incident…” After some time everybody joins to the conversation with their own occurrences. So, it were so logical to answer people within social network profiles questions like “tell us what interesting happened to you recently” or “what funny you recall from your childhood”. Then developers can add a form to respond the user’s story with your own. Thus we can have a real alive conversation this way. I think developers will use such natural questions in social networks and we can find more people of kind we like.

I'm at Yahoo! Mash http://mash.yahoo.com/dsheiko

Friday, June 08, 2007

Site Sapiens-based Information Networks

Nowadays, the Internet can be seen as a platform ideally suited to a new generation of corporate information networks. Such networks provide effective user interaction, despite geographical remoteness, operating system, program and device distinctions. To get to know how to create such networks by means of Site Sapiens platform listen to the podcast…

Thursday, March 29, 2007

Rich Internet Applications and Content Management

Today everyone talks about Web 2.0. But while the idea of a collective intelligence, implied here by the term's inventor Tim O'Reily remains an object of trivial speculations, it is obvious that the World Wide Web is changing. Web applications are increasingly approaching the level of functionality, which is usually found only in desktop applications. And as this trend is gaining momentum, we can already witness the dawn of a new era brought about by a novel kind of web applications - Rich Internet Applications (IRA). At the same time, the popularity of terms like Web 2.0 and RIA makes developers use them as an attractive label on their products, without actually understanding the meaning behind those notions. So what does RIA mean, eventually?




The term Rich Internet Applications (RIA) was first mentioned in Macromedia's promotional materials in March 2002. By this the company's managers wanted to point out that the well-known Flash technology is not limited to creating attractive visual web-elements, but can also be used to develop fully functional web-based business applications. Apart from providing user with data, static pages of older-type sites are much less flexible in terms of user-data interaction compared to desktop applications. Every time you request additional data (navigate the site) or upload data to server the pages have to reload. This is often inconvenient and, above all, can compromise security because of the possibility of data loss (say, due to a lost server connection). Yet this is exactly the way Web 1.0 works. Every time you type URL or save data in a web form, server receives instructions which it then uses to form a page you see next. With RIA, there's no need to reload pages. As you click to receive additional data or send data to server, the latter receives corresponding instructions and uploads the results onto the page. The application receives server's response and changes accordingly. For example, if you browse an internet catalogue of an older type, every time you hit the button "next 20 items" you will have to wait for the page to reload and for a new page to shape. With a RIA-based site, you can request items 50 to 80 or all items in a specified price range on the same page, and with every new query only the list of items will be updated.


Today RIA can be developed with the help of AJAX, Adobe Flex, Windows Presentation Foundation, Flash, Java-applets, Java and some declarative languages - such as XUL and MXML. Of all these tools only AJAX and Flash gained wide popularity - mainly because they are easily available. And whereas development of Flash-based applications is quite a resource-consuming and expensive process, developing RIA with AJAX takes hardly more time then it would with an older-type, classical web-site. In most current projects Flash is only used when it is needed.


The very name - AJAX (Asynchronous JavaScript and XML) - reveals the essence of the technology. It allows the client engine and the server-based part of the web-application interact asynchronously. This means that your browser can request server at any point (say, when you hover your mouse over a link) and, vice versa, server can upload data to browser at any time, without waiting for a new page to be requested. How does it actually work?


One of the most popular uses that AJAX has found is in the web-based drag & drop technology. You must have already seen the virtual desktop services - such as found at www.netvibes.com and www.pageflakes.com. Their users can arrange widgets (useful data from other servers) on the screen and adjust their size just like we usually do it in Microsoft Windows. These features are now increasingly found in business-applications. For example, at www.atlas.cz users can customize the starting page with as much ease as any virtual desktop.


The possibility to customize pages with the help of ready-made design templates reduced the dependence of CMS (Content Management Systems) users on site developers. Using the mouse a CMS administrator can arrange various data modules, specify their size, color and other attributes at a page. Then s/he can save the current configuration which will later be displayed to site users. Yet advantages provided by Drag&Drop technology to CMS administrators are even greater when it comes to site content management. In latest CMSs all the administrator has to do to change position of any document in the structure (or of an entry in the list) is to drag and drop it at the desirable point. It is exactly the way files are managed in Microsoft Window Explorer.


ria_drag_n_drop_01.gif

As we've already mentioned, with RIA there's no need to upload all the user data at once. Parts of it can be uploaded later, when they are actually requested for. For example, when administrator switches to the CMS's site structure management interface, only the basic level of the hierarchy tree is loaded. If later user wants to explore any of the tree's "branches", the additional data will be uploaded instantly. This feature is even more important in managing various lists. The application returns to the interface only those entries that user specifically requested. Moreover, even data input procedures acquire new features. Modern web-applications increasingly offer input option which acquired wide popularity thanks to Google Suggest service. As soon as you start to type something in the required field, a dropdown list appears with suggestions based on the already typed in elements. Those who at least once had to, say, choose a producer from a seemingly endless dropdown list in the SELECT field will fully appreciate the convenience of this feature.


ria_likegooglesuggest_02.gif

The fact that there's no need to reload the page every time its user performs an operation changes the very perception of a web-interface. You can type in data in several forms placed on one and the same page but, say, on different tabs. Then all the data can be saved simultaneously. And, importantly, in case due to some reason (a lost connection, an internal error etc) the data is not saved, the interface will report it and let you try again. And we all know only too well that poor security was one of the basic flaws with older-type web interfaces.


It is obvious that apart from everything else IRA-based sites can report the status of processes and their results. Today it is only perceived as natural when any element involved in some system operations displays their status on a special bar. Let's say, for example, that you requested a list of specified items to be displayed by an e-catalogue. In that case you have the right to know what the system is up to from the moment of query to the moment the list is displayed. If due to some reason the server is unable to return the requested data, you should receive the corresponding message.


ria_statuslines_03.gif

With RIA the functionality and security of CMSs reach a totally new level, which earlier was available only with desktop applications. Yet we should not forget that RIA-based interfaces are capable of interacting not only with their own server software, but with third-party applications as well. This fact lets us hope that present-day CMSs will gradually evolve towards ECM (Enterprise Content Management), thus bridging the gap between corporate sites and corporate network information resources.


This article features examples of Site Sapiens 3.0 CMS interfaces (www.sitesapiens.com)

Monday, January 08, 2007

How to Make AJAX Read between the Lines

Your site may contain a wealth of technical terms. The user while viewing it may have to wonder about their meaning. What can be done to provide site visitors with instant answers to the questions they have? Previously technical terms were represented as links so that users could click them and get a definition window. This approach, however, is rather clumsy and time-consuming: one has to click the link, wait for the definition window to load and then close it. Now with AJAX we can move closer to users’ expectations. We can make the message window appear instantly once the mouse is over the term and disappear when the mouse moves farther. This service will not affect the size of your web-pages. When the contextual help is required Java Script will get definition from an external dictionary and display it.



The method for getting information through an implicit request can be applied not only for technical dictionary. Have you ever wondered about the double underlined links in such projects as hotscripts.com and devarticles.com? This is context-dependent advertising based on IntelliTXT engine from Vibrant Media (www.vibrantmedia.com). When the mouse cursor points to such a link an advertisement window appears. This technology is referred to as in-text advertising.



This method is also increasingly used on news portals. The main page contains only the news headings. Yet when the user puts a mouse cursor over the heading a short description appears. Thus the main page can hold a lot more news. The visitor sees the headings and all he/she has to do to get a short summary is to browse through the items with a mouse cursor.



Let us now look into how contextual help can be implemented with AJAX. Any developer familiar with this method will be able to make portal comment on news upon request or write an in-text advertising module.



Obviously, we have to think of a message window which will appear every time the user puts a cursor over the keyword. For the window to appear and disappear instantly it should be placed in a hidden DIV








<div id="InstantMessage" class="instant_message"> </div>




To keep things simple we can make it look as a regular MS Windows system message









<style>


.instant_message { padding: 5px; font-size: 12px; font-family: Arial; visibility: hidden; position: absolute; width: 240px; border: outset 2px #FFFFFF; background: #D4D0C8}


.instant_message a { width: 240px; padding: 2px 17px; color: black; text-decoration: none; cursor: default}


.instant_message a:hover {color: #ffffff; background: #0A246A}


</style>




The window should appear the very instant user puts a cursor over it and disappear when the cursor is out. And at this moment the window should already contain the definition text, not a blank space. This means that we should place the terms in the document within an inline-tag that supports events onMouseOver and onMouseOut. The first event should be assigned a Java Script function which will get the term definition, place it into the window and display the window. The second event should be assigned a function which will simply hide the message window.











<a onmouseover="getDefinition('term', event);" onmouseout="hideMessage();">term</a>





In the window displaying (getDefinition) function parameter we should specify the term. AJAX will use it to get the definition text. As we have to position the displayed window under the mouse cursor we should pass event parameter to this function to provide support of Gecko-based browsers. The hide message function (hideMessage) does not require any parameters.



Now our task is to make JavaScript position the message window when getDefinition function is called.








function adjustMessage(evt) {


MessageObj = document.getElementById('InstantMessage');


if (isThisMozilla) event=evt;



var rightedge = document.body.clientWidth-event.clientX;


var bottomedge = document.body.clientHeight-event.clientY;


if (rightedge < MessageObj.offsetWidth)


MessageObj.style.left = document.body.scrollLeft event.clientX - MessageObj.offsetWidth;


else


MessageObj.style.left = document.body.scrollLeft event.clientX;


if (bottomedge < MessageObj.offsetHeight)


MessageObj.style.top = document.body.scrollTop event.clientY - MessageObj.offsetHeight;


else


MessageObj.style.top = document.body.scrollTop event.clientY;



MessageObj.innerHTML = 'Loading...';


MessageObj.style.visibility = "visible";


}






Thus, we have a “data loading” message window. Now we should request term definition from the controller. You can write your own AJAX (http://en.wikipedia.org/wiki/AJAX) request functions. Yet if you are new to AJAX I can recommend Yahoo library (http://developer.yahoo.com/yui/). In that case the request will look as follows:








function getDefinition(term,evt){


adjustMessage(evt);


var request = YAHOO.util.Connect.asyncRequest('POST', 'http://controller_address', callback, 'term=' term);


}




Clearly, we cannot request a controller we haven’t written. Generally, this is the simplest step. The controller’s task is to return term definition requested in POST. Whatever programming language you should use for this purpose, only a couple of basic operations are required:




  1. connect to database
  2. perform an SQL request to get the definition
  3. display the result as follows:








{


"errormsg" : "error code in case of error",


"content" : "definition text"


}





This is a data format known as JSON. Java Script accepts it as an explicit declaration, as “native”. In case you use Yahoo AJAX library the controller’s response is handled by the following construction:









var handleSuccess = function(o){


if(o.responseText !== undefined){


showMessage(o.responseText);


}


};



var handleFailure = function(o){


if(o.responseText !== undefined){


showMessage("Connection Error");


}


};



var callback =


{


success:handleSuccess,


failure:handleFailure,


argument:['foo','bar']


};






The only thing left is to describe the showMessage() which puts the text received into the message window









function showMessage(json) {


var respondStructure = eval( '(' json ')' );


MessageObj.innerHTML = respondStructure.content;


return false;


}




As you realize, to hide the message we only have to change object attribute








function hideMessage(){


var MessageObj=document.getElementById('InstantMessage');


MessageObj.style.visibility="hidden";


}




Trying this out you are unlikely to encounter any problems using MS IE. Yet, if you use FireFox, you might observe the message window flicker. This happens due to FireFox’s specific handling of onMouseOver/onMouseOut events. But this can easily be solved by putting delay flags into functions that handle these events.



The scripts from this example can be found at http://www.phpclasses.org/browse/package/3505.html


The working example at http://cmsdevelopment.com/thesaurus/

Thursday, November 16, 2006

Interactive Grid with Your Own Hands

I am sure being ‘pampered’ by GUI of desktop applications, users find interfaces of web-applications as extremely uncomfortable. Their notes, probably unexpressed, are timely within AJAX Age. Besides, it is not so difficult to make web-applications more user-friendly. I will not describe whole variety of interface forms in this article, but will concentrate on such an indispensable element as a grid. Almost every web-application needs linear data list management. DB record management of PhpMyAdmin is likely a classical solution in this field. It is a popular solution, but it demands page reloading for every operation, data loss is possible and so on. Let us think about what requirements should be included to be a user-friendly interface should have. The user should have the ability to sort the list by fields, filter the list, the possibility to assign a range of selecting and pagination. With all this going on, only part of the application window should be changed.

As far as you probably know, basis of AJAX is XMLHttpRequest. It is a Java Script instrument, which allows to perform requests to a remote server script and receive its responds. Thus, when a user is initiating some event (for instance, click to an icon), we can immediately inform the server script. When the server script receives the request, it starts to ‘find out’ in referred parameters what it should return, for example, the record list, which is sorted by some user input criterion. Java Script retrieves the list and displays it in a table area. The user watches, with pleasure, the line order of the table being changed to his input request., while all other forms of this application window remain unchanged.

Figure 1. Model of the solution
Figure 1. Model of the solution

How to do it? Use of XMLHttpRequest is not a difficult task. However, we can simplify this by adding a ready script library to our arsenal.. I liked a solution from YUI toolkit (http://developer.yahoo.com/yui/), which is known as Connector. With help of unpretentious construction, YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData); we can send POST-parcel to the specified address and analyze the response from the server script with the function, assigned within callback.

So, by using HTML, we describe the interface to the future of the grid. We omit areas, which are dependent on server script responds (records list, indicator of record number), but leave “anchors” so that we can manage content from those areas dynamically. It can be any sort of HTML-containers with the assigned unique ID. Next, we describe the functions of server respond processing. For example,



Listing 1

var handleSuccess = function(o){
if(o.responseText !== undefined){
document.getElementById(divName).innerHTML = decorateList(o.responseText);
}
};

var handleFailure = function(o){
if(o.responseText !== undefined){
document.getElementById(divName).innerHTML = 'Server Error';
}
};

var callback =
{
success:handleSuccess,
failure:handleFailure,
argument:['foo','bar']
};




Likely, someone will question “But what do we receive from server?”. We receive content of server script console. In the simplest case, it will be HTML of the updated table. But it means mixed data and its decoration. I.e. every table modification will demand modification of the server script, which will adversely affect readability of application business logic. Classical universal solution of data structure transferring is XML. In that case, we will have to analyze reported content each time with Java Script and form HTML or give that charge to XSLT. You can read about it in the “AJAX:Getting started” article at http://developer.mozilla.org/en/docs/AJAX:Getting_Started. But I suggest to use another more comfortable format JSON(http://en.wikipedia.org/wiki/JSON ). It will allow to transfer less amounts of data, will not have difficulty with special symbols and we will have no need to analyze server script responds. JSON is for Java Script ready to use construction.

So, now we only need to define set of parameters of various events and add their processing into the server script. Assume, if “Show” button is pressed, we are passing to the server script, taken from INPUT TEXT the list offset and number of displayed records. The server script inserts those values into SQL query and transforms the record list to JSON form. We can “run” about received array lines and decorate them with HTML.

Figure 2. Commercial grid sample
Figure 2. Commercial grid sample

As you can see, the new opportunities are coming to us. We can make Java Script on the client side to repeat requests automatically right up to successful transaction, if there are any troubles with a network connection. We can realize adequate indication of the process. We can make the filters more interactive by sorting the list automatically in accordance with the entered part of the filtration key. Well, we can use as much of our imaginations as we allow.
You can download the code archive (http://www.phpclasses.org/browse/package/3481.html), which contains all of the files you will need to create the working examples presented here.

Friday, November 03, 2006

Aspect-oriented Software Development and PHP

Aspect Oriented Software Development (AOSD) is a methodology meant to implement new aspects in software component using external components, but without altering the code that implements the core functionality.



The AOSD concept was applied originally by Java developers. They developed a compiler that implements the AOP (Aspect-Oriented Programming, an implementation of AOSD) white box approach, i.e. the compiler the merges the code that implements the software components core functionality with the necessary code alterations to implement the new aspects where necessary.


This paper provides an introduction into the paradigm of aspect-oriented software development (AOSD). It includes a multitude of practical examples, provided with a view to objectify such abstract approach as AOSD, as well as to help the reader easily grasp its essence and advantages. The paper is primarily intended for programmers working with PHP. Its aim is to demonstrate a way of applying AOSD in PHP-based projects already today.




Introduction



Object oriented approach has been popular for a number of years. Its advantages can hardly be visible within short-term projects, yet any major long-term one simply cannot do without it. Object-oriented programming languages provide the tools necessary to present business logic in a demonstrable form. Today UML Class diagram (http://en.wikipedia.org/wiki/Unified_Modeling_Language) does suggest itself even on the stage of developing the system logic.



Demonstrable business logic makes it easier for new participants to join in, helps to save time for those developers that come back into the project at later stages. It also considerably reduces the number of mistakes. But is implementing object-oriented approach enough to develop the demonstrable business logic? Obviously not. To create smart object-oriented programme architecture is not an easy task – unless you were able to successfully implement methods described in the book by Martin Fowler called Refactoring: Improving the Design of Existing Code.


Yet even now one can find not encapsulated functionality (crosscutting concerns) in a number of various classes (logging, caching, synchronizing, tracing, monitoring, debugging, run a security check, start a transaction, open a database connection). AOSD (aspect-oriented software development, http://en.wikipedia.org/wiki/Aspect-oriented_programming) is capable of organizing this kind of program logic.



What is AOSD?



Aspect-oriented software development (AOSD) is a relatively new approach in the area of developing business applications. This approach is based on the notion of Aspect. Aspect is a standpoint for considering some other notion, process or perspective. To be able to quickly discern the underlying idea of the approach, let us try and consider various aspects of a web-site. Information architecture defines a site’s structure. Usability refers to the degree of site’s friendliness towards the user. Graphic design determines the visual perception of a site. The functional model describes its business logic. All of them are various components of the web-site development process, and each component requires specific resources, approaches and solutions. For a project to be successful, all of the aforementioned components are to be efficiently developed and implemented. Lest someone should find this example too complicated, let us consider a simpler and more universal scheme. When an apartment building is being designed, the architect had to first elaborate a framework, then the wirework scheme, then the water supply plan and so on and so forth. Each of the stages in this process is a different aspect, a different perspective of the project. No matter how trite it may sound, a similar approach can be implemented in software development for identifying various aspects of business logic within applications. More than 20 years ago Bjarne Stroustrup (http://en.wikipedia.org/wiki/Bjarne_Stroustrup) arranged the programme code within C++ into sets of logical entities, whose behaviour and interactions could be defined in a number of ways (inheritance, encapsulation, abstraction, polymorphism). It is a reliable and time-tested paradigm of software development, known as object-oriented programming. Yet this approach has certain limitations as to the decomposition of application business logic aspects. Over the years that have passed since the time this paradigm emerged, a number of approaches aimed at overcoming the said limitations have emerged. Among them are adaptive programming, composition filters, aspect-oriented programming, hyperspaces, role-modelling, subject-oriented programming and so on. Lately, the development of such approaches has moved to the area of AOSD. As we have already pointed out, the cross-cutting concerns code is going to be distributed among the various modules, which will inevitably impair the quality of the software with regard to the transparency of business logic, its adaptability and upgradeability. The aim of AOSD is to isolate the cross-cutting concerns and place it outside applications’ business logic.



Let us consider some integrated web-application, for example CMS, and try to imagine at what point and in what way we are likely to encounter the above-mentioned difficulties. Suppose, a certain number of system functions require converting input data from XML to arrays. Due to the fact that in this case XML-parsing aspect involves only a limited number of functions, it doesn’t imply considerable extension. As it is clear, in such case there’s no need for extensive decomposition and therefore no need for AOSD to be implemented. The simplest and most logical solution would be to include this procedure into the root class method (or, otherwise, into the external class, depending on the specific circumstances) and activate it when it’s needed.


Acceptable decomposition

Figure 1. Acceptable decomposition



Yet no manipulations with objects are going to help if we have to monitor the productivity, and our task is to take on demand the readings of all functions performed, at their entry and exit points. An attentive reader would suggest that we should resort to the previous example and use trigger for activation or deactivation of statistic data capture. Well, we can only warn him or her that, should a need arise for logging system transactions in specified cases, it will become necessary to recall all the details of programme architecture and to reorganize it.


Inadmissible decomposition

Figure 2. Inadmissible decomposition



It would be much more practical to task the system with handling specified events in certain objects within a given aspect. Suppose, after some time new security requirements have to be introduced into a large and sophisticated project. We then create a procedure for additional security checks and task the system with carrying out this procedure at the activation of specified methods within the security aspect. This is implied by the paradigm of AOSD. We set up a new abstraction level outside the existing program architecture, and then in it we declare a functionality that in some way is applicable to the whole of the system. As you can see from Figure 3, it is possible to define program procedures that attend the system, say, within the security aspect, and then place them outside the main classes. In the same way we can treat the input data validation aspect procedures. Thus, with each time we make the business logic more evident and demonstrable. As a matter of fact, what we get as a result is a clearly defined business logic in system’s main classes and precisely distributed outside the essential model cross-cutting concerns.


Aspectual decomposition

Figure 3. Aspectual decomposition



Let us sum up:


· the aspect-oriented approach is based on the principle of identifying common program code within certain aspects and placing the common procedures outside the main business logic;


· the process of aspect orientation and software development may include modelling, design, programming, reverse-engineering and re-engineering;


· the domain of AOSD includes applications, components and databases;


· interaction with and integration into other paradigms is carried out with the help of frameworks, generators, program languages and architecture-description languages (ADL).



Basics of Aspect-Oriented Approach



Aspect-oriented programming allows developers to organize cross-cutting concerns into individual declarations – aspects. It provides possibilities to define functionality for specified program execution points JoinPoints (method activation , class construction, access to a class field etc.). Languages that support aspect-oriented programming (AOP) more commonly employ functions for a set of points – Pointcut. The functionality at those points is determined by the program code which is politely referred to as Advice (AspectJ). Thus, aspects describe crosscutting concerns for a specific set of system components. The components themselves include only business logic that they are supposed to implement. During compilation of the program the components are associated with aspects (Weave).



To better grasp the basics of aspect-oriented programming, let us once again consider the example, which involves defining the productivity monitoring aspect. (see Figure 2). Suppose, we want to take the timer readings at entry and exit points of all the methods within such classes as Model, Document, Record and Dispatcher. So, we have to introduce into the Logging aspect a Pointcut with the listing of all the required functions. To cover all of the methods of a certain class, most AOP-supporting languages employ a special mask. Now it is possible to define the needed Pointcut. We set up Advice at the entry (Before) and exit (After) points to the methods listed in the Pointcut. Usually, Advice in AOP-supporting languages is available for such events as Before, After and Around, though sometimes other events are also present.



Thus, the following basic AOP declarations may be singled out:



Aspect – a definition of a certain set of cross-cutting concerns performing a specific task;


Pointcut – a code of an Aspect’s applicability: defines when and where the functionality of a given aspect may be applied (see Figure 3)


Advice – a code of an object’s functionality: a direct functionality code for the specified events. In other words, this is what is going to be executed for the objects listed in the Pointcut.



Still too complicated? Well, I think everything will become clear once we introduce some practical examples. Let us begin with the simplest of them: http://www.phpclasses.org/browse/package/2633.html. I wrote this small library with a view to demonstrate both the advantages and availability of AOSD. Besides, you don’t need to know every detail of PHP or custom software to be able to use this library. It is sufficient just to enable aop.lib.php in your scripts in PHP 4 (or later version) in its standard configuration.



It is possible to define a certain aspect for crosscutting concerns (let’s say, for keeping transaction log), through initiating the Aspect class:




>>begin textbox<<


Listing 1


$aspect1 = new Aspect();


>>end textbox<<



Then we set up a Pointcut and specify the methods it affects:



>>begin textbox<<


Listing 2


$pc1 = $aspect1->pointcut("call Sample::Sample or call Sample::Sample2");


>>end textbox<<



The only thing remaining is to specify the program code for entry and exit points for the methods of the current pointcut:



>>begin textbox<<


Listing 3


$pc1->_before("print 'PreProcess<br />';");


$pc1->_after("print 'PostProcess<br />';");


>>end textbox<<



In the same way we can define an additional aspect, for example:



>>begin textbox<<


Listing 4


$aspect2 = new Aspect();


$pc2 = $aspect2->pointcut("call Sample::Sample2");


$pc2->_before("print 'Aspect2 preprocessor<br />';");


$pc2->_after("print 'Aspect2 postprocessor<br />';");


>>end textbox<<



In order to enable one or several aspects just use the Aspect:::apply() function:



>>begin textbox<<


Listing 5


Aspect::apply($aspect1);


Aspect::apply($aspect2);


>>end textbox<<



As you probably know, before PHP 5 emerged handling method and class events was somewhat of a problem. Whereas for global events – for instance, PHP errors, - one can develop a specific handler, for handling events at entry and exit points of methods it is necessary to “manually” insert some kind of “notifiers”. In our case we’d need to insert special Advice::_before(); and Advice::_after(); functions:



>>begin textbox<<


Listing 6


class Sample {


function Sample() {


Advice::_before();


print 'Class initilization<br />';


Advice::_after();


return $this;


}


function Sample2() {


Advice::_before();


print 'Business logic of Sample2<br />';


Advice::_after();


return true;


}


}


>>end textbox<<



As it is clear from the above example, inserted before and after method’s business logic code are “notifiers” for these events. When PHP processor finds such a “notifier”, it checks for the active aspects. In case there is one, PHP checks for the current function specified in the Pointcut. If the function is there, it is activated for the given event (for example, for Advice::_before()). As you see, it is quite simple. But what is the practical value of this approach?



Suppose, we have inserted “notifiers” into all the class methods of our scripts and enabled aop.lib.php library. Then one day a need arises to obtain a detailed report on the distribution of workload among the functions of our project. We set up an aspect and define its Pointcut, which includes all functions within the project:



>>begin textbox<<


Listing 7


$Monitoring = new Aspect();


$pc3 = $Monitoring->pointcut("call *::*");


>>end textbox<<



As it is clear from the example, it’s possible to use *::* mask. Then in Advice we can employ a conventional function for the calculation of exact time in milliseconds (ms):



>>begin textbox<<


Listing 8


function getMicrotime() {


list($usec, $sec) = explode(" ",microtime());


return ((float)$usec + (float)$sec);


}


>>end textbox<<



With its help we can take time readings at entry points of each of the project’s functions and compare it with the readings at the functions’ exit points; the obtained time of business logic operations within the body of the function is stored in global report variable. The only thing remaining is to display the report at the end of the program cycle. An example of employing productivity monitoring aspect is presented in the sample_trace.php script found in the archive of the distribution kit.


Moreover, this library allows you to register your own system events and define cross-cutting concerns for them in the future. Your own events could be defined in any place of application code:



>>begin textbox<<


Listing 9


Advice::_event("AllAPILibrariesAreLoaded");


>>end textbox<<



We could add event handler for the necessary events to make an additional decomposition or include a new plug-in in a complete application:



>>begin textbox<<


Listing 10


function MyController() { return "It’s controller";}


$aspect3 = new Aspect();


$pc3 = $aspect3->pointcut("call *::*");


$pc3->_event("AllAPILibrariesAreLoaded", "MyController();");


$pc3->destroy();



Aspect::apply($aspect3);


>>end textbox<<




Lest you should get an impression that AOSD can only be used for certain specific tasks, let us consider another example.



PHP is quite tolerant towards various types of variables. On the one hand, this is a very positive feature for it means that there’s no need to constantly check for compliance with the specified types and waste time for the declaration. On the other, this could lead to errors.


In case a project contains a huge number of functions, it is hardly possible to remember the syntax we have devised for them. Yet misplacing even one single argument can cause unpredictable changes in a function’s behaviour. Can AOSD be of help in such situation? Definitely! Let us recall the diagram in Figure 3. As you see, classes Document and Record contain similar methods add, update, delete, copy, get. A well-organized program architecture presupposes similar syntax for these methods: add($id, $data), update($id, $data), delete($id), copy($id1,$id2), get($id). AOSD can help us to organize the program architecture – as well as our own activities. We can set up input data validation aspect and define the Pointcut for the Document and Record class methods. The add, update, delete, copy and get entry event function can check for the type of the first argument. If the latter is not integer, an error has surely occurred. It is also possible to set up the second Pointcut for the add and update methods. What is going to be checked in this case is the type of the second argument, which obviously has to correspond to the array type.



In this way we can place transactions logging outside the project business logic; now it is possible at any time to define functions, which require additional checks for security etc.



Of particular interest is the fact that with the help of AOSD we can provide for a specific system error warning to be displayed for a specified set of functions. Suppose, a number of our functions participate in setting up WML (WAP), WSDL (SOAP), RSS/ATOM or SVG mark-up code. Obviously, in this case it is unacceptable to display HTML-code with the error message. The “notifier” in PHP error processor will make the system display the message either in XML, or use non-visual means (for example, send a notification via e-mail).



Anyone who at least once participated in the development of commercial software, knows how difficult it is to solve the issue of updating the final product. Certainly, we are all aware of the existence of the version control software – for instance, CVS (Concurrent Versions System, http://en.wikipedia.org/wiki/Concurrent_Versions_System ).Yet the problem is that every new product, based on the previous one, requires certain customization, and more often than not it is not at all easy to find out whether the update is going to affect areas customized for a specific project. Some of you have surely encountered cases when after an update you had to restore the whole project from back-up copies. And now just try to imagine a case when “disappearance” of customized features is noticed only a long time after the update! “Well, where does AOSD come in?” you may ask. The thing is that AOSD can exactly enable us to address this issue: the whole customization code can be placed outside the project’s business logic as crosscutting concerns. You only have to define the Aspect of interest, specify the area of its application (Pointcut) and elaborate the corresponding functionality code. It is worthwhile trying to imagine how exactly this is going to work.



Let us recall my favourite example featuring content management software. Such product is sure to contain a function for displaying recordsets Record::getList() and developing code for these sets View::applyList(). Within arguments Record::getList() receives a recordset indicator and data selection parameters. This function produces an array with data on the results of selection. View::applyList() function receives this array at the input point and generates the format code – for example, HTML code for a table. Suppose, in our product a goods catalogue is presented as such recordsets. This is a universal solution for a commercial product, yet for every specific project based on this product it is necessary to introduce into the sets an additional column. For instance, tables in the original product have Stock Number and Item fields, while we need to add one more, Customer Rating field. In order to do this, we write Advice for the function Record::getList(), which establishes that an additional column is inserted into the returned array at the end of the runtime.


If the View::applyList() function is incapable of adjusting itself automatically for the changes in the input array, then we shall have to write Advice for this function as well.


Let us assume that later on the client demands that we should mark out all the entries in the sets, which include goods not found in store at the moment. In this case we add Advice for the View::applyList() function, in which we check for the value of the Available in store attribute. Notice that we may set up a separate Plugins folder for aspects declarations and scripts that include their funcyionality. Thus, we shall have a complete set of customization features for any sort of a project stored in one specified folder, and there will be no upgrading problems whatsoever. We’ll be able to easily upgrade any system scripts, except for those stored in the Plugins folder.



Aspect-Oriented Software Development in PHP



At present there are a number of advanced projects, whose authors have introduced various techniques of AOSD and PHP implementation. The AOPHP project (http://www.aophp.net ) includes a PHP preprocessor written in Java 1.5. We can write a usual PHP-code, but we’ll also have to notify the preprocessor of our intention to use AOSD. To do this, we’ll use <?AOPHP ?> structure instead of <?PHP .. ?>. The crosscutting concerns can be put into separate scripts.



>>begin textbox<<


Listing 11


before(): execr(add($x,$y)) | execr(sub($x,$y)){


echo "<font color=red>Im About To Add/Sub $x & $y</font><br>";


}


>>end textbox<<



If necessary, these scripts can be enabled by issuing instruction while declaring AOPHP code:



>>begin textbox<<


Listing 12


<?aophp filename="aotest.aophp,aotest2.aophp" debug="off"


// PHP code


?>


>>end textbox<<



Seasar.PHP project (http://www.seasar.org/en/php5/index.html) employs a different approach. Its authors use XML for structuring aspect declarations, while integration is carried out with the help of PHP, which then executes the resulting code through eval() function.



MFAOP project (www.mfaop.com ) is based on an approach slightly resembling the one I mentioned in the above examples. The project’s author suggests that first one should set up a Pointcut and then use it according to what is needed:



>>begin textbox<<


Listing 13


$pointCut = new PointCut();


$pointCut->addJoinPoint('Example', 'Foo');


$pointCut->addJoinPoint('Example', 'Bar');


$test1 = new Aspect($pointCut, before, 'echo "Before $MethodName";');


$test2 = new Aspect($pointCut, after, 'echo "After $MethodName";');


>>end textbox<<




Unlike in aop.lib.php library, when using this solution there’s no need to manually insert “notifiers” for each function. Yet we’ll have to install an additional PECL Classkit extension on the server.



From my point of view, the most elegant solution has been found by PHPAspect project (www.phpaspect.org ). This was possible thanks to the effective use of new capabilities provided by PHP5, and in particular – the possibility to set up abstract classes. PHPAspect introduces into the language of PHP a specific structure; which presents the declared aspect in a demonstrable form.



>>begin textbox<<


Listing 14


aspect TraceOrder{


pointcut logAddItem:exec(public Order::addItem(2));


pointcut logTotalAmount:call(Order->addItem(2));


after logAddItem{


printf("%d %s added to the cartn", $quantity, $reference);


}


after logTotalAmount{


printf("Total amount of the cart : %.2f €n", $thisJoinPoint->getObject()->getAmount());


}


}


>>end textbox<<




As it’s clear from the example, the interval of the specified aspect is precisely defined. The Pointcut and Advice are set up in a way that is so concise and yet capacious, that one may think this is the “native” PHP syntax. This project provides handling capacities for 7 (!) types of Join point events: call, execution (exec), class construction (new), attribute write-in (set), attribute read operation (get), class destruction (unset) and block catching (catch). There are three possible types of Advice: before, after, around. This project developed unusually flexible masks for defining surveillance intervals in Pointcut. Thus, for instance, it is possible to assign intervals for all classes with the specified prefix in the name:



>>begin textbox<<


Listing 15


new(*(*));


exec(* Order::addItem(2));


call(DataObject+->update(0));


>>end textbox<<



To be able to install PHP Aspect, you’ll need PHP 5.0.0. or later versions, and have PEAR Console_Getopt, Console_ProgressBar, PHP_Beautifier libraries installed.



This project was successfully presented last year at the PHP conference (http://afup.org/pages/forumphp/) in France (this is where the project originates from), and as for as I know is making good progress. It is possible that Zend Inc. will include the experience generated by this project into the following versions of PHP.



Conclusion



Obviously, AOSD is not a universal solution. AOP is not going to eliminate all bugs or develop software on its own. I doubt that every developer using aspect-oriented programming will get a Nobel Prize. Moreover, this approach is hardly going to become the dominant one in the future: object-oriented approach has been popular for 20 years, yet many developers still confine themselves to procedural code. On the other hand, the advantages of AOSD before object-oriented programming are as obvious as OOP’s advantages before procedural programming. I think I’ll be on the safe side if I say that those developers who use AOSD are one-step ahead of the others. Their code is clearer, easier to perceive, it contains less errors and can easily be developed. Thus, AOSD engineers are capable of implementing larger-scale, more reliable and versatile projects. Importantly, AOSD does not require complete retraining of developers. AOP doesn’t alter programming logic drastically, as it was the case with transition from procedural to object-oriented programming. AOSD just extends it. Developing a new program architecture, you only extract from the objects everything that you think doesn’t fit there and find a suitable place for it. Imagine that for years you’ve tolerated a piece of sculpture, which totally disagrees with the overall design of your home, but which you treasured as a gift. And then one day you find an inconspicuous niche in the wall where the sculpture seems to fit perfectly. “Well then,” you’d say in that case, “this is where it really belongs!”



Apart from all that has already been said, AOSD is easy to get used to – unlike, for example, TDD (http://en.wikipedia.org/wiki/Test_driven_development). At first, one could try and put into aspects simple crosscutting concerns, like logging, and then gradually extend decomposition of program architecture, accumulating in aspects various domains of the application.



Perhaps, some are confused by the fact that at present PHP does not officially support AOSD. Yet in this very article I have presented several examples of how you can easily integrate basic AOSD approaches on your own. It is the essence of AOSD that is important, not the particular way in which it is implemented. Whatever approach you chose, if you were able to achieve efficient decomposition in program architecture it is inevitably going to improve the quality of your product. Today AOSD is supported mainly by extensions to popular programming languages, yet the leading players on the market are not going to stay out of it, and AOSD is gradually finding its way into the popular programming platforms (http://www.internetnews.com/dev-news/print.php/3106021). AOSD is not going to become a new technological revolution, yet evolution, on the other hand, is inevitable. Whether you follow it or take the lead is a matter of your own choice.



Resources & References


[1] Pan-Wei Ng, Ivar Jacobson. Aspect-Oriented Software Development with Use Cases. Addison Wesley Professional (Dec 30, 2004), ISBN: 0321268881.


[2] Robert E. Filman, Tzilla Elrad, Siobhan Clarke, Mehmet Aksit. Aspect-Oriented Software Development. Addison-Wesley Professional (October 6, 2004), ISBN: 0321219767.


[3] Ramnivas Laddad. Aspect Oriented Refactoring. Addison-Wesley Professional (September 29, 2006), ISBN: 0321304721.


[4] Ivan Kiselev. Aspect-Oriented Programming with AspectJ. Addison-Wesley Professional (July 17, 2002), ISBN: 0672324105.



· http://en.wikipedia.org/wiki/Aspect-oriented_programming


· http://eclipse.org/aspectj/


· http://phpaspect.org/


· http://www.aophp.net/


· http://www.seasar.org/en/php5/index.html


· http://www.phpclasses.org/browse/package/2633.html


· http://www.informit.com/articles/article.asp?p=375541&rl=1


· http://www.devx.com/Java/Article/28422


· http://www.scriptol.org/history.php


· http://www.ercim.org/publication/Ercim_News/enw58/mens.html


· http://www.cs.ucl.ac.uk/staff/C.Courbis/papers/12jan04Board.ppt


· http://www.computerworld.com/developmenttopics/development/story/0,10801,85621,00.html


Discover a World of Fascinating People


It is common to encounter success stories that begin with the words: “I’ve have been lucky in my life. I’ve made good friends and met like-minded people who have helped me from the beginning. Thanks to them I have achieved my dreams”. It is evident that not everyone reaches their goals and not everyone us is lucky enough to meet people who can direct their life towards success. The Internet epoch has introduced a tremendous new option in the realm of communication. Social networking through web-portals has gained popularity, providing individuals with an alternate form of communication. Internet communities have been created allowing users to exchange thoughts and build friendships based on similar interests. The contemporary net communities provide tools that support an individual’s spiritual and professional growth.


The social networking framework on the Internet is similar to our own social networking framework in real life. We gather for social networking in places where other individuals with similar interests are. For some parties or nightclubs would be where they would find the best networking opportunities. Depending on your interests it could be anywhere - athletic clubs, professional meetings, conferences, exhibitions, the opportunities are unlimited. Anywhere that there is a social gathering that piques ones interest there is an opportunity for social networking. Internet communities operate in a similar way. Individuals are drawn to these communities based upon their interests and those of their friends. After entering the community they begin to network with individuals who share similar interests. Those individuals also have their own network of contacts allowing for the number of contacts to grow in geometric progression.



If interests of persons in your friends list are really close to your, likely our friends’ network will develop quickly. In the case where some of your first contacts have similar interests, it is probable that your number of contacts will become independent and show a high quality growth.



These Internet communities can be divided on two basic groups: general interest community and professional business communities. I hope, the following table helps to get your bearings rapidly in great set of social networking services.



General interests’ community



































MySpace.com



The most popular community of this social networking category. It has a user-friendly interface and a wide variety of users.



Friendster.com



The largest community within this social networking category. It allows users to work with photo albums, blogs, and create a net of friends. This community also allows users to create joint file archives and broadcast messages within a given network of friends.



Hi5.com



This community provides all the basic functions of social networking but is most often used as a dating service.



MeetUp.com



This community is oriented on bringing together user groups based on their interests with the purpose meeting in the future in person.



Orkut.com



This community is accessed by invite only. It is an elite club where a user needs an invitation from one of community members in order to gain entry to it.



360.yahoo.com



This community requires the user to present him/herself and find the users with similar interests. It offers an integration with the popular exterior services such as Yahoo Groups and Flickr.com



Spaces.msn.com



The Spaces community has a comfortable interface of a personal space administration. In particular this service contains pictures uploading, which approaches to MS Windows Explorer. This service is able to spread within friends’ network news about blog updating through MS Messenger.



Hometown.aol.com



The America online community allows the user to create their own web page, decorate it, and notify the other users about its existence.



Whoat.com



This community connects users who are in the same location. It’s enough to set your location in the system and it will bring your together with those who are in the same zone as your mobile phone, PDA, PC.



Sms.ac



The community of “mobile” users. The project helps to create personal, mobile-available web space. Within this space the basic social networking options are provided.



Closedsociety.net



This community is accessed by invite only. A user needs an invitation from one of community members in order to gain entry to it.




Professional business community




























LinkedIn.Com



This is the most well known professional community. The project is optimal for job seekers, researching professionals in certain fields, and for establishing contact with other professionals.



Ecademy.com



The different business fields professionals’ community. Paid participation.



OpenBC.com



Sometimes this project is being called euroversion of LinkedIn. Though OpenBC is inferior to LinkedIn in a number of participants. At the same time, OpenBC lets to adapt interface for user’s native language and provides a wide variety of many other services.



Spoke.com



Paid project. It helps to user in a new business prospective search.



Ryze.com



Project offers all the basic options for social networking and it are being used often as a general interests’ community.



Ziggs.com



The project lets to create users’ profiles, which are going to be indexed in search systems. The typical for search systems interface is being used for the business contacts finding.



Zerodegrees.com



This service is supposed to connect you with the influential people who could help to boost your career and business.



Tribe.net



This project includes both traits of General interests’ community and Professional business community. At present time Tribe is more often being used for social purposes. For example, you moved to a new city. In this case Tribe will help you to find out everything about the accommodation, restaurants, concerts and others.




The legendary project LiveJournal.com can be called the pioneer of general interests’ community. It is quite possible that the mentioned project is the most active blogging system so far. In a recent time MySpace.com community gained the most popularity. This particular community became the first among the top requests of Google’s users in 2005 (http://www.google.com/press/zeitgeist2005.html). This community counts more 47 million of users. The following is Friendster.com the previous leader (21 million). How did it manage to come out into leaders? The answer is obvious – the wide variety of free services. Besides the basic options of these kind of system, such as a personal page creating, conducting of blogs with the comments, photo albums and inner email, MySpace offers a lot of options for user’s pages arranging, creating the general interests’ microcommunities, the users ranging, conducting the forums, coverage of local events, co-participation in games and even musical online albums for songs’ authors creating. Undoubtedly, the large-scale players couldn’t leave without their attention such a “piece of pie” of the Internet market. As a result, such social networking solutions appeared: Microsoft (http://spaces.msn.com), Yahoo (http://360.yahoo.com), Google (http://Orkut.com) and AOL (http://hometown.aol.com). In many aspects they are quite similar. However there can be singled out (marked out) the unexampled convenient interface for photo album managing in Spaces.msn.com. Though, from the other side the photo album pages’ addresses in this system looks like technical garbage and it is extremely difficult to exchange them. Evidently, Yahoo took into account that Microsoft experience and added an option to synchronize the photo albums with Flickr.com, the one of most popular system of photo album conducting for today.



Thus, if our purpose is to find new contacts based on the similar interests, we can achieve that soon and easy by means of above mentioned communities. In a case we are looking for the business contacts, the general interests’ communities of social networking barely can help us here. Among business oriented communities LinkedIn.Com was the one of the first, which has gained popularity. This project is popular today too. By means of this project you can create the detailed personal profile and then ask yours previous and current supervisors, colleagues, who participate in this network, to post their recommendation letters to every stage of your seniority (working experience). It will definitely help to gain a “bonus points” in time of getting prestigious business contacts. Any community is valuable by its content (essence, substance) first of all. The more there are potentially demanded by you community’s members (participants), the more valuable this community for you. On this point the professional community Ecademy.com should be mentioned. However, as we have to pay for quality, the full membership in Ecademy.com cost money. There is also a developing community Ziggs.com which is worthy of our attention. The Ziggs.com developers have focused on the idea to let the system’s users to present themselves and find the necessary contacts as easy as they find the documents by means of the search engine. As a result, there are more than 3 million registered professionals from more than 90 thousands companies in Ziggs.com today.



Several words should be devoted to Plaxo.com. This is a specific project, which has developed from the electronic “business card” service and it counts about 5 million business cards at present moment. There is a desk (hand) program within the project that expands the features of your email client’s interface. For example, you can get the automatic notifications from your friends about different events.



In a conclusion I would say the following. Do not expect that if you post a profile (even the interesting one!) in one of network communities, you will find a lot of new friends. In the Internet you should be as active as in the real life for finding friends. The mentioned projects will help you to find congenial souls or professionally close people. However it is your task to get their interest.


Data, its presentation and user interface forms


XML has acquired a distinguished popularity lately. No one doubts its perspectives of overall use. The concept of semantic web is no longer an abstraction and is implemented into life with confidence. In the world net's information cacophony there appears harmony. In the hands of talented conductors such as W3C, ISO, OASIS it can diversify into a symphony.


Today XML family has so many standards available that it seems there should be quite enough for all possible aspects of information technology world. It is generally so. But let's see how XML era has influenced ordinary web development tasks.


To deliver information to a user a site is needed. Web site content should be managed and that involves separation data from its presentation. The task is still often solved with the help of templates in program technologies. Though now we have XSLT technology at our disposal. Any document can be represented with data that is structured in detail with the help of XSL. It is quite enough to report the corresponding XSL template to define a proper graphic presentation for the data. XSL language is polymorphous and permits high flexibility in format changes of documents.

This might seem to be St.Grail of web development - we add XSL tools to our arsenal and shorten the time of the project development thus raising its quality.


However if we analyze time spent at creating a web project, it turns out that programming of user interfaces takes the most time. It is one thing to fill in the information, to deliver it to the user, and it is another thing to reconstruct multifunctional and easy to navigate interface. The tendency of content volume growth in the Internet is also worth mentioning here which makes effectiveness of user interfaces even more important.


XSL technology gives opportunities for managing document's presentation theoretically with any form of user interface. With its help the state of user interface can be analyzed and algorithms for data presentation be created depending on the conditions. But XSL operates XML data and it is necessary to prepare corresponding XML data file to assign an ordinary navigation menu in XSL.


In practice it turns out that XSLT template layers contain a mixture of user interface forms and presentation algorithms. Moreover the logics of user interface database forming is duplicated in CMS program code. How to avoid unnecessary program coding? How to achieve more visual presentation for user interface form algorithms?


In October 2004 Red Graphic Systems company published XML Sapiens specification. This technology aspires to take the place of a layer between XML and XSL. When XML Sapiens processor meets a link to a file with user interface forms' script, initial XML file is broaden with appropriate data. Let's suppose we want to form a vertical site menu page. We will need to create a script file (interface.sapi) and to describe a user interface form in it (DDC menu). We indicate that under any environment conditions we want to have reflection of the whole menu content. Using sapi:for-each construction, we can request any necessary data from CMS system function.


Then we manage enumeration of the data. We specify what exactly and in what cases should be returned within enumeration process. To send data dynamically formed by script to the initial XML-file we only need to arrange pointers. That means that after script file interface.sapi analysis XML Sapiens processor will broaden initial XML data file to the extent that is necessary for the following XSLT transformation.


Initial XML



<?xml version="1.0" encoding="UTF-8"?>
<?
xml-stylesheet type='text/xsl' href='template.xsl'?>
<?
xml-sapi type='text/xml' href='interface.sapi'?>
<
content xmlns:sapi="http://www.xmlsapiens.org/spec/sapi.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
    <data1>data1</data1>
    <data2>data2</data2>
  <menu><sapi:apply name="ddc.menu.value" /></menu>
  <title><sapi:apply name="qc.title.value"></title>
  <publication><sapi:apply name="qc.publication.value"></publication>
</
content> 


 XML Sapiens file script interface.sapi



<?xml version="1.0" encoding="UTF-8"?>
<
sapi version="1.0" xmlns:sapi="http://www.xmlsapiens.org/spec/sapi.dtd">
 <sapi:ddc name="menu">
 <sapi:choose>
  <sapi:when exp="TRUE"> 
  
<sapi:for-each select="get_tree()">
    <sapi:choose>
      <sapi:when exp="TRUE">
        <sapi:code>
          <row sapi:id="this.this.id.value" sapi:activity="this.this.currentpage.value">
                     <link><sapi:apply name="this.this.href.value" /></link>
            <item><sapi:apply name="this.this.title.value" /></item>
          </row>
        </sapi:code>
      </sapi:when>
    </sapi:choose>
   </sapi:for-each>
  </sapi:when>
 </sapi:choose>
 </sapi:ddc>
</
sapi> 


XML Sapiens script algorithm (interface.sapi)





XML Sapiens script algorithm (interface.sapi)



Final XML



<?xml version="1.0" encoding="UTF-8"?>
<?
xml-stylesheet type='text/xsl' href='template.xsl'?>
<
content xmlns:sapi="http://www.xmlsapiens.org/spec/sapi.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
    <data1>data1</data1>
    <data2>data2</data2>
    <menu>
     <row id="01" activity="1">
      <link>/intro/</link>
      <item>Introduction</item>
     </row>
     <row id="02" activity="0">
      <link>/chapter1/</link>
      <item>Chapter 1</item>
     </row>
     <row id="03" activity="0">
      <link>/chapter2/</link>
      <item>Chapter 2</item>
     </row>
    </menu>
    <title><![CDATA[Introduction]]></title>
    <publication><![CDATA[<p>Content</p>]]></publication>
</
content> 








It should be admitted that transfer of CMS instructions and receiving of the requested data from the script directly make web development process much easier. Such approach gives opportunity to disengage from the system language programming. Taking this into consideration the document content to be administered can be requested from CMS in XML Sapiens script directly. You just place the corresponding markers in the initial XML.

Displayed document formation chart


Displayed document formation chart

 



It is hard to predict XML Sapiens' perspectives now. Unlike above-mentioned XSL, it is not an approved W3C standard. Though the tasks covered by XML Sapiens specification such as separation of user interface form algorithms from data presentation, clearness and availability of algorithms descriptions, are quite up to date. This project might attract the attention of developers' community. That could result in appearance of new technologies able to increase the quality and profitability in web development.



Linked resources: