stable model-view mapping pattern (mvm)

Software System Engineering
Dr. M.E. Fayad, Professor
Computer Engineering Department, Room #283I
College of Engineering
San José State University
One Washington Square
San José, CA 95192-0180
http://www.engr.sjsu.edu/~fayad
© M.E. Fayad 1996-2005
SJSU -- CmpE
L7-1-S1
Stable Analysis Patterns
Lesson 7-1:
Stable Analysis Patterns
2
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S2
Stable Analysis Patterns
Lesson Objectives

Objectives
Explore Stable Analysis Patterns
 Examine Stable Analysis Patterns
 Discuss the following Stable
Analysis Patterns:
 Negotiation
 Model-View-Mapping (MVM)
 Searching
3
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S3
Stable Analysis Patterns
The concept of extracting patterns using
software stability concepts
 Problem
FIRST ABSTRACTION:
 Apply SSM concepts
 Define EBTs, BOs, and IOs
 Create SSM for the problem
SECOND ABSTRACTION:
 Model each EBT using SSM concepts
 Build natural domain Stable Analysis
Pattern
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S4
4
Stable Analysis Patterns
Stable Analysis Patterns’ Properties











Timeless Notion Pattern
Generality: Generality Patterns
Usability and Reusability Patterns
Scalability Patterns
Presentation of the Core Knowledge Patterns
One Presentation of the Problem Space Patterns
Configurability and Re-Configurability Patterns
Adaptability Patterns
Extensibility Patterns
Accessibility Patterns
Integratability Patterns
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S5
5
Stable Analysis Patterns
Stable Analysis Patterns Advantages
 Contribute
 Aid True
to Stable Architectures
Problem Understanding
 Provide True
Problem Modeling
 Enhance Team
© M.E. Fayad 1996-2005
Dynamic
SJSU – CmpE ---
M.E. Fayad
9
L7-1-S6
Stable Analysis Patterns
Negotiation Analysis Pattern (1)

Negotiation is a general concept that has many
applications in various contexts.

In our every day life, there are various situations where
negotiation usually takes place. For instance, buying or
selling properties usually involves some sort of
negotiation (e.g. buying or selling a home or a car).

In addition, negotiation can be used for solving social
and political conflicts.
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S7
6
Stable Analysis Patterns
Negotiation Analysis Pattern (2)

In software systems, Negotiation also appears
frequently in the development of different applications.

For instance, developing software for online auctions
and shopping might involve the negotiation of the
price and/or the negotiation of different product
aspects.

More technically, negotiation becomes an essential
part in the development of next generation Web-based
devices and appliances.
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S8
7
Stable Analysis Patterns
Negotiation Analysis Pattern (3)


Today, devices that need to access the Web diverge
greatly in their capabilities, making it highly desirable
for the same resource to be available in several
different representations (different languages for
example).
Negotiation algorithms play a fundamental role in
aiding servers to decide which representation of a
document a device should be given. In this case, the
browser (or the client agent) will indicate its
preferences by including a header in the request.
8
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S9
Stable Analysis Patterns
Negotiation Analysis Pattern (4)
 Pattern
Name: Negotiation
 Problem:
How does one build a negotiation
model that can be used to model the
negotiation problem in any application?
10
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S10
Stable Analysis Patterns
Forces (1)
 Negotiation
spans many contexts that are
completely different in their natures.
 The
Negotiation process can take place between
two or more persons, between persons and
organizations, or between two non-human
entities; in each case, the negotiator structure is
completely different. How can we handle these
different structures using a single model?
11
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S11
Stable Analysis Patterns
Forces (2)

The Negotiation entity can be an organization
consisting of many persons, each having a
role in the negotiation process. For instance,
there can be one individual who is responsible
for negotiating financial issues, another who
is responsible for negotiating issues related to
management, and so on. Therefore, our
pattern should be flexible enough to handle
different negotiator structures.
12
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S12
Stable Analysis Patterns
Forces (3)


Negotiation can be conducted through one or
more media either simultaneously or
consecutively; thus, the pattern should handle
the use of multiple media.
Negotiation can be performed on one or more
affairs at the same time. For instance,
negotiation that takes place in the buying and
selling context usually involves more than one
subject to be negotiated. For example, in
buying a car, one can negotiate the price, the
warranty, and so on. Therefore, the pattern
should be flexible enough to handle such
situations.
13
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S13
Stable Analysis Patterns
Forces (4)
 The
ultimate goal of any negotiation is to reach
an agreement between the negotiators.
However, the nature of this agreement varies
tremendously from one application to another
and from one context to another. An agreement
that might be reached while negotiating a
political conflict is completely different from
that reached while buying a car. Therefore, the
pattern should be able to handle these wide
variations.
14
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S14
Stable Analysis Patterns
Pattern Structure and Participants
<<Pattern-BO>>
AnyContext
1..*
negoti ates
<<Pattern-BO>>
AnyMedia
1..*
uses
<<EBT>>
Negotiation
handles 1..*
<<Pattern-BO>>
AnyParty
generates
0..*
<<Pattern-BO>>
AnyAgreement
15
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S15
Stable Analysis Patterns
CRC Cards (1)
AnyNegotiation (Negotiation Descriptor)
Responsibility
Collaboration
Clients
Describes the negotiation
rules and regulations to the
negotiating parties.
Server
AnyAgreement
AnyParty
AnyMediaAnyContext
defineRules()
AnyParty (Negotiation handler)
Responsibility
Performs and finalizes the
negotiation.
Collaboration
Clients
Server
AnyNegotiation
AnyAgreement
© M.E. Fayad 1996-2005
SJSU – CmpE ---
negotiate()
approve()
agree()
M.E. Fayad
L7-1-S16
16
Stable Analysis Patterns
CRC Cards (2)
AnyAgreement (Agreement)
Responsibility
Describes agreement
terms and conditions.
Collaboration
Clients
Server
option()sign()
execute()
insert-option()
AnyNegotiation
AnyParty
Media (Connector)
Responsibility
Communicates
negotiation issues
between negotiators.
© M.E. Fayad 1996-2005
Collaboration
Clients
AnyNegotiation
SJSU – CmpE ---
Server
connect Parties()
display()
illustrate()
M.E. Fayad
L7-1-S17
17
Stable Analysis Patterns
CRC Cards (3)
Context (Motivator)
Responsibility
Collaboration
Defines the reason of the
negotiation process.
Clients
Server
AnyNegotiation
defineBoundary()
contextLimit()
18
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S18
Stable Analysis Patterns
STABLE MODEL-VIEW
MAPPING PATTERN
(MVM)
19
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S19
Stable Analysis Patterns
Outline
Problem Overview
 Solution Requirements
 Current Solutions – Overview
 Current Solutions- Limitations
 Proposed Solution
 Stable Model-View Mapping [MVM] Pattern
 Stable MVM- Second Abstraction Level
 Stable MVM Pattern Instantiation
 Applicability Examples

© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S20
20
Stable Analysis Patterns
Problem Overview (1)
 Today,
very heterogeneous devices are
required to access the same
applications.
 PCs, PDAs, WAP phones, and
interactive TVs, each has its own
limitations and capabilities.
 Generating different version of the
same application is impractical
solution. [Cost, management, time,etc.]
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S21
21
Stable Analysis Patterns
Problem Overview (2)
Problem: How to map models to different views!
View 1
Different views
Server
View 2
The Internet
View 3
View 4
Wireless Network
Application
1
© M.E. Fayad 1996-2005
View 6
SJSU – CmpE ---
M.E. Fayad
View 5
L7-1-S22
Stable Analysis Patterns
Solution Requirements (1)
 Successful
applications will be
accessible from several devices.
 Complex applications should be built as
a composite of multiple models, not as a
single complex model.
 Therefore, the solution should deal with
the situation of having multiple models
within the applications.
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S23
23
Stable Analysis Patterns
Solution Requirements (2)
 Sometimes
the required view is
constructed from the isolation of different
parts from several models within the
application. Mapping mechanisms are
not predefined.
 The pattern needs to be abstract and not
tied to any specific technology.
24
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S24
Stable Analysis Patterns
Current Solutions- Overview



Developers would prefer a solution that separates the
presentation from the application logic.
One common approach that has been suggested is to
use the Model-View-Control (MVC) framework to
address some of issues regarding multi-device
interfaces. [For example: San Francisco, and Java
platform for wireless Applications: J2EE and J2ME].
Others approaches propose the use of different design
patterns such as: Pipe and Filter patterns.
25
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S25
Stable Analysis Patterns
Current Solutions- Limitations



None of the current solutions consider the
situation of having multiple models within the
application.
Therefore, they do not consider the
composition of multiple models in a single
view and vise versa.
None of them have addressed the way by
which an arbitrary numbers of views can be
generated from a single abstract model. All
existing solutions assume a predefined set of
views associated with a single model
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S26
26
Stable Analysis Patterns
Proposed Solution (1)




We propose the Stable Model-View Mapping
(MVM) as a solution to the mapping problem.
the Stable MVM is a collection of patterns that
deal with the problem of mapping an abstract
model to an abstract view.
The pattern handles the situation of having more
than one model within the same application.
The pattern is general enough to to deal with
mapping problem for different devices with
different capabilities.
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S27
27
Stable Analysis Patterns
Proposed Solution (2)




No predefined models and predefined views
Mapping of Passive Models, such as relations in
RDB and Live Models, such as return of
playMovie().
The pattern is applicable for multiple purposes,
such scalability, simplicity, viewing, fitting,
editing, etc..
The pattern provides a base for building multiple
applications.
28
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S28
Stable Analysis Patterns
Pattern Structure
Such as:
- Viewing
- Simpli ci ty
- Model ing
- Scalabil ity
- T ractabi lity
<<Pattern-BO>>
Applicability
specifi c appl ication
uses
1..*
<<Pattern-BO>>
AnyModel
1..*
gets
model
mappi ng
<<Pattern-EBT>>
Mapping
maps
mappi ng
1..*
view
<<Pattern-BO>>
AnyView
1..*
1..*
1..*
returns
displ ays
1..*
<<Pattern-BO>>
AnyMedia
<<Pattern-BO>>
AnyApplicati on
search
search
1..*
generates
search
views
appears / transmits
searching
<<Pattern-EBT>>
Searching
searching
requests
party
© M.E. Fayad 1996-2005
<<Pattern-BO>>
AnyParty
SJSU – CmpE ---
party
M.E. Fayad
L7-1-S29
Stable Analysis Patterns
Participants (1)
 The
participants of the Stable MVM
pattern are divided into two kinds:
Classes and Patterns.
 Classes

Applicability. Describes the application and the
purpose for which mapping is needed.
 Patterns

AnyModel. Describes the models within the application.
The model is a representation of the data within the
application.
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S30
30
Stable Analysis Patterns
Participants (2)

AnyView. Represents the view of a collection of data (the
model).

AnyParty. Represents both the modeler and the viewer.
The modeler is responsible for building the data models in the
appropriate abstract level. The viewer requests the model
and the mapped view of that model.

AnyMedia. Defines the media upon which the models and
views are mapped and transmitted. It also represents the
media by which the views are to be displayed (Phone, PCs,
etc.)
31
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S31
Stable Analysis Patterns
Participants (3)

Mapping. Defines the mapping rules between the
models and their views. It also determines how this
mapping will be performed.

Searching. Searches AnyMedia for the requested
application, model, or view.

AnyApplication. Represents the application that is
requested by AnyParty.
32
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S32
Stable Analysis Patterns
2nd Level Of Abstraction
How to build a model that can be used to present any media in any application?
Such as:
- Desire or appeal
- Assessm ent
- Viewing
- Advertism ent
- Mobi li ty
For exam pl e:
- Institution
- T heater
- Audi ance
<<BO>>
AnyParty
1..*
uses
specifi c
appl ication
<<EBT>>
Applicatbility
For exam pl e:
- Broadcast media
- Audi o medi a
- Multi medi a
- Mobi le media
specifi c appl ication
type
uses
1..*
anyMedia
<<BO>>
1..*
AnyMedia
Media_1
© M.E. Fayad 1996-2005
Media_2
SJSU – CmpE ---
uses
specifi c
media
type
<<BO>>
MediaType
33
Media_n
M.E. Fayad
L7-1-S33
Stable Analysis Patterns
Applicability with Illustrated Example
Weather Application



The weather application provides several services,
such as: the weather for all countries and their cities all
over the world, the weather forecast for the next few
days, satellite photos, current forecast on video, etc.
In this application, the user wants to view the weather
on different devices with different capabilities.
weather applications is developed in terms of smaller
models, since having one model that deals with all of
these features will be hard to manage and adapt for
different devices.
34
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S34
Stable Analysis Patterns
Weather Application (1)
Weather
Application
Interactive map model
Photo model
•Weather information
•Warning reports
Video model
© M.E. Fayad 1996-2005
One possible view
For the weather application
Weather application view
on the PC
Text model
SJSU – CmpE ---
M.E. Fayad
L7-1-S35
Stable Analysis Patterns
Weather Application (2)
Weather
Application
Interactive map model
Photo model
One possible view
For the weather application
•Weather information
•Warning reports
Video model
© M.E. Fayad 1996-2005
Text model
SJSU – CmpE ---
M.E. Fayad
L7-1-S36
Stable Analysis Patterns
Weather Application (3)



To show the applicability of the Stable MVM
pattern to the weather application, we show show
an instance of the pattern.
The pattern instantiation is useful in visualizing
each component in the pattern in reality.
The instantiation diagram shows also how the
different component of the pattern interact with
each other in real applications.
37
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S37
Stable Analysis Patterns
Instantiation Symbols Description
AnyView
Represents the pattern name as given in
the pattern object diagram
Points to an instance of the pattern in the
current application example.
Represents the typical flow of the
interactions within the application
example.
Represents a logical interaction between
the different pattern within the application
example.
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S38
Stable Analysis Patterns
Applicability
Simplification
Integration
use
Mapping
View
AnyView
search
Forward request
Forward view
AnyMedia
The
Internet
Forward request
Forward view
Mapping
View
search
AnyApplication
Server
search
Weather
Application
AnyModel
Interactive map model
search
Wireless Network
Searching
Photo model
search
AnyParty
•Weather information
•Warning reports
Video model
Text
model1996-2005
© M.E.
Fayad
generate
SJSU – CmpE ---
developer
M.E. Fayad
L7-1-S39
Stable Analysis Patterns
Discussion Questions
1. Generate instance diagrams for another applications of
MVM.
2. Model the following concepts: viewing, simplifying, searching,
and scalability.
3. Use negotiation pattern to model the following concepts:
diplomatic negotiation, negotiating peace settlement, and
trade negotiation.
40
© M.E. Fayad 1996-2005
SJSU – CmpE ---
M.E. Fayad
L7-1-S40
Stable Analysis Patterns