pdf.css
Google


ADBRITE ads links
You are here: CodeIdol > Html > Design Patterns > page: 28 29 30 31 32 33 34 35 36 37 38


Figure 1-1 provides an example design pattern, the Mediator pattern, that
shows what design patterns can do for you. Say that you've got a four-page
Web site that lets users browse a store and make purchases. As things stand,
the user can move from page to page. But there's a problem -- the code in
each page has to know when to jump to a new page as well as how to activate
the new page. You've got a lot of possible connections and a lot of duplicate
code in the various pages.

You can use a mediator here to encapsulate all the navigation code out of the
separate pages and place it into a mediator object instead. From then on,
each page just has to report any change of state to the mediator, and the
mediator knows what page to send the user to, as shown in Figure 1-2.

Welcome
Store
Purchase
Goodbye
Figure 1-1:
In this
illustration
of the basic
navigation
of a typical
online store,
the Mediator
pattern
mediates
between
objects.
10
Part I: Getting to Know Patterns
You are here: CodeIdol > Html > Design Patterns > page: 28 29 30 31 32 33 34 35 36 37 38
   
Related tags







Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......






© CodeIdol Labs, 2007