subsystems n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Subsystems PowerPoint Presentation
Download Presentation
Subsystems

Loading in 2 Seconds...

play fullscreen
1 / 34

Subsystems - PowerPoint PPT Presentation


  • 243 Views
  • Uploaded on

Subsystems. CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, 1990. (Chapter 7). 1. 1. Outline. Subsystems: what and why? Subsystem documentation Subsystems cards Collaboration graphs Guidelines for defining subsystems. 2. 2.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Subsystems' - miriam


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
subsystems

Subsystems

CS 4311

Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, 1990. (Chapter 7)

1

1

outline
Outline
  • Subsystems: what and why?
  • Subsystem documentation
    • Subsystems cards
    • Collaboration graphs
  • Guidelines for defining subsystems

2

2

steps for producing initial designs
Steps for Producing Initial Designs
  • Identify
    • Classes
    • Responsibilities
    • Collaborations
  • Analyze
    • Class hierarchies
    • Contracts
    • Collaboration graphs

3

3

motivation collaboration graph
Motivation: Collaboration Graph

Account

1

2

Balance

Deposit

Withdrawal

Transfer

Transaction

8

3

Display Device

4

Form

Input Device

6

Menu

5

BCR

User

Message

9

7

Output Device

ATM

User Interaction

4

problem
Problem
  • Collaboration graphs get very complicated.
    • Too many lines (i.e., interactions or communications)
  • Designs become incomprehensible.
  • How to simply the design, esp. patterns of communications?
solution
Solution
  • Need an abstraction tool to provide macro views
  • Collect classes together to form subsystems that
    • Behave like a class.
    • Support services to outside via contracts.
what are subsystems
What Are Subsystems?
  • Groups of classes that collaborate among themselves to support a set of contracts
  • Goal: To simplify patterns of communications
what are subsystems cont
What Are Subsystems? (Cont.)
  • Subsystems are not super classes.
  • Subsystems are not “just a bunch of classes.”
  • Subsystems should provide a good abstraction.
  • Subsystems should provide a clearly defined interface, called subsystem contracts.
subsystem contracts
Subsystem Contracts
  • All contracts supported
    • by things inside a subsystem
    • for things outside the subsystem.
  • Delegation of contracts

1

Printing

Subsystem

1

Print Server

2

Printer

Laser

Printer

InkJet

Printer

subsystem cards for documenting subsystems
Subsystem Cards for Documenting Subsystems
  • Write the subsystem name at the top
  • List all classes in the subsystem
  • Include ref. to the subsystem’s position in the collaborations graphs
  • Describe the purpose of the subsystem
  • List contracts for which it is a server
  • For each contract, identify the class or subsystem to which the contract is delegated
subsystem cards cont
Subsystem Cards (Cont.)

Subsystem: Drawing Subsystem

Classes: Control Point, Drawing, Drawing Element, …

Collaborations Graphs: see Figure 4-6

Description: Responsible for displaying and maintaining

the contents of the drawing…

Contracts

1. Display itself

Server: Drawing

2. Access and modify the contents of a drawing

Server: Drawing

3. Modify the attributes of a Drawing Element

Server: Control Point

how to identify subsystems
How to Identify Subsystems?
  • Bottom-up and top-down approaches
  • Bottom up
    • Start with classes and responsibilities
    • Identify collaborations
    • Partition the classes based on patterns of collaborations
    • This approach is useful when managing the complexity as a system grows.
subsystem identification
Subsystem Identification
  • Draw collaboration graph (use white board).
  • Look for strongly coupled classes.
  • Look for ways to simplify your description of the system.
  • Look for clean separations.
  • Look for good abstractions.
how to identify subsystems1
How to Identify Subsystems?
  • Top down
    • Look at high level functions of system
    • Look at data sources and uses
    • Look at supporting technologies
    • Partition to manage complexity and reduce coupling
    • This approach may be useful when managing the complexity imposed by initial specification.
guidelines for simplifying interactions
Guidelines for Simplifying Interactions
  • Minimize number of collaborations a class has with other classes or subsystems.
  • Minimize number of classes and subsystems to which a subsystem delegates.
  • Minimize number of contracts supported by a class or subsystem.
g 1 minimize number of collaborations
G-1: Minimize Number of Collaborations
  • Class should collaborate with as few other classes and subsystems as possible. (Why?)
  • Heuristic: Centralize communications
example
Example

File

File

3

1

Printing

Subsystem

1

Printing

Subsystem

1

1

Print

Server

Print

Server

2

2

Printer

Printer

3

3

Laser

Printer

Laser

Printer

Color

Printer

Color

Printer

g 2 minimize delegations of subsystem contracts
G-2: Minimize Delegations of Subsystem Contracts
  • Keep the number of classes inside the subsystem that support subsystem contracts to a minimum
  • Again, centralize communications into and out of the subsystem
g 3 minimize number of contracts
G-3: Minimize Number of Contracts
  • Too many contracts in one place indicate too much intelligence concentrated in one place: split the functionality between two or more classes.
  • Re-examine the collaboration patterns
example1

Warehouse

Accounting

Subsystem

Transaction

Log

Inventory

Item

Cash

Register

2

1

3

Example
example2
Example

Warehouse

Accounting

Subsystem

Transaction

Log

Inventory

Item

Cash

Register

2

1

3

example refined
Example Refined

Warehouse

Accounting

Subsystem

Transaction

Log

Inventory

Item

Cash

Register

2

1

3

1

2

3

Inventory

Subsystem

example refined further
Example Refined Further

Warehouse

Accounting

Subsystem

Transaction

Log

Inventory

Manager

Inventory

Item

Cash

Register

2

1

3

4

4

Inventory

Subsystem

if you have to redesign
If You Have to Redesign ...
  • Redraw the graphs
  • Re-examine the collaboration patterns
  • Walk through scenarios (all of them)
  • Verify that things are simpler, have improved cohesion and reduced coupling
atm example contracts
ATM Example: Contracts
  • Account: Access and modify balance
  • Account: commit result to database
  • Display: Display information
  • Form: Get numeric value from user
  • Input Device: accept user input
  • Menu: Get user selection
  • Output Device: output to the user
  • Transaction: execute financial transaction
  • User Message: display message and wait
collaboration graph
Collaboration Graph

Account

1

2

Balance

Deposit

Withdrawal

Transfer

Transaction

8

3

Display Device

4

Form

Input Device

6

Menu

5

BCR

User

Message

9

7

Output Device

ATM

User Interaction

26

refining
Refining

Account

1

2

Balance

Deposit

Withdrawal

Transfer

Transaction

8

3

Display Device

4

Form

Input Device

6

Menu

5

BCR

User

Message

9

7

Output Device

ATM

User Interaction

simplified graph 1
Simplified Graph 1

Financial

Subsystem

8

3

Display Device

4

Form

Input Device

6

Menu

5

BCR

User

Message

9

7

Output Device

User Interaction

ATM

refining1
Refining

Financial

Subsystem

8

3

Display Device

4

Form

Input Device

6

Menu

5

BCR

User

Message

9

7

Output Device

User Interaction

ATM

simplified graph 2
Simplified Graph 2

Financial

Subsystem

8

3

4

User

Interaction

Subsystem

6

I/O

Subsystem

5

9

7

ATM

even more simplified graph

3

5

6

4

7

9

Even More Simplified Graph

Financial

Subsystem

8

ATM

User Interface

Subsystem

even more simplified graph1

3

5

6

4

7

9

Even More Simplified Graph

Any critique?

Financial

Subsystem

8

ATM

User Interface

Subsystem

rework
Rework
  • Rework your design. If it isn’t changing, you’re not working.
  • Do not change just to change, but change based on recognition of better design.
  • Take pride in your work.
group work and assignment
Group Work and Assignment

Group work (see handout)

Subsystems for the project

Due: Mar. ?, 2014

Leader: Architect

Contents

Class diagram showing all classes and their relationships (inheritance and associations)

Contracts by refining your CRC cards

Subsystems by grouping classes and identifying subsystem contracts (subsystem cards)

Collaboration graphs

34