Professional Documents
Culture Documents
1
What is a subsystem?
• Problem: Collaboration graphs get very complicated. (Too many lines.)
• Solution: Collect classes together to form subsystems.
• Subsystem behaves like a class: supports services to outside via
contracts.
• Subsystems are not super classes.
• Subsystems are not “just a bunch of classes.”
• Subsystems should provide a good abstraction.
2
Subsystem graph
Name of 1 • All contracts supported by
subsystem things inside a subsystem for
1
things outside the subsystem.
Name of class • Use the subsystem to simplify
the design.
2 Name of
superclass
Name of Name of
subclass subclass
3
Identification of Subsystem
• 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.
4
Simplify:
1- Minimize number of collaborations a class has with other classes
• Class should collaborate with as few other classes as possible. (Why?)
• Heuristic: centralize communications
2- Minimize number of classes & subsystems to which a subsystem
delegates
• Keep the number of classes inside the subsystem that support subsystem
contracts to a minimum
• Again, centralize communications into and out of the subsystem
3- Minimize number of contracts supported by a class or subsystem
5
Example 1: Inventory Subsystem
Inventory Transaction
Accounting
Item Log
3 Subsystem
1 2
Cash Warehouse
Register
6
Example
Inventory Transaction
Item Log Accounting
3
2 Subsystem
1
Cash Warehouse
Register
7
Example
Inventory Simplify Inventory
Transaction Accounting
Item Subsystem
Log Subsystem
2 3 4
1
Manager
Inventory
4 Cash Register Warehouse
Subsystem
4
Warehouse
Cash Register
8
• 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
Display Dev 3 4
Form
Input Dev
6 Menu
5
BCR
User
9
Msg
7
Output Dev
ATM User Interaction
12