0% found this document useful (0 votes)
47 views34 pages

Slide 12 SubsystemDesign

The document discusses subsystem design, which involves: 1) Distributing subsystem behavior to internal elements like classes. 2) Documenting these elements and their collaborations. 3) Describing dependencies outside the subsystem. The goal is to realize subsystem interfaces through loose coupling and encapsulation of internal details. Behavior is allocated to design elements in interaction diagrams for each interface operation.

Uploaded by

Nguyen Hoai Tam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views34 pages

Slide 12 SubsystemDesign

The document discusses subsystem design, which involves: 1) Distributing subsystem behavior to internal elements like classes. 2) Documenting these elements and their collaborations. 3) Describing dependencies outside the subsystem. The goal is to realize subsystem interfaces through loose coupling and encapsulation of internal details. Behavior is allocated to design elements in interaction diagrams for each interface operation.

Uploaded by

Nguyen Hoai Tam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Object-Oriented Analysis and Design

Lecture 12: Subsystem Design


Objectives: Subsystem Design
 Describe the purpose of Subsystem Design
and where in the lifecycle it is performed
 Define the behaviors specified in the
subsystem's interfaces in terms of
collaborations of contained classes
 Document the internal structure of the
subsystem
 Determine the dependencies upon
elements external to the subsystem

Object Oriented Analysis and Design 2


Subsystem Design in Context
[Early
Elaboration [Inception
Iteration] Iteration (Optional)]

Define a Candidate Perform


Architecture Architectural
Synthesis

Analyze Behavior

(Optional)
Refine the
Architecture

Subsystem
Design Designer Define Design the
Components Database

Object Oriented Analysis and Design 3


Subsystem Design Overview

Design Subsystems
and Interfaces

Subsystem
Design
Project Specific
Guidelines

Design Classes

Object Oriented Analysis and Design 4


Review: Subsystems and Interfaces
A Subsystem:
 Is a “cross between” a package and a class
 Realizes one or more interfaces that define
its behavior
<<interface>> <<subsystem>>
Interface Subsystem Name

Realization (Canonical form)


Subsystem
Interface
<<subsystem>>
Subsystem Name

Interface
Realization (Elided form)
Object Oriented Analysis and Design 5
Subsystem Guidelines
 Goals
 Loose coupling <<subsystem>>
A
 Portability, plug-and-play
compatibility
 Insulation from change
<<subsystem>>
 Independent evolution B
 Strong Suggestions
 Do not expose details, only interfaces
 Depend only on other interfaces <<subsystem>>
C
Key is abstraction and encapsulation

Object Oriented Analysis and Design 6


Review: Modeling Convention for Subsystems and Interfaces

<<subsystem>>
CourseCatalogSystem
ICourseCatalogSystem

<<subsystem>> package

<<subsystem proxy>> class

Interfaces start with an “I” <<subsystem>>


CourseCatalogSystem
<<subsystem proxy>>

ICourseCatalogSystem

Interfaces are EXTERNAL to the subsystem.

Object Oriented Analysis and Design 7


Subsystem Design Steps
 Distribute subsystem behavior to
subsystem elements
 Document subsystem elements
 Describe subsystem dependencies
 Checkpoints

Object Oriented Analysis and Design 8


Subsystem Design Steps
 Distribute subsystem behavior to
subsystem elements
 Document subsystem elements
 Describe subsystem dependencies
 Checkpoints

Object Oriented Analysis and Design 9


Subsystem Responsibilities
 Subsystem responsibilities defined by
interface operations
 Model interface realizations
 Interface operations may be realized by
 Internal class operations
 Internal subsystem operations
<<interface>>
ICourseCatalogSystem <<subsystem>>
CourseCatalogSystem
getCourseOfferings()

subsystem responsibility

Object Oriented Analysis and Design 10


Distributing Subsystem Responsibilities
 Identify new, or reuse existing, design elements (for
example, classes and/or subsystems)
 Allocate subsystem responsibilities to design elements
 Incorporate applicable mechanisms (for example,
persistence, distribution)
 Document design element collaborations in “interface
realizations”
 One or more interaction diagrams per interface
operation
 Class diagram(s) containing the required design
element relationships
 Revisit “Identify Design Elements”
 Adjust subsystem boundaries and dependencies, as
needed

Object Oriented Analysis and Design 11


Modeling Convention: Subsystem Interaction Diagrams

Subsystem Subsystem Design Design


Client Proxy Element1 Element2

performResponsibility( )
Op1( )

Subsystem Op2( )
responsibility
Internal
Op3( ) subsystem
interactions

Op4( )

Subsystem interface not shown


Object Oriented Analysis and Design 12
Example: CourseCatalogSystem Subsystem in Context
: RegisterForCourses : Registration : ICourseCatalog : Schedule : Student
: Registrar Form Controller System

1://create schedule( )
2://get course offerings( )
3://get course offerings( ) Subsystem
Student wishes to 4://display course offerings( )
interface
create a new
schedule
Subsystem responsibility
5://display blank schedule( )

A list of the A blank schedule


available course displayed for the
offerings for this students to select
semester… offerings

6://select 4 primary and 2 alternate offerings( )


7://create schedule with offerings( )

8://create with offerings( )

9://add schedule(Schedule)

Legacy RDBMS Database Access


Object Oriented Analysis and Design 13
Incorporating the Architectural Mechanisms: Persistency

 Analysis-Class-to-Architectural-Mechanism
Map from Use-Case Analysis
Analysis Class Analysis Mechanism(s)

Student Persistency, Security OODBMS


Schedule Persistency, Security Persistency

CourseOffering Persistency, Legacy Interface RDBMS


Course Persistency, Legacy Interface Persistency
RegistrationController Distribution

OODBMS Persistency was


discussed in Use-Case Design

Object Oriented Analysis and Design 14


Review: Incorporating JDBC: Steps
 Provide access to the class libraries needed to
implement JDBC
  Provide java.sql package
 Create the necessary DBClasses
 One DBClass per persistent class
 Course Offering persistent class =>
DBCourseOffering

 - Done

Object Oriented Analysis and Design 15


Review: Incorporating JDBC: Steps (cont.)
 Incorporate DBClasses into the design
 Allocate to package/layer
• DBCourseOffering placed in
CourseCatalogSystem subsystem
 Add relationships from persistency clients
• Persistency clients are the
CourseCatalogSystem subsystem clients
 Create/Update interaction diagrams that describe:
 Database initialization
 Persistent class access: Create, Read, Update,
Delete

Object Oriented Analysis and Design 16


Example: Local CourseCatalogSystem Subsystem Interaction
CourseCatalog : CourseCatalog : DBCourse : Connection : Statement :CourseOffering : Course : ResultSet
System Client System Offerring List Offering

: Course Catalog
1. getCourseOfferings(Semester)
Retrieve all available course
offerings for the current
semester
Subsystem Proxy
1.1. read(string)

1.1.1. createStatement( )
sql statement is passed in
specifying the search criteria 1.1.2. executeQuery(String)
course offerings in the
current semester 1.1.2.1. // executeQuery( )

Create a list to hold all


Repeat these operations for retrieved course offerings RDBMS
each element returned from 1.1.3. new( ) Read
the executeQuery()
command. 1.1.4. new( )
The CourseOfferingList is
2. getString( )
loaded with the data
retrieved from the database.
3. setData( )
The getData and setData
operations are called for 4. add(CourseOffering)
each attribute in the each
retrieved class instance.
Add the retrieved course
offering to the list to be returned

Object Oriented Analysis and Design 17


Example: Billing System Subsystem In Context
subsystem interface
: CloseRegistration : CloseRegistration : ICourseCatalog : Course : Schedule : Student. : Ibilling
: Registrar
Form Controller System Offering System

1. // close registration( )
1.1. // is registration open?( ) Retrieve a list of course
offerings for the current
semester
2. // close registration( )
Close
2.1. getCourseOfferings(Semester) registration for
each course
offering If the maximum number of
Repeat twice this selected primary courses have
is for simplicity; 2.2. // close registration( )
not been committed, select
realistically, an alternate course offerings).
indefinite number
of iterations could
occur) 2.3. // level( )

Finally commit or
2.4. // close( ) Currently assuming tuition based on
cancel the course
offering once all number of offerings taken and certain
leveling has occurred attributes of students. If different offerings
get different prices this will change slightly.
2.5. getTuition( )
Send student and tuition to
the Billing System, which will
do the actual billing to the 2.6. submitBill(Student, double)
student for the schedule.

subsystem responsibility
Object Oriented Analysis and Design 18
Example: Local BillingSystem Subsystem Interaction
Subsystem Proxy
Billing System : BillingSystem : StudentBillingTransaction : Student :BillingSystemInterface : Billing System
Client

1. submitBill(Student, double)
Retrieve the
information that must
1.1. create(Student, double) be included on the bill

1.1.1. // get contact info( )

1.2. submit(StudentBillingTransaction)

1.2.1. // open connection( )

1.2.2. // process transaction( )

1.2.3. // close connection( )

Object Oriented Analysis and Design 19


Subsystem Design Steps
 Distribute subsystem behavior to
subsystem elements
 Document subsystem elements
 Describe subsystem dependencies
 Checkpoints

Object Oriented Analysis and Design 20


Example: CourseCatalogSystem Subsystem Elements
<<Interface>>
ICourseCatalogSystem
(from External System Interfaces)
Subsystem Proxy
getCourseOfferings(forSemester : Semester) : CourseOfferingList

<<subsystem proxy>>
CourseCatalogSystem
Subsystem Interface
getCourseOfferings(forSemester : Semester) : CourseOfferingList

CourseOfferingList
(from University Artifacts) DBCourseOfferring

new() create() : CourseOffering


add() read(searchCriteria : string) : CourseOfferingList
1 1

0..*
1
<<Entity>>
CourseOffering Connection
(from University Artifacts) (from java.sql) Statement
(from java.sql) ResultSet
(from java.sql)
new() createStatement()
executeQuery()
setData() getString()
executeUpdate()

Object Oriented Analysis and Design 21


Example: Billing System Subsystem Elements
<<Interface>>
IBillingSystem
(from External System Interfaces)

submitBill() StudentBillingTransaction

create(forStudent : Student, forAmount : double)


Subsystem Interface

<<Entity>>
<<subsystem proxy>>
Student
BillingSystem
(from University Artifacts)

submitBill(forStudent : Student, forTuition : double)


// get contact info()
1

Subsystem Proxy
0..1
BillingSystemInterface

submit(theTransaction : StudentBillingTransaction)

Object Oriented Analysis and Design 22


Subsystem Design Steps
 Distribute subsystem behavior to
subsystem elements
 Document subsystem elements
 Describe subsystem dependencies
 Checkpoints

Object Oriented Analysis and Design 23


Subsystem Dependencies: Guidelines
 Subsystem dependency on a subsystem
<<subsystem>> <<subsystem>>
Client Support Server Support
Flexible,
Server
Preferred

 Subsystem dependency on a package

<<subsystem>>
Supporting
Client Support
Types Use with care

Object Oriented Analysis and Design 24


Example: CourseCatalogSystem Subsystem Dependencies

<<subsystem>>
CourseCatalogSystem
(from Business Services)

External System
Interfaces
(from Business Services)

University Artifacts
(from Business Services)

java.sql
(from Middleware)

Object Oriented Analysis and Design 25


Example: BillingSystem Subsystem Dependencies

<<subsystem>>
BillingSystem
(from Business Services)

External System
Interfaces
(from Business Services)

University Artifacts
(from Business Services)

Object Oriented Analysis and Design 26


Subsystem Design Steps
 Distribute subsystem behavior to
subsystem elements
 Document subsystem elements
 Describe subsystem dependencies
 Checkpoints

Object Oriented Analysis and Design 27


Checkpoints: Design Subsystems
 Is a realization association defined for each
interface offered by the subsystem?
 Is a dependency association defined for
each interface used by the subsystem?
 Are you sure that none of the elements
within the subsystem have public visibility?
 Is each operation on an interface realized by
the subsystem documented in a interaction
diagram? If not, is the operation realized by
a single class, so that it is easy to see that
there is a simple 1:1 mapping between the
class operation and the interface operation?

Object Oriented Analysis and Design 28


Review: Subsystem Design
 What is the purpose of
Subsystem Design?
 How many interaction
diagrams should be
produced during
Subsystem Design?
 Why should dependencies
on a subsystem be on the
subsystem interface?

Object Oriented Analysis and Design 29


Exercise: Subsystem Design
 Given the following:
 The defined subsystems, their
interfaces and their relationships
with other design elements (the
subsystem context diagrams)
 Patterns of use for the
architectural mechanisms

(continued)

Object Oriented Analysis and Design 30


Exercise: Subsystem Design (cont.)
 Identify the following for a
particular subsystem(s):
 The design elements contained
within the subsystem and their
relationships
 The applicable architectural
mechanisms
 The interactions needed to
implement the subsystem
interface operations

(continued)

Object Oriented Analysis and Design 31


Exercise: Subsystem Design (cont.)
 Produce the following diagrams for a
particular subsystem(s):
 “Interface realizations”
• Interaction diagram for each interface
operation
• Class diagram containing the subsystem
design elements that realize the interface
responsibilities and their relationships
 Class diagram that shows the subsystem and
any dependencies on external package(s)
and/or subsystem(s) (subsystem dependencies
class diagram)

Object Oriented Analysis and Design 32


Exercise: Review
 Compare your Subsystem Interface
Realizations
 Have all the main and/or subflows for
the interface operations been handled?
 Has all behavior been distributed
among the participating design
elements?
 Has behavior been distributed to the
right design elements?
 Are there any messages coming from
the interfaces?

Object Oriented Analysis and Design 33


Object Oriented Analysis and Design 34

You might also like