Design Patterns: Examples To Accompany
Design Patterns: Examples To Accompany
Design Patterns
Elements of Reusable Object-Oriented Software
A-1
Abstract Factory
Sheet metal stamping
Stamping Equipment
Client equipment is an example
StampPart() (parts list for Model)
of an Abstract Factory
for creating auto body
parts. Using rollers to
change the dies, the
Dies concrete class can be
Model 3 RightDoor Die Model 3 LeftDoorDie Model 3 Hood Die
changed. The possible
Model 2 RightDoor Die Model 2 LeftDoorDie Model 2 Hood Die
concrete classes are
Model 1 RightDoor Model 1 LeftDoor Model 1 Hood
hoods, trunks, roofs, left
StampRightDoor() StampLeftDoor() StampHood()
and right front fenders,
etc. The master parts list
ensures that classes will
be compatible. Note that
an Abstract Factory is a
collection of Factory
Creational Methods.
A-2
Builder
Customer Cashier Restaurant Crew
Fast food restaurants use (Client) (Director) (Builder)
a Builder to construct
their children’s meals. OrderKid’sMeal
There can be variation in Build
the contents (the main
course, the drink, or the Build
toy), but the process for
building a children’s Build
meal remains the same.
Note that the Builder Build
returns a finished
product, whereas the
Abstract Factory returns Get Meal
a collection of related
parts.
Creational
The Builder pattern separates the construction of a complex object from its
representation, so the same construction process can create different
representations.
Participant Correspondence:
The Kid’s Meal concept corresponds to the builder, which is an abstract
interface for creating parts of the Product object.
The restaurant crew corresponds to the ConcreteBuilder, as they will assemble
the parts of the meal (i.e. make a hamburger).
The cashier corresponds to the Director, as he or she will specify the parts
needed for the Kid’s Meal, resulting in a complete Kid’s meal.
The Kid’s Meal package corresponds to the Product, as it is a complex object
created via the Builder interface.
Consequences:
The internal representation of the Kid’s meal can vary.
The construction process is isolated from the representation. The same process
is used by virtually all of the fast food chains.
There is finer control over the construction process and the internal structure of
the finished product. Hence two Kid’s Meals from the same restaurant can
consist of entirely different items.
A-3
Factory Method
In injection molding,
manufacturers process Injection Mold
plastic molding powder
and inject the plastic into Inject()
molds of desired shapes.
Like the Factory
Method, the subclasses
(in this case the molds)
determine which classes
to instantiate. In the ToyHorseMold
example, the ToyCarMold
ToyHorseMold class is Inject()
being instantiated.
Creational
The Factory Method defines an interface for creating objects, but lets
subclasses decide which classes to instantiate.
Participant Correspondence:
The Injection Mold corresponds to the Product, as it defines the interface of the
objects created by the factory.
A specific mold (ToyHorseMold or ToyCarMold) corresponds to the
ConcreteProduct, as these implement the Product interface.
The toy company corresponds to the Creator, since it may use the factory to
create product objects.
The division of the toy company that manufactures a specific type of toy (horse
or car) corresponds to the ConcreteCreator.
Consequences:
Creating objects with an Injection Mold is much more flexible than using
equipment that only created toy horses. If toy unicorns become more popular
than toy horses, the Injection Mold can be extended to make unicorns.
A-4
Factory Method
BreadMachine
MakeBread()
Yeast
MakeBread()
ead() Milk
Yeast
Creational
The Factory Method defines an interface for creating objects, but lets
subclasses decide which classes to instantiate.
Participant Correspondence:
The Bread Machine corresponds to the Product, as it defines the interface of
the objects created by the factory.
A specific recipe (BasicBreadRecipe or CheeseBreadRecipe) corresponds to
the ConcreteProduct, as these implement the Product interface.
The user corresponds to the Creator, since he or she uses the factory to create
product objects.
Consequences:
Creating objects with a bread machine is much more flexible than using baking
equipment that only created one type of bread.
A-5
Prototype
The mitotic division of a
cell results in two cells
Cell
of identical genotype.
This cell “cloning” is an Split()
example of the
Prototype pattern in that
the original cell takes an
active role in creating a SingleCellOrganism
Creational
A-6
Singleton
The office of the
Presidency of the United Presidency
States is an example of a
Singleton, since there Return unique-instance
Election()
can be at most one active
president at any given
time. Regardless of who
holds the office, the title
“The President of the
United States” is a
global point of reference
to the individual.
Creational
The Singleton pattern ensures that a class has only one instance, and provides a
global point of reference to that instance.
Participant Correspondence:
The Office of the Presidency of the United States corresponds to the Singleton.
The office has an instance operator (the title of “President of the United
States”) which provides access to the person in the office. At any time, at most
one unique instance of the president exists.
Consequences:
The title of the office provides controlled access to a sole instance of the
president. Since the office of the presidency encapsulates the president, there
is strict control over how and when the president can be accessed.
A-7
Adapter
A 1/2" drive ratchet will
not ordinarily work with
a 1/4" drive socket.
Using an Adapter, the
female end interfaces
with the 1/2" drive
Ratchet
ratchet, and the male end
1/2" Drive (male) interfaces with the 1/4"
socket.
Socket Adapter
1/4" 1/2" Drive (female)
1/4" Drive (female) 1/4" Drive (male)
Structural
A-8
Bridge
A switch is a device for Bridge
turning lights, ceiling Switch Imp SwitchImp
fans, garbage disposals ON () ON ()
on or off. The actual OFF() OFF()
implementation of the
switch is decoupled from
the abstract switch. This
decoupling of the
abstraction and
implementation is an OFF
Structural
A-9
Bridge
A magician relies on the
bridge pattern for his act.
The act is developed
with a volunteer, but the
identity of the volunteer
is not known until the
time of the performance
Volunteer ChosenVolunteer
Imp
Introduce() Introduce()
Levitate() Levitate()
Thank() Thank()
Jane Smith
Introduce()
Levitate()
Thank()
Structural
A-10
Composite
ArithmeticExpression Arithmetic expressions
+ () can be expressed as trees
- () where an operand can be
* () a number or an
/ ()
= ()
+ arithmetic expression.
Since the individual
objects, and
2 * compositions of
individual objects are
3 5 treated uniformly, an
NumericOperand CompositeOperand arithmetic expression is
an example of the
Composite pattern.
Structural
The Composite composes objects into tree structures, and lets clients treat
individual objects and compositions uniformly.
Participant Correspondence:
Any arithmetic expression is a component.
Numeric operands correspond to leafs, while expressions containing at least
one operator correspond to composites.
Whoever forms the expression is the client.
Consequences:
The composite pattern defines class hierarchies consisting of leaf objects and
composite objects. Composite objects are treated the same way as leaf objects
(their value is added, subtracted, etc. from another value).
With composites, it is easy to add new kinds of components. For example, the
following expression can be rewritten:
+
+
2 *
2 *
/
3
3 5
10 2 A-11
Composite
Composite is often exhibited in Pasley Sauce
recipes. A recipe consists of a 1 portion of white roux
list of ingredients which may be 1 cup milk
2 tablespoons of parsley
atomic elements (such as milk
and parsley) or composite To make sauce, over heat, add a little
of the milk to the roux, stirring until
elements (such as a roux). combined. Continue adding milk
slowly until you have a smooth
White Roux liquid. Stir over medium heat for 2
1 tablespoon flour minutes. Then stir in parsley, and
1 tablespoon butter cook for another 30 seconds.
Remove from heat, and leave sauce
To make roux, melt the butter in a standing to thicken.
saucepan over medium heat. When
the butter starts to froth, stir in flour,
combining well.
The Composite composes objects into tree structures, and lets clients treat
individual objects and compositions uniformly.
Participant Correspondence:
Any item in a recipe is a component.
The simple elements such as milk, correspond to the leaf objects.
Elements such as the white roux, which are themselves composed of leaf
elements are composites.
The chef corresponds to the client.
Consequences:
Recipes can be written more simply by combining primitive and composite
objects.
When combining elements of a recipe, composite elements are added the same
way that simple elements are.
It is easy to add new kinds of elements, as is evidenced by the frequency in
which recipes are combined.
A-12
Decorator
Paintings can be hung on
a wall with or without
Visual Component
frames. Often, paintings
will be matted and Hang()
Frame Matte
Structural
A-13
Decorator
Structural
A-14
Facade
When ordering from a
catalog, consumers do
not have direct contact
with the Order
Fulfillment, Billing, and Customer Service
Shipping departments.
Facade
The Customer Service
Representative acts as a
Facade, or unified
interface, to each of the
departments involved in
the transaction.
Order
Billing Shipping
Fulfillment
Structural
The Facade defines a unified, higher level interface to a subsystem, that makes
it easier to use.
Participant Correspondence:
The customer service representative corresponds to the Façade.
The individual departments correspond to the subsystem classes.
Consequences:
Clients are shielded from individual departments. When ordering an item, it is
not necessary to check the stock, generate an invoice, and arrange for shipping.
All steps are accomplished through the customer service representative.
The internal structure of the organization can be changed without affecting the
client. For example, the shipping department can be contracted to another
organization, without impacting the client’s interface with the company.
Note:
Some catalog department stores require the customer to select the item, check
to see if it is in stock, order it, go to a counter to pay for it, and then go to
another counter to receive it. In this example, a façade is not used.
A-15
Facade
Patient Ambulance
Structural
The Facade defines a unified, higher level interface to a subsystem, that makes
it easier to use.
Participant Correspondence:
The emergency services operator (9-1-1 operator in North America)
corresponds to the Façade.
The individual emergency services correspond to the subsystem classes.
Consequences:
Clients are shielded from individual departments. When emergency services
are needed, it is not necessary to call the ambulance, police and fire
departments separately. The emergency services operator dispatches services
as needed.
There is a weak coupling between services. In the event of a burglary, the fire
brigade need not be dispatched. Regardless of who is dispatched, the client
interface remains the same.
A-16
Flyweight
Most telephone
subscribers are unaware
that the pool of Tone
generators (such as dial
tone, busy tone or
reorder tone) is much
smaller than the number
of subscribers. The pool
of Dial Tone generators
is an example of a
Flyweight.
Structural
A-17
Proxy
An 800 (8xx) number is
a proxy for the real
directory number. Business
Callers will dial the 800
Call()
number, just as they
would dial the actual
directory number.
RealSubject
DirectoryNumber 800NumberProxy
Structural
A-18
Chain of Responsibility
Behavioral
A-19
Chain of Responsibility
A-20
Command
The “check” at a
restaurant is used to
encapsulate the Cook Customer Order Waitress
(Receiver) (Client) (Command) (Invoker)
customer’s order. The
waitress takes the order,
Order()
but it is the cook that
carries out the
Command. Since the PlaceOrder()
pad of “checks” can be Cook() Order
used by different
restaurants, they can Thank You!
support many different
commands
Behavioral
A-21
Interpreter
Musical notation
provides a grammatical
representation for the
pitch and duration of
MusicalNotation (AbstractExpression) sounds. When
musicians play from a
score, they are
Interpreters, interpreting
that grammar.
3 #
4
#
Behavioral
A-22
Iterator
The channel selector on
modern day television
ChannelIterator
sets is an example of an
ChannelFrequencies
Iterator. Rather than a
MethodOfTraversal() Next()
Previous()
dial containing all
possible channels, or one
button per tuned
channel, today’s
television sets have a
Next and Previous
TunedChannel
button for tuning
MethodOfTraversal() Channel Selector
channels. The “Channel
Surfer” doesn’t need to
know if Channel 3 or
Channel 4 comes after
Channel 2.
Behavioral
A-23
Iterator
Behavioral
A-24
Mediator
The control tower at an
ATC Tower
airport provides a central
point of communication
for aircraft in the terminal
area. Constraints on
terminal area airspace are
maintained by the tower.
With the centralized
communication and
constraint maintenance, the
tower behaves as a
Flight 111 Flight 1011 Flight 112 Flight 747 Mediator.
Behavioral
The Mediator defines an object that controls how a set of objects interact.
Loose coupling between colleague objects is achieved by having colleagues
communicate with the Mediator, rather than one another.
Participant Correspondence:
Air Traffic Control corresponds to the Mediator.
The specific tower at an airport corresponds to the ConcreteMediator.
Each arriving and departing aircraft corresponds to the colleagues.
Consequences:
Constraints are localized within the Mediator. Changes to constraints need
only be dealt with in the tower. Aircraft will still take off and land only when
cleared to do so.
Aircraft interactions are decoupled. The many to many interactions are
replaced with a one to many interaction. Each aircraft communicates with the
tower, rather than with each other.
Control is centralized in the tower. Complexity of interaction between aircraft
is traded for complexity in the mediator.
A-25
Memento
Behavioral
The Memento captures and externalizes an object’s internal state, so the object
can be restored to that state later.
Participant Correspondence:
The mixing equipment corresponds to the original object, whose state is being
saved.
The Photograph is the memento.
The engineer that takes the photo is the originator. He will also use the
memento to restore the state of the switch settings.
The drawer where the memento is stored is the caretaker.
Consequences:
The photograph eliminates the need for everyone in the studio to know the
switch settings in case they are perturbed. The photograph also stores
information that the engineer should manage, outside of the engineer (i.e. not
in his memory).
A-26
Memento
Behavioral
The Memento captures and externalizes an object’s internal state, so the object
can be restored to that state later.
Participant Correspondence:
The radio tuning corresponds to the original object, whose state is being saved.
The preset button is the memento.
The driver who sets the preset button is the originator. He will also use the
memento to restore the state of the radio tuning.
The radio where the button is located is the caretaker.
Consequences:
The button eliminates the need for the drivers to memorize the radio
frequencies of their favorite stations. The preset buttons store the information
so that the tuning can be restored.
A-27
Observer
When a bidder at an
auction accepts a bid, he or
Auctioneer (Subject)
she raises a numbered
paddle which identifies the
1. Accept Bid bidder. The bid price then
2. Broadcast New High Bid
changes and all Observers
486 must be notified of the
change. The auctioneer
501 319 127 then broadcasts the new
bid to the bidders.
Bidders (Observers)
Behavioral
The Observer defines a one to many relationship, so that when one object
changes state, the others are notified and updated automatically.
Participant Correspondence:
The auctioneer corresponds to the Subject. He knows the observers, since they
must register for the auction.
The current bid corresponds to the ConcreteSubject The observers are most
interested in its state.
The bidders correspond to the Observers. They need to know when the current
bid changes.
Each individual bidder with different tolerances for the bidding correspond to
the ConcreteObservers.
Consequences:
There is abstract coupling between the subject and observers. All that the
auctioneer knows is that bidders will bid. He does not know when the price
will become too steep for an individual bidder.
There is support for broadcast communication. When the auctioneer
announces the current bid, that information is broadcast to all interested parties.
Observers can cause an avalanche of unexpected updates, since they can be
blind to the ultimate cost of changing the subject. A bidder ma y intend to raise
the bid by $50, and end up starting a bidding war.
A-28
Observer
Consumers who register
for a product warranty are
Factory
like observers. When the
safety record of the
product changes (like in a Warranty Registration
Consumers
Behavioral
The Observer defines a one to many relationship, so that when one object
changes state, the others are notified and updated automatically.
Participant Correspondence:
The company corresponds to the Subject. It knows the observers, since they
must register for the warranty.
The product safety/reliability record corresponds to the ConcreteSubject The
observers are most interested in its state.
The consumers correspond to the Observers. They need to know when the
current product safety/reliability record changes.
Each individual consumer corresponds to the ConcreteObservers, since they
will have different experiences with the product.
Consequences:
There is abstract coupling between the subject and observers. All that the
company knows is that consumers have registered for the warranty. It does not
know which once will require warranty service.
There is support for broadcast communication. If a recall occurs, a form letter
is sent out to all registered owners.
Observers can cause an avalanche of unexpected updates, since they can be
blind to the ultimate cost of changing the subject. Consumers trying to obtain
warranty service are not aware of other consumer’s experience with the
product. If enough claims are submitted, the product may be recalled.
A-29
State
The behavior of a vending
machine varies based on its
State. The currency on
deposit, the product
VendingMachineState
inventory, the selection,
and the currency in the
change bank are all part of
the vending machine’s
State.
Behavioral
The State pattern allows an object to change its behavior when its internal state
changes.
Participant Correspondence:
The deposit on hand, stock, and change on hand correspond to the context.
The behavior associated with each context corresponds to the state.
Consequences:
Behavior specific to a given state is localized. When the machine runs out of
potato chips, the exact change light will not be illuminated, unless exact
change is required.
State transitions are explicit. Product A will not be delivered unless the deposit
on hand is sufficient for Product A.
A-30
Strategy
ail
rM
Ai
Behavioral
A-31
Strategy
There are many modes of
transportation to and from
an airport. Choosing a
TransportationToAirport Strategies (Options) particular transportation
Strategy involves making
GotoAirport(Time, Cost) tradeoffs between cost,
time, and convenience.
Airp ort
Behavioral
A-32
Template Method
Subdivision developers
often use a Template
Basic Floor Plan Method to produce a
-Lay Foundation variety of home models
-Wire
-Plumb
from a limited number of
floor plans. The basic
floor plans are a skeleton,
and the differentiation is
deferred until later in the
building process.
- Add Third Gable - Add Wing - Add Fireplace
- Add 2 Wings
Behavioral
A-33
Template Method
? ? ?
? ? Behavioral
A-34
An outside consultant
Visitor
Department
coming into a department, Client
to meet with everyone in EscortVistor
the department on a one-on-
one basis is an example of
Visitor. While the visitor is
escorted to each cubicle,
Employee
she does nothing. Once she Visitor
arrives at a cubicle, she AcceptVisit
VisitMgr
springs into action VisitEngnr ReceivePay
interviewing the employee
(sending messages and
obtaining results).
Consultant FinanceGuy Manager Engineer
Behavioral
A-35
Judy,
Can I walk
you home?
Johnny
Johnny
Architecture
Office Census
A-36
Layers
The Layers pattern helps
Bike
structure applications that can
be decomposed into groups
of subtasks at different layers
Disassemble/Assemble
of abstraction. Consider
shipping a bike. The person at
Pack/Unpack the shipping or receiving end
John Doe
C/O 12344
Town, State 98352
John Doe
C/O 12344
Town, State 98352 of the process, or the driver
may not know how to
assemble or disassemble a
Ship/Receive bike. Then again, they don’t
need to know how.
Speedy Delivery
Transport Architecture
A-37
Pipes and Filters
Public water systems demonstrate
Pipes and Filters. The water
Filter
Sediment flowing through pipes is the
Chlorinate
input to a filter. Pipes are also used
Pump
as the output from a filter. This
example shows that name
correspondence between the
example and pattern can produce a
Tee
viable example.
Tank
Heater
Architecture
Pipes and Filters provides a structure for systems that process a stream of data.
Participant Correspondence:
In the public water system example, the water pipes correspond to data pipes.
The various stages that add something to or take something from the water
correspond to the filters.
Consequences:
Changing filters adds flexibility. For example, fluoride could be added to the
water supply without upsetting the overall system.
Recombining filters adds flexibility. Many homes have water treatment
systems that soften water used for cleaning and filter chemicals from the
drinking water. All of these home systems take advantage of water supplied via
the upstream pipes and filters.
A-38
Blackboard
Watch just about any police
show on television, and
notice that the crimes cannot
Forensics: be solved immediately.
Evidence: There is often a blackboard
Ballistics: with forensic evidence,
ballistic reports, crime scene
Motives:
data, etc. posted. When all
of the experts add their
pieces of the puzzle, the
police are able to solve the
crime!
Architecture
A-39
Broker
A travel agent is a broker for
travel related services. A
customer dealing with a
travel agent can book
passage on ships, planes and
trains, reserve a hotel room
and rental car, and book
tours. The customer deals
only with the travel agent,
although several companies
are involved. Note that
there are often complex
codes on the itinerary. The
broker and travel services
companies understand these
codes. The customer often
does not.
Architecture
A-40
Model-View-Controller
Some types of dancers are
known to pay special attention
to those who tip the highest.
In this situation, the dancer is
the model, and whoever is
tipping is controlling the view
of the model for himself, as
well as all others.
Architecture
A-41
Presentation-Abstraction-Control
90
80
70
Polls will often gather
60 San Francisco information from all over
50 St. Louis
40 New York the country, and display
30 Washinton
20
results as national totals,
10
0
regional totals, state totals
and city totals. The
information is gathered at
each site, and then reported
to a central site.
Architecture
A-42
Microkernel
Nintendo makes a GameboyTM
hand-held video game. The
POSA Patterns Game
Gameboy unit provides the
core functionality, such as
displays and input/output for
numerous games and the
Gameboy camera. A game
cartridge or the Gameboy
camera can be inserted to
allow the user to play.
Computer Programmers
of
Death
Gameboy C a m
Architecture
The Microkernel pattern separates the minimal functional core from extended
functionality.
Participant Correspondence:
The player corresponds to the client. The GameboyTM unit corresponds to the
microkernel, since it contains the core functionality.
The game cartridges correspond to the internal servers, which provide
additional functionality.
The pin connections on the unit and cartridges correspond to the adapter.
The buttons on the unit provide an interface to clients, and therefore
correspond to the external server.
Consequences:
The client applications can be easily shared between hardware without porting
to a new environment. Kids can trade game cartridges without violating
software copyrights.
The Gameboy is very flexible. Originally it was only for games. Eventually, it
could be used as a camera.
The Gameboy has separated policy and mechanism, so that new external
servers could be added that implement their own views. For example, on the
Gameboy camera cartridge, the lens is a new external server.
A-43
Reflection
Reflection provides a
mechanism for changing
structure and behavior
dynamically. Consider a
constitution. Changing the
behavior of a legislative body is
done by changing the
constitution. The constitution
can be considered to be a meta-
object, while the legislative
body is the base object.
Architecture
Design
The Whole-Part pattern helps aggregate components that form a semantic unit.
Participant Correspondence:
The driver corresponds to the client. The driver will ultimately use all of the
components through the interface of the whole.
The car corresponds to the Whole. It is made up of smaller systems.
The individual systems, such as the fuel system, ignition system, cooling
system, etc. correspond to the Parts.
Consequences:
Parts are changeable without impacting the client. If a starter fails, it can be
replaced, and the interface to the care remains the same for the driver.
Each concern is implemented by a separate part, making it easier to implement
complex strategies. Many of the parts on a car are fairly simple, yet the
composite is quite complex.
Reusability is supported since parts of a whole can be used in other aggregates.
The auto salvage industry is build on this concept. A part can be taken from
one car for use on another.
A-45
Master-Slave
U.S. Census Bureau
When tasked with taking
the census, the Census
Bureau utilizes census
takers. The census takers
are semantically the same,
(a census taker for one area
could just a easily work a
different area), and the
results are tabulated by the
Census Bureau. Any
“clients” of the Census
Bureau deal directly with
the Bureau, and not with
the individual census
takers.
Design
A-46
Proxy
Many organizations offer a
proxy e-mail address. When
jim@monkeysoft .com
someone sends mail to a
proxy address, he or she
may have no idea that it is a
proxy address. The proxy
then forwards the message
to the “real” e-mail address.
jim@[Link]
Design
A-47
Command Processor
In catalog sales, orders can
Performs
Order Fulfillment & Stores Abstract Order be received by Mail, Phone,
Order or FAX. When a request is
(Command Processor) (Abstract Command)
FillOrder Fill received, an order is
ReturnOrder Return Thank You! generated. The order will
Transfers Commands cause items to be removed
CustomerInterface Order from stock in order to fill
Order
Creates Order the order. If an order is
(Controller) (Command) Microphone $19.95
(Command) Headsets $24.95
OrderEvent Fill
Fill returned, the item will be
Return
Return Thank You! returned to stock, and the
account will be credited. If
Uses a web site based order form
Inventory is implemented, the basic
(Supplier) order processing will
RemoveFromStock remain intact.
ReturnToStock
Design
The Command Processor pattern separates the request for a service from its
execution.
Participant Correspondence:
The Customer Interface corresponds to the Controller.
The Order Fulfillment department corresponds to the Command Processor.
This department is responsible for processing the order, making sure that an
item is taken from stock, and sent to the customer. If the item is returned, the
order fulfillment department will return the item to stock.
The order corresponds to the Capitalize command. Once a phone call, order
form, or fax is received, it becomes a record is created containing the customer
name, address, desired items, and method of payment.
The inventory corresponds to the supplier.
Consequences:
There is flexibility in the way that requests are activated. A customer can order
via mail, phone, or FAX. If a web site based order form is implemented, the
basic order processing will remain intact.
Commands can be implemented concurrently. Several customers will request
items daily. The orders are placed in bins, and shipped when complete.
A-48
View Handler
Although window managers
are common to software, the
visual nature of windows
allows one to examine
behavior without looking at
source code. The window
manager opens, manipulates,
and disposes of views. It also
coordinates dependencies
between views, and
coordinates their updates.
Design
The View Handler pattern helps manage all views provided by a system.
Participant Correspondence:
The windowing system corresponds to the view handler.
The displayed windows correspond to the views.
The underlying files or documents correspond to the supplier(s)
Consequences:
The View Handler provides uniform handling of views. New views can be
added without affecting existing views.
A-49
Forwarder-Receiver
Judy,
Can I walk
you home?
Johnny
Design
A-50
Client-Dispatcher-Server
When a client calls a company
to talk with an individual, a
receptionist often answers the
call, and then routes it to the
appropriate person. The client
One moment while I cannot tell if the person is in
connect you. the same building, or at a
remote site. Furthermore, the
client does not know if the
phone rings on the sales
manager’s desk, or if the
May I speak with the receptionist puts him on hold,
sales manager? and yells, “Hey Larry, pick up
the phone!”
Design
A-51
Publisher-Subscriber
Need 2 To communicate to others,
tickets,
M ik e
Call
one can post or publish a
Free
Kitte
ns notice on a bulletin board.
to good
to a
ed
Ri
de
home. The subscribers (readers) of
Ne nver
De the bulletin board can vary
dynamically. State
information, such as having
extra tickets can be
communicated to unknown
individuals when it is not
Readers/Subscribers
Posters/Publishers feasible to poll people
explicitly to determine if
they require the tickets.
Design
A-52