ch6 design model
TRANSCRIPT
-
7/25/2019 Ch6 Design Model
1/53
Chapter 6Chapter 6
Design ModelDesign Model
-
7/25/2019 Ch6 Design Model
2/53
Design Model (DM)Design Model (DM)
Guiding principlesGuiding principlesAll classes should be specified to the level of detailAll classes should be specified to the level of detail
that they represent implementation classes.that they represent implementation classes.
A sequence diagram should be defined for each floA sequence diagram should be defined for each flo
of events in each use case.of events in each use case.All messages in sequence diagrams should representAll messages in sequence diagrams should represent
actual operations of participating ob!ectsactual operations of participating ob!ects
"ou should avoid representing in the diagram the"ou should avoid representing in the diagram the
classes of the underlying technological frameor#classes of the underlying technological frameor#(e.g.$ classes in %ava pac#ages)(e.g.$ classes in %ava pac#ages)
Achieve class cohesiveness$ minimi&ingAchieve class cohesiveness$ minimi&ing
communication beteen classes.communication beteen classes.
-
7/25/2019 Ch6 Design Model
3/53
DM' Guiding principles tempDM' Guiding principles temp
Domain entities'Domain entities' Classes$ ob!ects$ and pac#ages that are found fromClasses$ ob!ects$ and pac#ages that are found from
the use cases to specify system functionsthe use cases to specify system functions
ntities of this type at the design model are basicallyntities of this type at the design model are basically
a copy of those in the analysis model by addinga copy of those in the analysis model by adding*perations and attributes*perations and attributes
+mplementationlevel entities'+mplementationlevel entities'
Classes$ ob!ects$ and pac#ages that are identified byClasses$ ob!ects$ and pac#ages that are identified bythe designer to support the implementation of thethe designer to support the implementation of the
system.system.
,amples includes list$ database tables$ %ava beans,amples includes list$ database tables$ %ava beans
-
7/25/2019 Ch6 Design Model
4/53
DM' Model structureDM' Model structure
-he same analysis pac#ages are also design pac#ages-he same analysis pac#ages are also design pac#ages ach design pac#age is structured into three layers'ach design pac#age is structured into three layers'
resentation layerresentation layer /usiness layer/usiness layer
Data access layerData access layer ach design pac#age has subpac#ages for theach design pac#age has subpac#ages for the
reali&ation of the use case in the pac#agereali&ation of the use case in the pac#age 0se elements in the three layers to reali&e each use case in0se elements in the three layers to reali&e each use case in
the pac#agethe pac#age
At the business layer of each pac#age there is an entityAt the business layer of each pac#age there is an entitymanager that manages all elements1entities of themanager that manages all elements1entities of thepac#age at the data access layer.pac#age at the data access layer.
-
7/25/2019 Ch6 Design Model
5/53
Design model structureDesign model structure
2igure 63
-
7/25/2019 Ch6 Design Model
6/53
Data access
DM' Model structureDM' Model structure
resentation
/usiness
0
s
e
c
a
se
r
e
a
li
&
a
tio
n
s
/usiness pac#age i
Data -ypes
4rappers
Data Access
-
7/25/2019 Ch6 Design Model
7/53
DM' Data Access 5ayer DM' Data Access 5ayer
Although entities are managed by differentAlthough entities are managed by differentmanagers$ but each use case may need$managers$ but each use case may need$normally does$ entities from other pac#ages tonormally does$ entities from other pac#ages tobe reali&ed.be reali&ed.
Create a data model for the hole systemCreate a data model for the hole system
4hen an entity (A) has an association ith4hen an entity (A) has an association ithanother entity (/) hich is managed by aanother entity (/) hich is managed by a
different entity manager$ then the manager of Adifferent entity manager$ then the manager of Amust request services from the manager of / inmust request services from the manager of / in
order to ma#e changes or retrieve info oforder to ma#e changes or retrieve info of/./.
-
7/25/2019 Ch6 Design Model
8/53
DM' Data Access 5ayer 3DM' Data Access 5ayer 3
-he data access layer may be further-he data access layer may be further
divided into'divided into'Data -ype classes' the data itself (stored in' the data itself (stored in
D/).D/).4rapper classes' the data and getters and' the data and getters and
setters.setters.
Data Access 5ayer classes' that define a set' that define a setof operations for the specific needs of ourof operations for the specific needs of our
solutionsolutionC70D' create$ retrieve$ update$ and deleteC70D' create$ retrieve$ update$ and delete
-
7/25/2019 Ch6 Design Model
9/53
DM' Data Access 5ayer 8DM' Data Access 5ayer 8
Data Access 5ayer
and 4rapper classes
9tudentDA5create()
find9tudent(id)
find9tudents(ma!or)
0pdate()
Delete()
Ma!orDA5create()
findMa!or(id)
0pdate()
Delete()
MajorInfoId
Name
Host college
StudentInfossn
Name
Address
DOB
Data -ype Classes7egister+nfo
9tudent99:
9ection:o
grade
;4rapper
-
7/25/2019 Ch6 Design Model
10/53
DM' Data Access 5ayer =DM' Data Access 5ayer =
Data -ype classes are mapped to relations (tables) inData -ype classes are mapped to relations (tables) inrelational database.relational database.
ach M': relationship beteen data type classes isach M': relationship beteen data type classes ismapped to a table (called association table). (e.g.$ tablemapped to a table (called association table). (e.g.$ table
registerregisterin ne,t slide)in ne,t slide) 4hen an M': relationship spans to entities managers$4hen an M': relationship spans to entities managers$
the association table belongs to both managers (e.g.$the association table belongs to both managers (e.g.$tabletable registerregisteron ne,t slide).on ne,t slide).
-he database model can be traced bac# to the-he database model can be traced bac# to the
managed entities diagram in the Analysis Model (seemanaged entities diagram in the Analysis Model (seeManaged ntity Diagram slide)Managed ntity Diagram slide)
-
7/25/2019 Ch6 Design Model
11/53
DM' Data Access 5ayer >DM' Data Access 5ayer >
;;table
-
7/25/2019 Ch6 Design Model
12/53
DM' Data Access 5ayer 6DM' Data Access 5ayer 6
StudentInfossn: char!"#
name: $archar%&"
address:
DOB: char'"#
majorID: int
9tudentDA5@create(9tudent s)' int
@find/y99:(string ssn)' 9tudent
(findB)Majormid": *ist
@update(9tudent s)' int
@delete(string ssn)' int@getMa!or(string ssn)' int
@get-ranscript(string ssn)' 5ist;crs+d$ grd
-
7/25/2019 Ch6 Design Model
13/53
DM' Data Access 5ayer BDM' Data Access 5ayer B
9tudentDA5
;;4rapper
-
7/25/2019 Ch6 Design Model
14/53
DM' resentation layerDM' resentation layer
-hree diagrams are defined for each business pac#age'-hree diagrams are defined for each business pac#age' /oundary traceability (Mapping)'traces each y&Eie bac# totraces each y&Eie bac# to
the boundary classesthe boundary classes ach screen (and its included input forms) is mapped to a y&Eieach screen (and its included input forms) is mapped to a y&Eie
classclass
Control traceability (mapping)'trace dispatcher classes bac# totrace dispatcher classes bac# todispatcher classes in analysis modeldispatcher classes in analysis model ach dispatcher class in analysis model is mapped to a dispatcherach dispatcher class in analysis model is mapped to a dispatcher
articipants'a class diagram shoing the relationship beteena class diagram shoing the relationship beteenclasses in the presentation layer (including y&Eie classesclasses in the presentation layer (including y&Eie classes
and dispatchers)and dispatchers) 9ho the relationship beteen Eie classes and dispatchers9ho the relationship beteen Eie classes and dispatchers
-
7/25/2019 Ch6 Design Model
15/53
MediatorMediatorDesign urposeDesign urposeAvoid re!erences bet"een dependentAvoid re!erences bet"een dependent
ob#ects$ob#ects$
Design attern SummaryDesign attern Summary%apture mutual behavior in a separate%apture mutual behavior in a separate
class$class$
-
7/25/2019 Ch6 Design Model
16/53
Mediator ModelMediator Model
Mediator -olleague
ConcreteMediator
ColleagueF/ColleagueFA
-
7/25/2019 Ch6 Design Model
17/53
Mediator Se&uence DiagramMediator Se&uence DiagramClient A'ColleagueF
A
'Mediator
/' ColleagueF/
request()
takeAction_1()
mediate()
'Mediator C' ColleagueFA
takeAction_2()
takeAction_3()
-
7/25/2019 Ch6 Design Model
18/53
DM' /usiness layerDM' /usiness layer
-he entity manager of each business pac#age-he entity manager of each business pac#age
is mapped to a subsystem.is mapped to a subsystem.A subsystem is an instance of a pac#ageA subsystem is an instance of a pac#age
-he +nterface' the specification of the subsystem$-he +nterface' the specification of the subsystem$defines everything a client needs to #no in order todefines everything a client needs to #no in order to
use the subsystemuse the subsystem
-he reali&ation of the interface' the implementation-he reali&ation of the interface' the implementation
of the subsystem$ interior structure that implementsof the subsystem$ interior structure that implementsthe interface.the interface.
.o start/ define one class that im0lements all the.o start/ define one class that im0lements all the
o0erations s0ecified in the interfaceo0erations s0ecified in the interface..
-
7/25/2019 Ch6 Design Model
19/53
AM' 7elationship beteen classesAM' 7elationship beteen classes
9ection+nfo
Course+nfo
Classroom+nfo
dispatcher
dispatcher
dispatcher
Presentation Layer
BusinessPackage i
Business
Layer Data Access Layer
Course
9ection
Classroom
CourseDA5
CroomDA5
9ectionDA5
ntity
Manager
9ubsystem
-
7/25/2019 Ch6 Design Model
20/53
DM' +dentify class operations DM' +dentify class operations
2or /oundary classes (Eie classes14eb pages)'2or /oundary classes (Eie classes14eb pages)'
Attributes of a screen are mapped to te,t displayAttributes of a screen are mapped to te,t display
An input form is mapped to an ?-M5 formAn input form is mapped to an ?-M5 form
Attributes of an input form are input fields of theAttributes of an input form are input fields of the?-M5 form?-M5 form
*perations of a screen may be mapped to*perations of a screen may be mapped to
%avascript display function and 4eb lin#s%avascript display function and 4eb lin#s
*perations of an input form may be mapped to*perations of an input form may be mapped to?-M5 form submit buttons.?-M5 form submit buttons.
-he program that processes the ?-M5 form submits-he program that processes the ?-M5 form submits
is the dispatcher of the use case.is the dispatcher of the use case.
-
7/25/2019 Ch6 Design Model
21/53
DM' +dentify class operations 3DM' +dentify class operations 3
+dentify operations for control and data access+dentify operations for control and data accesslayer classeslayer classes 0se sequence diagram to help in identifying class0se sequence diagram to help in identifying class
operations for all control classes (dispatchers andoperations for all control classes (dispatchers and
entity manager) and entity classes (data accessentity manager) and entity classes (data accesslayer classes)layer classes)
2or every scenario of every use case$ create a2or every scenario of every use case$ create asequence diagram.sequence diagram.
2ollo the message in the sequence diagram one by2ollo the message in the sequence diagram one byone to identify the operation the receiving classone to identify the operation the receiving classshould have.should have.
-
7/25/2019 Ch6 Design Model
22/53
DM' +dentify class operations 8DM' +dentify class operations 8
ach operation identified should beach operation identified should bedocumented ith'documented ith' name of the operationname of the operation
A brief description of the operations functionA brief description of the operations function +n and out parameters+n and out parameters 7eturn value7eturn value Define the s#eleton of the operations body asDefine the s#eleton of the operations body as
feasible.feasible. 2ollo the !avadoc$ cppdoc$ and phpdoc format2ollo the !avadoc$ cppdoc$ and phpdoc format
or a standard.or a standard.
-
7/25/2019 Ch6 Design Model
23/53
DM' 9ummaryDM' 9ummary
2or each business pac#age2or each business pac#age ach boundary class is mapped to a 4eb pageach boundary class is mapped to a 4eb page -he entity manager is mapped to the entity manager-he entity manager is mapped to the entity manager
subsystemsubsystem ach dispatcher is mapped to a subclass of ?--9ervletach dispatcher is mapped to a subclass of ?--9ervlet ach entity class is mapped toach entity class is mapped to
A DA5 classA DA5 classA rapper class (%ava /ean)A rapper class (%ava /ean)A data type class (D/ table)A data type class (D/ table)
+dentify operations+dentify operations ach operation of a boundary class from the user e,perienceach operation of a boundary class from the user e,perience
model is mapped to a eb lin#$ or an html submit inputmodel is mapped to a eb lin#$ or an html submit input 2or dispatchers$ entity manager subsystem (its classes)$ and2or dispatchers$ entity manager subsystem (its classes)$ and
DA5 classesDA5 classes 0se sequence diagrams to identify their operations based on the0se sequence diagrams to identify their operations based on the
messages a receiving class receives.messages a receiving class receives.
-
7/25/2019 Ch6 Design Model
24/53
Managed entitiesManaged entities
2igure 68
-
7/25/2019 Ch6 Design Model
25/53
Data Access classes !or 'serData Access classes !or 'ser
Account ManagementAccount Management
2igure 6=
-
7/25/2019 Ch6 Design Model
26/53
(ML Schema designer in Microso!t )isual(ML Schema designer in Microso!t )isual
Studio $N*+, "ith the de!inition o! a stronglyStudio $N*+, "ith the de!inition o! a strongly
typed DataSettyped DataSet$$
2igure 6>
-
7/25/2019 Ch6 Design Model
27/53
Database modelDatabase model
2igure 66
-
7/25/2019 Ch6 Design Model
28/53
+racing Data Access classes+racing Data Access classes
to analysis classesto analysis classes
2igure 6H
-
7/25/2019 Ch6 Design Model
29/53
Structure detail o! the DataStructure detail o! the Data
Access Layer packageAccess Layer package
2igure 6B
-
7/25/2019 Ch6 Design Model
30/53
Structure detail o! theStructure detail o! the
resentation Layer packageresentation Layer package
2igure 6I
-
7/25/2019 Ch6 Design Model
31/53
*&uivalence o! structures bet"een*&uivalence o! structures bet"een
design model and analysis modeldesign model and analysis model
2igure 6J
-
7/25/2019 Ch6 Design Model
32/53
+racing dispatcher classes to+racing dispatcher classes to
analysis classesanalysis classes
2igure 6
-
7/25/2019 Ch6 Design Model
33/53
+racing Web !orms-controls+racing Web !orms-controls
to analysis classesto analysis classes
2igure 63
-
7/25/2019 Ch6 Design Model
34/53
articipants in the presentation layerarticipants in the presentation layer
o! 'ser Account Managemento! 'ser Account Management
2igure 68
-
7/25/2019 Ch6 Design Model
35/53
Structure detail o! theStructure detail o! the
Business Layer packageBusiness Layer package
2igure 6=
-
7/25/2019 Ch6 Design Model
36/53
*nterprise component inter!ace "ith*nterprise component inter!ace "ith
associated Data Layer classesassociated Data Layer classes
2igure 6>
-
7/25/2019 Ch6 Design Model
37/53
+racing enterprise component+racing enterprise component
inter!ace to analysis classesinter!ace to analysis classes
2igure 66
-
7/25/2019 Ch6 Design Model
38/53
Reali.ation o! the enterpriseReali.ation o! the enterprise
component inter!acecomponent inter!ace
2igure 6H
-
7/25/2019 Ch6 Design Model
39/53
%lass diagram !or the enterprise%lass diagram !or the enterprise
component implementationcomponent implementation
2igure 6B
-
7/25/2019 Ch6 Design Model
40/53
Structure detail o! the 'seStructure detail o! the 'se
%ase Reali.ations package%ase Reali.ations package
2igure 6I
-
7/25/2019 Ch6 Design Model
41/53
+racing use case reali.ations+racing use case reali.ations
!rom design to analysis!rom design to analysis
2igure 63J
-
7/25/2019 Ch6 Design Model
42/53
2igure 633
-
7/25/2019 Ch6 Design Model
43/53
Se&uence diagram !or the basicSe&uence diagram !or the basic
!lo" o! %reate Account use case!lo" o! %reate Account use case
2igure 638
-
7/25/2019 Ch6 Design Model
44/53
Structure detail o! theStructure detail o! the
%ommon package%ommon package
2igure 63=
-
7/25/2019 Ch6 Design Model
45/53
%ollaboration detail:%ollaboration detail:
%reateAccount/*ntry validation%reateAccount/*ntry validation
2igure 63>
-
7/25/2019 Ch6 Design Model
46/53
%ollaboration detail: %reate%ollaboration detail: %reate
AccountAccount
2igure 636
-
7/25/2019 Ch6 Design Model
47/53
%ollaboration detail: Adding%ollaboration detail: Adding
'ser to 0roup'ser to 0roup
2igure 63H
-
7/25/2019 Ch6 Design Model
48/53
Role1based security handling:Role1based security handling:
articipantsarticipants
2igure 63B
-
7/25/2019 Ch6 Design Model
49/53
Activity graph: submitSign2nActivity graph: submitSign2n
in Sign2nDispatcher classin Sign2nDispatcher class
2igure 63I
-
7/25/2019 Ch6 Design Model
50/53
Se&uence diagram: Set SessionSe&uence diagram: Set Session
Authentication on Sign12nAuthentication on Sign12n
2igure 68J
-
7/25/2019 Ch6 Design Model
51/53
Declare !orms authenticationDeclare !orms authentication
in Web$con!igin Web$con!ig
2igure 68
-
7/25/2019 Ch6 Design Model
52/53
Activity graph:Activity graph:
Application/AuthenticateRe&uest inApplication/AuthenticateRe&uest in
0lobal class0lobal class
2igure 683
-
7/25/2019 Ch6 Design Model
53/53
Se&uence diagram: Re&uestSe&uence diagram: Re&uest
authenticated but no role cookieauthenticated but no role cookie
2igure 688