Detail Design Subsystem Design Background and The Dynamic Part
Detail Design Subsystem Design Background and The Dynamic Part
Subsystem Design
Background and the
Dynamic Part
1
Objectives: Subsystem Design
Understand 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 (mentioned in
Use Case Design)
Document internal structure of the subsystem
Determine the dependencies upon elements
external to the subsystem that may be needed to
support the responsibilities of the interface.
2
Subsystem Design in Context in the UP
At this time in our Design,
we have defined classes,
subsystems, their interfaces,
and their dependencies. Architectural
Analysis
‘containers’ of complex
behavior that we have
treated as a black box.
3
This is what subsystem design is all about.
Subsystem Design in Context
Here in subsystem design: We look at:
dependencies as needed.
Purpose: to define the behaviors specified in the interface via its contained classes:
to document the internal structure of the subsystem,
to define realizations between subsystem’s interface(s) and contained classes, &
to determine the dependencies upon other subsystems.
Subsystem
Design
Use-Case Realization Use-Case Realization
(updated)
Design 5
Guidelines Design Classes
Review: Subsystems and Interfaces
Subsystem is a “cross between” a package and a class
Has semantics of a package
(i.e., can contain other model elements)
<<subsystem>>
Subsystem Name
Interface 6
Realization (Elided form)
Review: Subsystems and Interfaces
An interface is a model element which defines a set of
behaviors (set of operations) offered by a classifier model
element (e.g., class, subsystem or component).
A classifier may realize one or more interfaces.
An interface may be realized by one or more classifiers.
<<interface>>
Interface <<subsystem>>
Subsystem Name
<<subsystem>>
Subsystem Name
Interface
7
Realization (Elided form)
Review: Subsystems and Interfaces
Interfaces are not classes; provide no default behavior.
Realization is a semantic relationship between two classifiers
– one serves as contract (the interface ‘class’) ; other, carries it
out that is ‘realizes’ the contract.
via its subsystem contents and its dependencies
<<interface>>
Interface <<subsystem>>
Subsystem Name
<<subsystem>>
Subsystem Name
Interface 8
Realization (Elided form)
Key is abstraction
Subsystem Guidelines and encapsulation
Goals
Loose coupling; as independent as possible <<subsystem>>
Insulation from change - minimized A
Replaceable elements in the model.
<<subsystem>>
Exception: can share some class definitions A
<<interface>>
ICourseCatalogSystem <<subsystem>>
getCourseOfferings() CourseCatalogSystem
13
subsystem responsibility
Modeling Convention:
Subsystem Interaction Diagrams - General
performResponsibility( )
Op1()
subsystem
responsibility Op2() Internal subsystem
interactions
Op3()
Op4()
16
Modeling Convention:
Subsystem Interaction Diagrams - General
Subsystem Client Subsystem Proxy Design Element 1 Design Element 2
performResponsibility( )
Op1()
Op4()
• A message should be drawn from the <<subsystem>> client to the <<subsystem proxy>>
• Note: interface does not appear on internal subsystem interaction diagram.
• Remainder of diagram should model how the <<subsystem proxy>> class delegates
responsibility for performing the invoked operation to the other subsystem elements.
1: // create schedule( )
2: // get course offerings( )
Student wishes to
create a new 3: getCourseOfferings(Semester)
schedule
Note: I have ‘cut’ a lot of detail • Is the primary input specification to the
out of this sequence diagram and task of creating local interactions
within the subsystem.
the next one so that it is ‘easy’ to
see the thrust of this slide…
18
Example: CourseCatalogSystem Subsystem In Context (2 of 2)
subsystem interface
: RegisterFor : Registration : ICourseCatalog : Schedule : Student
: Student CoursesForm Controller System
1: // create schedule( )
2: // get course offerings( )
3: getCourseOfferings(Semester)
• The ICourseCatalogSystem::getCourseOfferings()
documentation specifies: “Retrieve the course
offerings available for the specified semester.”
1. getCourseOfferings(Semester) Retrieve all available course• Internals of subsystems should yield interaction diagrams
offerings for the current that look like this.
Subsystem Proxy semester
• We see collaborations to implement the getCourseOfferings
(represents Subsystem) 1.1. read(string) operation of the ICourseCatalogSystem interface.
• Recall: legacy system stores course offerings in an RDBMS.
1.1.1. createStatement( )
• Here we show how the RDBMS persistency mechanism
sql statement is passed in
specifying the search criteria -- identified in Architectural Design is realized in the design.
1.1.2. executeQuery(String)
course offerings in the current
semester 1.1.2.1. // executeQuery( Create
) a list to hold all
retrieved course offerings
Repeat these operations for each 1.1.3. new( )
element returned from the
executeQuery() command.
RDBMS
The CourseOfferingList is loaded
1.1.4. new( ) Read
with the data retrieved from the 2. getString( )
database.
The getData and setData 3. setData( )
operations are called for each
attribute in the each retrieved 4. add(CourseOffering)
class instance.
23
If we have time, we’ll go through the Billing System. But
the ideas are the same…
Idea behind the Billing System is almost the same, but the
Billing System does not require a persistency mechanism.
24
Example: Billing System Subsystem In Context
subsystem interface
: : : : : Schedule : Student. :
: Registrar CloseRegistrationForm CloseRegistrationController ICourseCatalogSystem CourseOffering IBillingSystem
• Here, will demonstrate design of a subsystem that does
1. // close registration( ) not require a persistency mechanism.
1.1. // is registration open?( ) Retrieve a list of course • This is at portion of the Close Registration use-case
offerings for the current realization sequence diagram.
2. // close registration( ) semester The internals of the Billing System Subsystem
Close have not been designed yet. That is
2.1. getCourseOfferings(Semester) registration for the purpose of this activity, Subsystem Design
each course
Repeat twice this is If the maximum number of
offering
for simplicity; selected primary courses have
realistically, an 2.2. // close registration( )
not been committed, select
indefinite number of alternate course offerings).
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
25
Now, we are really after the next slide…
Example: Billing System Subsystem In Context
subsystem interface
: : : : : Schedule : Student. :
: Registrar CloseRegistrationForm CloseRegistrationController ICourseCatalogSystem CourseOffering IBillingSystem
• Here we put requirements on the subsystem, and
1. // close registration( ) the sequence diagram is the primary input spec to
1.1. // is registration open?( ) creating local interactions for the subsystem.
Retrieve a list of course
offerings for the current • We see the operations subsystem must support. Shows
semester the simple way some client (CloseRegistrationController
2. // close registration( )
Close here) deals with the task of submitting bill to
2.1. getCourseOfferings(Semester) registration for the legacy Billing System.
each course
Repeat twice this is If the maximum number of
offering
for simplicity; selected primary courses have
realistically, an 2.2. // close registration( )
not been committed, select
indefinite number of alternate course offerings).
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
26
More coming…
Explanation for next slides
But the billing information must be converted into a format that the
Billing System can understand.
1. submitBill(Student, double)
Retrieve the
information that must
1.1. create(Student, double) be included on the bill
1.2. submit(StudentBillingTransaction)
Logic here must convert the contract info 1.2.1. // open connection( )
into a format (StudentBillingTransaction)
that the Billingsystem can understand. 1.2.2. // process transaction( )
1. submitBill(Student, double)
Retrieve the
information that must
1.1. create(Student, double) be included on the bill
1.2. submit(StudentBillingTransaction)
29
Example: Local BillingSystem Subsystem Interaction
Subsystem Proxy
Billing System : : : Student. :
: Billing System
Client BillingSystem StudentBillingTransaction BillingSystemInterface
1. submitBill(Student, double)
Retrieve the • The BillingSystem proxy class instance
information that must creates a StudentBillingTransaction
1.1. create(Student, double) be included on the bill specific to the external Billing System.
• This transaction will be in a format that
1.1.1. // get contact info( ) the Billing System can process.
• The StudentBillingTransaction knows
how to create itself using information
1.2. submit(StudentBillingTransaction) from the given Student.
30