Skip to content Skip to navigation

Connexions

You are here: Home » Content » Proof Of Concept

Navigation

Recently Viewed

This feature requires Javascript to be enabled.
 

Proof Of Concept

Module by: Bhavesh Bhanushali. E-mail the author

Summary: Concept

The Mediator Design Pattern: A Minimalist Example

Published by William B. Sanders on July 7, 2008 in ActionScript, Design Patterns, Flash, Flex, Mediator and OOP. This is Google

The Mediator design pattern is easy to understand but tricky to implement. At the core of the Mediator pattern is a Mediator class that coordinates a set of different requests that are sent by objects. The objects are called Colleagues. The Colleagues let the Mediator know that they want to change, and the Mediator handles the change taking into account what effect the changes will have on the other colleagues. For example, in my car when I turn on the headlights, the panel lights dim. Something in my car tells the panel lights to dim when the headlights are switched on. The headlights represent one colleague and the panel lights, another. A Mediator tells the panel lights to turn on as soon as I start the car, and then when the headlights are switched on, the Mediator tells the panel lights to dim. If I turn off the headlight, the Mediator tells the panel lights to brighten up again. The colleagues never communicate directly with one another but instead through the mediator. The idea is to reduce the complexity by handling all of the requests in one place. This also insures loose coupling between the colleagues.

The better approach is to create loosely-coupled custom components that are self contained, do not know about existence of each other and can communicate with external world by virtue of sending and receiving events. Adobe Flex is a good tool for creating event-driven applications, and it has all you need for creation of custom components. At this point, I could have just explained you the essence of using custom components, but I'd rather make this essay more solid by introducing a little bit of a theory of object-oriented programming and explain you the use of the design pattern called Mediator. People say that these days some smart employers are ask questions about design patterns during job interviews. So let's get armed with the pattern called Mediator. We'll start with a definition of this pattern from Wikipedia :

"The mediator pattern is a software design pattern that provides a unified interface to a set of interfaces in a subsystem."

To get started, the GoF present both a class and interactive diagram and we'll do the same here in Figure 1:

A dog sitting on a couch. this is cite example [link]

t1 para Title

"q1 This is quote Maecenas id tellus quis justo commodo adipiscing. Integer a nulla sit amet lacus ultrices vehicula. Ut lacinia, velit in dictum blandit, erat quam placerat orci, ac nonummy est nisi pretium justo. Nunc pulvinar"[source]

p2 this is mixede1 content

e2 Thisp4 is mixede3 content and also new text dfsd fsdf sdfs dfsd fsd fsd fsdf sdf sdf sdf sdf sdf sdfsd

Warning: This is title of note:

this is note Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse sed felis. Nulla fringilla. Suspendisse leo mi, sodales quis, commodo at, semper vel, dolor. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque dictum, sem quis cursus iaculis, libero nulla posuere orci,
This is quote within Note
another text in the note

A dog sitting on a couch.

p3 This is mixed “q2 inline quote”txt and also new text

Content actions

Download module as:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks