Include to favorites
Log in Logout Register
Start Login Contact Help Photos What's new
Avanced Search
FAQ
RESULTS IN: TEXT IMAGES

Hello, Guest
Login  Register
Online: 90 visitors

Blogging (2)
Business (1)
Educational (2)
Gadgets (1)
Games (2)
High Tech News (1)
Internet (0)
PC (1)
PDA (0)
Photography (0)
Science (1)
Software (1)
Wireless (1)


Browse by date

<< August 2008 >>
MonTueWedThrFriSatSun
123
45678910
11121314151617
18192021222324
25262728293031




Recent searches

Popular searches

Hot this month

Weblogs Archive


GADGETS AND GAMES DIRECTORY :: > Software Register Weblog >  Software Tech Weblogs - WEEKLYBITS.COM GADGETS AND GAMES DIRECTORY
Yahoo User Interface Blog
generated by http://wordpress.org/?v=2.3.3  en Blogger
SEND A FRIEND
Suscribing to  please login first
User: Login

Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications.
News and Articles about Designing and Developing wiht Yahoo! Libraries.Visit Yahoo! User Interface Blog
Address URLhttp://yuiblog.com/blog    Registered: 26-Apr-2008
Ads:

Send to email
Visit Creating Component Communication Pipelines with YUI (Decoupling) Creating Component Communication Pipelines with YUI (Decoupling) in Developmentbubbling librarycaridy patiño mayeacustom eventsdecoupling
By Caridy Patiño
el 22-Apr-2008
Caridy Patiño Mayea

Caridy, a leading and always-helpful contributor to the YUI community forum, has been working in front of a PC since the nineties. For the past eight years he’s been a professional programmer developing LAMP applications for the University of Las Villas where he received his B.S. in Computer Science in 2003, and for several companies around the world. He left his university job in August to pursue an independent consulting career and to follow his passion for open source solutions and agile development.

For the last two years he’s been focused on JavaScript as a development platform. Early last year he decided to create an easy-to-adopt YUI extension called “Bubbling Library” as a side project; you can read his YUIBlog introduction to the Bubbling Library here.

Creating complex web applications demands organization and modularization. Modularization introduces a new problem ? the comunication pipes between components. This is a serious challenge for developers, as more components and widgets mean more pipelines and more dependencies. In this article, we’ll look at a technique to mitigate these issues: Creating an abstraction layer to moderate the comunication between the components and widgets in a web application. This technique is based on YUI and makes use of my Bubbling Library, which is a BSD-licensed superset of functionality that builds on top of the YUI foundation.

Most current YUI components use "Custom Events" as their main communication pipes. This is good. Using custom events you can, for example, know when a YUI Panel is opened or closed, and the components in your application can subscribe a listener to this custom event to know when the Panel’s status changes.

YAHOO.example.myPanel.showEvent.subscribe(function(){  // your stuff here…});

The weakness of this model is that all the components in your application need to know about or have access to the YUI Panel object to subscribe a listener. Even worse, they all need to wait until the YUI Panel instance is created (because that’s when the custom event is created and becomes available for subscription), so they need to be aware of the timeline in the application. If you need to introduce a new component in your application, to attach a listener you must wait until the YUI Panel has been created. What happens if you have several panels instead of one? You keep adding more and more listeners, creating more dependencies, and more timeline control.

The solution for this overwhelming amount of complexity is simple and very useful for complex web applications. Those who are accustomed to high-level programming languages, blackbox programmers,and APIs fans will love this implementation for sure.

Decoupling

The idea here is to create components that do not need to know about other components in the application. Each component will catch certain messages (listening events) generated by another component, o create a new message (broadcasting events) based on the received message, and fire the new message to reach all the listeners. We’ll have an abstraction layer that will allow us to subscribe listeners for a specific message. For example:

YAHOO.Bubbling.on( 'onPanelShow', function(layer, args) {
    // do the job here…
});

DecouplingIn this diagram, we have two components that will broadcast a message to the abstraction layer (Custom Behavior Layer), reaching all the listeners for that specific message (keying on the message’s name).

Each component will also have three listeners (C1: B1,B2 and B3; C2:B4, B5, B2). In the case of the message B2, both components will be listeners for the same message, and both will be able to react when the message arrives.

What’s critical here is that we will be able to subscribe listeners to an undefined event, without worrying about what will fire this type of event or about what else might belistening for the same event. And this new listener will be executed whenever something (a component in your application) fires an event with the same name, in this case onPanelShow.

On the other hand, we will be able to fire an event, without previously defining it. For example:

YAHOO.Bubbling.fire ('onPanelShow', {  param1: value1,
  param2: value2});

This call will send a message to all listeners, passing the name of the layer and the literal object (second argument).

We can go one step further, and pass the YUI Panel’s reference in the literal object, and the listeners will be able to query the Panel instance’s data, check the panel name, etc. For example::

var myPanel = YAHOO.widget.Panel("win", {fixedcenter: true});

myPanel.showEvent.subscribe(function(){  YAHOO.Bubbling.fire (’onPanelShow’, {    panel: myPanel,
    param1: ‘value1′,
    param2: ‘value2′  });});

Each time the YUI Panel is displayed, a broadcast message will be fired, the name of the event will be onPanelShow, and the listeners of this type of event will be queried, using the panel, param1 and param2 as references. There are some interesting aspects to this example. You don’t need a global reference for the Panel object because there will be no subscribers attached directly to the YUI Panel object. Instead, we will subscribe the listener to the abstract layer (YAHOO.Bubbling). You can have more than one Panel, each Panel will fire the same event, and the listeners will be able to handle the broadcast without knowing anything about the Panel’s nature or environment. Finally, each subscriber will be able to define its execution scope, using the 3rd parameter:

YAHOO.Bubbling.on( 'onPanelShow', myListenerFunc, myScope);

Utilized well, this technique gives us the possibility to create a complex web application where each component will have an API to use for communicating with other components without knowing the component itself, or knowing the nature of the component.

Requirements

The Bubbling Library YUI Extension has already implemented this technique, so the requirements are simple:

<script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/yahoo-dom-event/yahoo-dom-event.js"></script><script type=”text/javascript” src=’http://js.bubbling-library.com/1.5.0/build/bubbling/bubbling.js’></script>

* Bubbling Core (6k minify version)

Other examples

  • Creating a notification system that will handle application messages ? displaying each message in a box on the bottom-right corner of the browser, with different backgrounds, all the components in your application will be able to broadcast a message; the notification system will catch the event and will display the message in the corresponding box, depending on the parameters sent by the sender.
  • Creating a loading mask (just like Gmail) that will display the message every time that the YUI Connection Manager, the YUI Get Utitlity or the YUI Loader starts waiting for a response from the server. In this case, all the components will have access to the Connection Manager, and each component will need to fire the LOADING EVENT every time it uses one of the loading mechanisms.
  • In a web app that supports multiple layouts ? every time you switch the current layout, all the web parts will need to be notified in order to readjust the visual interface. All the components can define a listener to the switching action, and all will be notified with the name of the new layout to apply and new css rules isplaying or hiding certain information related to the component.
  • In a webmail system, you need to be notified when a new message arrives or when an unread message has been read. There are some pieces of the application that would be interested in this event (inbox, messenger, the message counter, etc), but the reader panel don’t know which of these parts are present on the page.

Conclusions

  • This technique is ideal for a large development teams. It reduces the complexity of the code and minimizes the number of global variables by eliminating the hard pipelines between components.
  • Large applications with many dynamic areas are tricky when you need to control the loading timeline. Using this technique you don’t need to worry about the loading timeline.
  • Applications based on this technique are easy to extend.
  • Each component has a simpler API making it easier for other developers to understand and reuse.
  • All the listeners will share the same syntax
    YAHOO.Bubbling.on('onEventName', function(layer, args) {});


Read 5 times

Suscribing to  please login first
Creating Component Communication Pipelines with YUI (Decoupling) -  Tech Weblogs - WEEKLYBITS.COM  Blogger Is a collection of i

Photologs

Yahoo User Interface Blog Blogger

Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries.

Creating Component Communication Pipelines with YUI (Decoupling)
Caridy Patiño Mayea - Creating Component Communication Pipelines with YUI (Decoupling) Caridy, a leading and always-helpful contributor to the YUI community forum, has been working in front of a PC since the nineties. For the past eight years he’s been a professional programmer developing LAMP applications for the University of Las Villas where he received his B.S. in Computer Science in 2003, and for several companies [...] [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 22-Apr-2008 by Caridy Patiño in Developmentbubbling librarycaridy patiño mayeacustom eventsdecoupling
Read 5 times. More hits in More articles Creating Component Communication Pipelines with YUI (Decoupling) Images about Creating Component Communication Pipelines with YUI (Decoupling)
Nerdblog Blogger

Provides news about hardware, software, notebooks, laptops, PCs, Mac, PDAs
Nerdblog.Net

The memristor
Nimage 7991 Memristor - The memristor Purported to be the forth major electronic component, HP is introducing the memristor - The new component is called the “memristor” — a word blend of “memory” and “resistor”. The physical working model and the mathematical model of the component were presented side by side in a paper in the journal Nature, yesterday. Four [...] [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 02-May-2008 by Nerdblog in General
Read 5 times. More hits in More articles The memristor Images about The memristor
Yahoo User Interface Blog Blogger

Is a collection of industrial-grade JavaScript utilities and widgets that enable you to efficiently get the most out of today’s powerful web applications. Yahoo! User Interface Blog News and Articles about Designing and Developing wiht Yahoo! Libraries.

Mojarra Scales ? New JSF Component Library Supporting Numerous YUI Components
Read the official Mojara Scales Release Candidate announcement. - Mojarra Scales ? New JSF Component Library Supporting Numerous YUI Components Jason Lee announced the Release Candidate of Mojarra Scales, a new JSF component library that provides support for YUI Charts, Menus, Calendars, Rich Text Editors, Sliders, TabViews and TreeViews (demos of these components and others are available). From the announcement: I am pleased to announce the first release candidate of Mojarra Scales 1.0, a new [...] [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 29-May-2008 by Eric Miraglia in Development
Read 4 times. More hits in More articles Mojarra Scales ? New JSF Component Library Supporting Numerous YUI Components Images about Mojarra Scales ? New JSF Component Library Supporting Numerous YUI Components
Kotaku`s The Gamers Guide Blogger

XBOX 360 Gamers Weblog Gossip, news and leaks for obsessive gamers Kotaku As if you don't waste enough of your time in a gamer's haze, here's Kotaku: a gamer's guide that goes beyond the press release. Gossip, cheats, criticism, design, nostalgia, pred

Sporelebrity [Day Note]
To: Ash From: Crecente Re: Damn, Japanese Beef Is Tasty So I received a copy of Spore Creator today and sat down with it to create the sort of abominations that in the real world would last only long enough to curse my creating them. It's pretty neat. Initially you feel very limited but once you get the feel for the thing you can go hog wild, though I suspect creating a [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 11-Jun-2008 by Brian Crecente in day note Note
Read 3 times. More hits in More articles  Sporelebrity [Day Note] Images about  Sporelebrity [Day Note]
Nerdblog Blogger

Provides news about hardware, software, notebooks, laptops, PCs, Mac, PDAs
Nerdblog.Net

Robotic F.A.C.E.
halfhead.jpg - Robotic F.A.C.E. This is an older project from MIT, but I think it is still very relevant. Robotic F.A.C.E. or “Facial Alerting in a Communication Environment” is an interesting project that tried to relay human emotion via a simple, and cheap, toy. You may not be able to get this exact toy anymore, but there are plenty [...] [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 05-Jun-2008 by Nerdblog in General
Read 1 times. More hits in More articles Robotic F.A.C.E. Images about Robotic F.A.C.E.
Thoughts From Kansas Blogger

Weblog of a University of Kansas ecology and evolutionary biology student, fighting for progressive politics, evolution, and endangered species.
Thoughts from Kansas You will notice that it lacks definiteness; that it lacks purpose; that it lacks coherence; that it lacks a subject to talk about; that it is loose and wabbly; that it wanders around; that

Sizzle is a fizzle
I'm a fan of Randy Olson. Don't get me wrong about that. His Flock of Dodos makes a valuable point about science communication, and goes beyond the trite standard narrative of brilliant scientists battling ignorant creationists. There's a real problem, and caricature won't solve it. Randy set aside his career as an academic marine biologist to become a filmmaker. His deci [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 15-Jul-2008 by Thoughts in Planet Earth
Read 1 times. More hits in More articles Sizzle is a fizzle Images about Sizzle is a fizzle
The Boy Genius Report Blogger

The gadgets and technology weblog
The Boy Genius Report

Parrot Shows Off World?s First NFC Speakers
Image 0 en  - Parrot Shows Off World?s First NFC Speakers Bluetooth, who needs it? The future of wireless communications between portable devices is here and exciting is an understatement. NFC, or Near Field Communication, has been discussed at length this week as Nokia announced the upcoming 6212 Classic handset. Available Q3 of this year, the 6212 will be Nokia’s first production handset to be equipped [...] [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 16-Apr-2008 by Zach Epstein in WirelessAccessories
Read 4 times. More hits in More articles Parrot Shows Off World?s First NFC Speakers Images about Parrot Shows Off World?s First NFC Speakers
Kotaku`s The Gamers Guide Blogger

XBOX 360 Gamers Weblog Gossip, news and leaks for obsessive gamers Kotaku As if you don't waste enough of your time in a gamer's haze, here's Kotaku: a gamer's guide that goes beyond the press release. Gossip, cheats, criticism, design, nostalgia, pred

GTA IV Multiplayer Down For Some PS3 Players [Playstation 3]
Even if your particular copy of Grand Theft Auto IV doesn't lock up your PlayStation 3, you may still find it a challenge to experience the online component of the game. Crecente posted earlier today that he was having connection issues, but he's not the only [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 29-Apr-2008 by Michael McWhertor in Gamespygrand theft auto IVGta IvOriginalPlaystation 3playstation networkPS3
Read 4 times. More hits in More articles GTA IV Multiplayer Down For Some PS3 Players [Playstation 3] Images about GTA IV Multiplayer Down For Some PS3 Players [Playstation 3]
Nerdblog Blogger

Provides news about hardware, software, notebooks, laptops, PCs, Mac, PDAs
Nerdblog.Net

Apple’s $199 iPhone: How can it be so cheap?
A combination of lower component costs, cheaper materials, and changing business models is behind the drastic price cut for Apple’s new 3G iPhone. MacWorld [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 10-Jun-2008 by Nerdblog in General
Read 6 times. More hits in More articles Apple’s $199 iPhone: How can it be so cheap? Images about Apple’s $199 iPhone: How can it be so cheap?
Joystiq Blogger

Covers video game news from an independent, unbiased perspective
Joystiq Joystiq

PlayStation 2 travels through time to kill children
Image 0 en  - PlayStation 2 travels through time to kill children Filed under: Culture, Sony PlayStation 2 After a dozen tips pleaded with us to cover a seemingly scandalous story on Yahoo this morning headlined, "Playstation 2 component incites Afr [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 26-Jul-2008 by Christopher Grant in General
Read 0 times. More hits in More articles PlayStation 2 travels through time to kill children Images about PlayStation 2 travels through time to kill children
Joystiq Blogger

Covers video game news from an independent, unbiased perspective
Joystiq Joystiq

Too Human video serves up co-op 'serving'
Image 0 en  - Too Human video serves up co-op Filed under: Microsoft Xbox 360, Action Serving, it's not just for restaurants any more. As Too Human's Denis Dyack describes it, 'serving' is a gameplay component of co-op found in Silicon Knights' nearly complete [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 25-Jun-2008 by Jason Dobson in denis-dyackdenisdyacksilicon-knightssiliconknights
Read 0 times. More hits in More articles Too Human video serves up co-op Images about Too Human video serves up co-op
Kotaku`s The Gamers Guide Blogger

XBOX 360 Gamers Weblog Gossip, news and leaks for obsessive gamers Kotaku As if you don't waste enough of your time in a gamer's haze, here's Kotaku: a gamer's guide that goes beyond the press release. Gossip, cheats, criticism, design, nostalgia, pred

If You Can't Beat 'Em, Join 'Em: Using Facebook For The Games Industry [Social Media And Gaming]
You may remember Threewave Software best for the original "Capture The Flag" Quake mod. These days, the studio's known for developing the multiplayer component of several major titles, most recently Touchsto [..] Read complete article
Subscribe to Creating Component Communication Pipelines with YUI (Decoupling)
Published 12-May-2008 by Leigh Alexander in
Read 0 times. More hits in More articles If You Can Images about If You Can

Warning We are not responsible of information posted from external feeds. Use this website at your own risk. Notice: We will not be liable for any direct or indirect loss or damage arising under this disclaimer or in connection with our website, whether arising in tort, contract, or otherwise.


Your Site here Your Site here Your site here Your site here Your site here