+ All Categories
Home > Documents > Chapter 6 Design Model. Design Model (DM) Guiding principles Guiding principles All classes should...

Chapter 6 Design Model. Design Model (DM) Guiding principles Guiding principles All classes should...

Date post: 16-Dec-2015
Category:
Upload: suzan-davis
View: 224 times
Download: 1 times
Share this document with a friend
Popular Tags:
53
Chapter 6 Chapter 6 Design Model Design Model
Transcript

Chapter 6Chapter 6Design ModelDesign Model

Design Model (DM)Design Model (DM) Guiding principles Guiding principles

All classes should be specified to the level of detail All 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 flow A sequence diagram should be defined for each flow of events in each use case.of events in each use case.

All messages in sequence diagrams should All messages in sequence diagrams should represent actual operations of participating objectsrepresent actual operations of participating objects

You should avoid representing in the diagram the You should avoid representing in the diagram the classes of the underlying technological framework classes of the underlying technological framework (e.g., classes in Java packages)(e.g., classes in Java packages)

Achieve class cohesiveness, minimizing Achieve class cohesiveness, minimizing communication between classes.communication between classes.

DM: Guiding principles -tempDM: Guiding principles -temp

Domain entities:Domain entities: Classes, objects, and packages that are found from Classes, objects, and packages that are found from

the use cases to specify system functionsthe use cases to specify system functions Entities of this type at the design model are basically Entities 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 Operations and attributesOperations and attributes

Implementation-level entities:Implementation-level entities: Classes, objects, and packages that are identified by Classes, objects, and packages that are identified by

the designer to support the implementation of the the designer to support the implementation of the system.system.

Examples includes list, database tables, Java beansExamples includes list, database tables, Java beans

DM: Model structureDM: Model structure The same analysis packages are also design packagesThe same analysis packages are also design packages Each design package is structured into three layers:Each design package is structured into three layers:

Presentation layerPresentation layer Business layerBusiness layer Data access layerData access layer

Each design package has subpackages for the Each design package has subpackages for the realization of the use case in the packagerealization of the use case in the package Use elements in the three layers to realize each use case in Use elements in the three layers to realize each use case in

the packagethe package At the business layer of each package there is an entity At the business layer of each package there is an entity

manager that manages all elements/entities of the manager that manages all elements/entities of the package at the data access layer.package at the data access layer.

Design model structureDesign model structure

Figure 6-2

Data access

DM: Model structureDM: Model structure

Presentation

Business

Use case realizations

Business package i

Data Types

Wrappers

Data Access

DM: Data Access Layer - 1DM: Data Access Layer - 1

Although entities are managed by different Although entities are managed by different managers, but each use case may need, managers, but each use case may need, normally does, entities from other packages to normally does, entities from other packages to be realized.be realized.

Create a data model for the whole systemCreate a data model for the whole system When an entity (A) has an association with When an entity (A) has an association with

another entity (B) which is managed by a another entity (B) which is managed by a different entity manager, then the manager of A different entity manager, then the manager of A must request services from the manager of B in must request services from the manager of B in order to make changes or retrieve info oforder to make changes or retrieve info of B. B.

DM: Data Access Layer - 2DM: Data Access Layer - 2

The data access layer may be further The data access layer may be further divided into:divided into:Data Type classes: the data itself (stored in : the data itself (stored in

DB).DB).Wrapper classes: the data and getters and : the data and getters and

setters.setters.Data Access Layer classes: that define a set : that define a set

of operations for the specific needs of our of operations for the specific needs of our solutionsolutionCRUD: create, retrieve, update, and deleteCRUD: create, retrieve, update, and delete

DM: Data Access Layer - 3DM: Data Access Layer - 3

Data Access Layer and Wrapper classes

StudentDALcreate()

findStudent(id)findStudents(major)

Update()Delete()

MajorDALcreate()

findMajor(id)Update()Delete()

MajorInfoId

NameHost college

StudentInfossn

NameAddress

DOB

Data Type ClassesRegisterInfo

StudentSSNSectionNo

grade

<Wrapper>>

MajorId, Name,hostCollegeGetters()Setters()

<Wrapper>>

StudentSSN, name,Address, DOBGetters()Setters()

DM: Data Access Layer - 4DM: Data Access Layer - 4 Data Type classes are mapped to relations (tables) in Data Type classes are mapped to relations (tables) in

relational database.relational database. Each M:N relationship between data type classes is Each M:N relationship between data type classes is

mapped to a table (called association table). (e.g., table mapped to a table (called association table). (e.g., table registerregister in next slide) in next slide)

When an M:N relationship spans two entities managers, When an M:N relationship spans two entities managers, the association table belongs to both managers (e.g., the association table belongs to both managers (e.g., table table registerregister on next slide). on next slide).

The database model can be traced back to the The database model can be traced back to the managed entities diagram in the Analysis Model (see managed entities diagram in the Analysis Model (see Managed Entity Diagram slide)Managed Entity Diagram slide)

DM: Data Access Layer - 5DM: Data Access Layer - 5

<<table>>

StudentInfossn

NameAddress

DOBmajorID

<<table>>

MajorInfoId

NameHost college

Database Model

<<table>>

SectionInfosectionNolocationcourseIDInstructor

<<table>>

CourseInfoCourseID

TitleCredits

<<table>>

FacultyInfossn

NameOffice

department

<<table>>

DeptInfodeptIDName

mainOffice

<<table>>

RegisterInfoStudentSSNSectionNo

grade

Note: Arrows show foreign keys.

DM: Data Access Layer - 6DM: Data Access Layer - 6

<<table>>

StudentInfossn: char(9);name: varchar(20)address:DOB: char(8);majorID: int

StudentDAL+create(Student s): int+findBySSN(string ssn): Student+findByMajor(mid): List<Student>+update(Student s): int+delete(string ssn): int+getMajor(string ssn): int+getTranscript(string ssn): List<crsId, grd>;

<<Wrapper>>

Student-ssn: string-Name: string-Address: string-DOB: Date-majorID: int+get/setSSN(ssn);+get/setName(name);+get/setAddr(addr);+get/setDOB(date)+get/setMajor(int mid)

<<table>>

RegisterInfoStudentSSNSectionNo

grade

RDBMS

DM: Data Access Layer - 8DM: Data Access Layer - 8

StudentDAL

<<Wrapper>>

Student

<<table>>

StudentInfo

<<table>>

RegisterInfo

RDBMS

Web Server: Node

<<driver>>

JDBC

DB Server: Node

<<driver>>

JDBC

MajorDAL

<<Wrapper>>

Major

<<table>>

MajorInfo

Intranet

A Look Ahead to deployment

DM: Presentation layerDM: Presentation layer Three diagrams are defined for each business package:Three diagrams are defined for each business package:

Boundary traceability (Mapping): traces each XyzView back to traces each XyzView back to the boundary classesthe boundary classes

Each screen (and its included input forms) is mapped to a Each screen (and its included input forms) is mapped to a XyzView class XyzView class

Control traceability (mapping): trace dispatcher classes back to trace dispatcher classes back to dispatcher classes in analysis modeldispatcher classes in analysis model

Each dispatcher class in analysis model is mapped to a dispatcherEach dispatcher class in analysis model is mapped to a dispatcher Participants: a class diagram showing the relationship between a class diagram showing the relationship between

classes in the presentation layer (including XyzView classes classes in the presentation layer (including XyzView classes and dispatchers)and dispatchers)

Show the relationship between View classes and dispatchersShow the relationship between View classes and dispatchers

MediatorMediatorDesign PurposeDesign Purpose

Avoid references between dependent Avoid references between dependent objects.objects.

Design Pattern SummaryDesign Pattern SummaryCapture mutual behavior in a separate Capture mutual behavior in a separate

class.class.

Mediator - ModelMediator - Model

Mediator Colleague

ConcreteMediator

Colleague_BColleague_A

Mediator Sequence DiagramMediator Sequence Diagram

Client A:Colleague_A

:Mediator

B: Colleague_B

request()

takeAction_1()

mediate()

:Mediator C: Colleague_A

takeAction_2()

takeAction_3()

DM: Business layerDM: Business layer

The entity manager of each business package The entity manager of each business package is mapped to a subsystem.is mapped to a subsystem. A subsystem is an instance of a packageA subsystem is an instance of a package The Interface: the specification of the subsystem, The Interface: the specification of the subsystem,

defines everything a client needs to know in order to defines everything a client needs to know in order to use the subsystemuse the subsystem

The realization of the interface: the implementation The realization of the interface: the implementation of the subsystem, interior structure that implements of the subsystem, interior structure that implements the interface.the interface.

To start, define one class that implements all the To start, define one class that implements all the

operations specified in the interfaceoperations specified in the interface..

AM: Relationship between classesAM: Relationship between classes

SectionInfo

CourseInfo

ClassroomInfo

dispatcher

dispatcher

dispatcher

Presentation Layer

Business Package i

Business Layer Data Access Layer

Course

Section

Classroom

CourseDAL

CroomDAL

SectionDAL

Entity Manager

Subsystem

DM: Identify class operations - 1DM: Identify class operations - 1

For Boundary classes (View classes/Web pages):For Boundary classes (View classes/Web pages): Attributes of a screen are mapped to text displayAttributes of a screen are mapped to text display An input form is mapped to an HTML formAn input form is mapped to an HTML form Attributes of an input form are input fields of the Attributes of an input form are input fields of the

HTML formHTML form Operations of a screen may be mapped to Operations of a screen may be mapped to

Javascript display function and Web linksJavascript display function and Web links Operations of an input form may be mapped to Operations of an input form may be mapped to

HTML form submit buttons.HTML form submit buttons. The program that processes the HTML form submits The program that processes the HTML form submits

is the dispatcher of the use case.is the dispatcher of the use case.

DM: Identify class operations - 2DM: Identify class operations - 2 Identify operations for control and data access Identify operations for control and data access

layer classeslayer classes Use sequence diagram to help in identifying class Use sequence diagram to help in identifying class

operations for all control classes (dispatchers and operations for all control classes (dispatchers and entity manager) and entity classes (data access entity manager) and entity classes (data access layer classes)layer classes)

For every scenario of every use case, create a For every scenario of every use case, create a sequence diagram.sequence diagram.

Follow the message in the sequence diagram one by Follow the message in the sequence diagram one by one to identify the operation the receiving class one to identify the operation the receiving class should have.should have.

DM: Identify class operations - 3DM: Identify class operations - 3

Each operation identified should be Each operation identified should be documented with: documented with: name of the operationname of the operation A brief description of the operation’s functionA brief description of the operation’s function In and out parametersIn and out parameters Return valueReturn value Define the skeleton of the operation’s body as Define the skeleton of the operation’s body as

feasible.feasible. Follow the javadoc, cppdoc, and phpdoc format Follow the javadoc, cppdoc, and phpdoc format

or a standard.or a standard.

DM: SummaryDM: Summary For each business packageFor each business package

Each boundary class is mapped to a Web pageEach boundary class is mapped to a Web page The entity manager is mapped to the entity manager The entity manager is mapped to the entity manager

subsystemsubsystem Each dispatcher is mapped to a subclass of HTTPServletEach dispatcher is mapped to a subclass of HTTPServlet Each entity class is mapped to Each entity class is mapped to

A DAL classA DAL class A wrapper class (Java Bean)A wrapper class (Java Bean) A data type class (DB table)A data type class (DB table)

Identify operationsIdentify operations Each operation of a boundary class from the user experience Each operation of a boundary class from the user experience

model is mapped to a web link, or an html submit inputmodel is mapped to a web link, or an html submit input For dispatchers, entity manager subsystem (its classes), and For dispatchers, entity manager subsystem (its classes), and

DAL classesDAL classes Use sequence diagrams to identify their operations based on the Use sequence diagrams to identify their operations based on the

messages a receiving class receives.messages a receiving class receives.

Managed entitiesManaged entities

Figure 6-3

Data Access classes for User Data Access classes for User Account ManagementAccount Management

Figure 6-4

XML Schema designer in Microsoft Visual XML Schema designer in Microsoft Visual Studio .NET, with the definition of a strongly Studio .NET, with the definition of a strongly

typed DataSettyped DataSet..

Figure 6-5

Database modelDatabase model

Figure 6-6

Tracing Data Access classes Tracing Data Access classes to analysis classesto analysis classes

Figure 6-7

Structure detail of the Data Structure detail of the Data Access Layer packageAccess Layer package

Figure 6-8

Structure detail of the Structure detail of the Presentation Layer packagePresentation Layer package

Figure 6-9

Equivalence of structures between Equivalence of structures between design model and analysis modeldesign model and analysis model

Figure 6-10

Tracing dispatcher classes to Tracing dispatcher classes to analysis classesanalysis classes

Figure 6-11

Tracing Web forms/controls Tracing Web forms/controls to analysis classesto analysis classes

Figure 6-12

Participants in the presentation layer Participants in the presentation layer of User Account Managementof User Account Management

Figure 6-13

Structure detail of the Structure detail of the Business Layer packageBusiness Layer package

Figure 6-14

Enterprise component interface with Enterprise component interface with associated Data Layer classesassociated Data Layer classes

Figure 6-15

Tracing enterprise component Tracing enterprise component interface to analysis classesinterface to analysis classes

Figure 6-16

Realization of the enterprise Realization of the enterprise component interfacecomponent interface

Figure 6-17

Class diagram for the enterprise Class diagram for the enterprise component implementationcomponent implementation

Figure 6-18

Structure detail of the Use Structure detail of the Use Case Realizations packageCase Realizations package

Figure 6-19

Tracing use case realizations Tracing use case realizations from design to analysisfrom design to analysis

Figure 6-20

Figure 6-22

Sequence diagram for the basic Sequence diagram for the basic flow of Create Account use caseflow of Create Account use case

Figure 6-23

Structure detail of the Structure detail of the Common packageCommon package

Figure 6-24

Collaboration detail: Collaboration detail: CreateAccount_Entry validationCreateAccount_Entry validation

Figure 6-25

Collaboration detail: Create Collaboration detail: Create AccountAccount

Figure 6-26

Collaboration detail: Adding Collaboration detail: Adding User to GroupUser to Group

Figure 6-27

Role-based security handling: Role-based security handling: ParticipantsParticipants

Figure 6-28

Activity graph: submitSignIn Activity graph: submitSignIn in SignInDispatcher classin SignInDispatcher class

Figure 6-29

Sequence diagram: Set Session Sequence diagram: Set Session Authentication on Sign-InAuthentication on Sign-In

Figure 6-30

Declare forms authentication Declare forms authentication in Web.configin Web.config

Figure 6-31

Activity graph: Activity graph: Application_AuthenticateRequest in Application_AuthenticateRequest in

Global classGlobal class

Figure 6-32

Sequence diagram: Request Sequence diagram: Request authenticated but no role cookieauthenticated but no role cookie

Figure 6-33


Recommended