Sad ch7b
Sad ch7b
System Design:
Addressing Design Goals
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 1
System Design
8. Boundary
1. Design Goals Conditions
Definition Initialization
Trade-offs Termination
Failure
2. Subsystem Decomposition 7. Software
Layers vs Partitions Control
Coherence/Coupling
Monolithic
Event-Driven
3. Concurrency Conc. Processes
Identification of 4. Hardware/ 5. Data 6. Global Resource
Threads Software Mapping Management Handlung
Special Purpose Persistent Objects Access Control List
Buy vs Build File system vs Database vs Capabilities
Allocation of Resources Security
Connectivity
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2
Concurrency
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3
Thread of Control
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4
Assume: Initial
Example: Problem with threads balance = 200
withdraw(50)
getBalance()
setBalance(150)
setBalance(150)
Final
balance = 150 ??!
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5
Initial
Solution: Synchronization of Threads Single WithdrawCtrl
Instance balance = 200
:WithdrawCtrl :BankAccount
c1:Customer c2:Customer Synchronized method
withdraw(50)
getBalance()
withdraw(50)
200
computeNewBalance(200,50)
setBalance(150)
End
balance = 100
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6
Concurrency Questions
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7
Implementing Concurrency
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8
Implementing Concurrency (2)
• In both cases, - physical concurrency as well as logical
concurrency - we have to solve the scheduling of these
threads:
• Which thread runs when?
• Today’s operating systems provide a variety of scheduling
mechanisms:
• Round robin, time slicing, collaborating processes,
interrupt handling
• General question addresses starvation, deadlocks, fairness
-> Topic for researchers in operating systems
• Sometimes we have to solve the scheduling problem
ourselves
• Topic addressed by software control (system design
topic 7).
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9
System Design
8. Boundary
1. Design Goals Conditions
Definition Initialization
Trade-offs Termination
Failure
2. Subsystem Decomposition 7. Software
Layers vs Partitions Control
Coherence/Coupling
Monolithic
Event-Driven
3. Concurrency Conc. Processes
Identification of 4. Hardware/ 5. Data 6. Global Resource
Threads Software Mapping Management Handlung
Special Purpose Persistent Objects Access Control List
Buy vs Build Filesystem vs Database vs Capabilities
Allocation of Resources Security
Connectivity
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10
4. Hardware Software Mapping
• This system design activity addresses two questions:
• How shall we realize the subsystems: With hardware or
with software?
• How do we map the object model onto the chosen
hardware and/or software?
• Mapping the Objects:
• Processor, Memory, Input/Output
• Mapping the Associations:
• Network connections
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11
Mapping Objects onto Hardware
• Control Objects -> Processor
• Is the computation rate too demanding for a single
processor?
• Can we get a speedup by distributing objects across
several processors?
• How many processors are required to maintain a
steady state load?
• Entity Objects -> Memory
• Is there enough memory to buffer bursts of requests?
• Boundary Objects -> Input/Output Devices
• Do we need an extra piece of hardware to handle the
data generation rates?
• Can the desired response time be realized with the
available communication bandwidth between
subsystems?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12
Mapping the Associations:
Connectivity
• Describe the physical connectivity
• (“physical layer in the OSI Reference Model”)
• Describes which associations in the object model
are mapped to physical connections.
• Describe the logical connectivity (subsystem associations)
• Associations that do not directly map into physical
connections.
• In which layer should these associations be
implemented?
• Informal connectivity drawings often contain both types of
connectivity
• Practiced by many developers, sometimes confusing.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13
Example: Informal Connectivity
DistributedDatabaseArchitecture Tue, Oct 13, 1992 12:53 AM
Drawing
Application Application Application
Client Client Client
TCP/IP
Logical LAN
Connectivity
Communication
Agent for
Application Clients LAN Global
Data
Communication Server
Communication
Backbone Network Agent for Data
Agent for OODBMS
Server
Application Clients
Communication Global
Agent for Data Data
Server Server
LAN RDBMS
Ethernet Cat 5
Local Data Global Data
Physical
Server Server Connectivity
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14
Logical vs Physical Connectivity and
the relationship to Subsystem
Layering
Processor 1 Processor 2
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15
Hardware-Software Mapping
Difficulties
• Much of the difficulty of designing a system comes from
addressing externally-imposed hardware and software
constraints
• Certain tasks have to be at specific locations
• Example: Withdrawing money from an ATM
machine
• Some hardware components have to be used from a
specific manufacturer
• Example: To send DVB-T signals, the system has to
use components from a company that provides
DVB-T transmitters.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16
Hardware/Software Mappings in
UML
• A UML component is a building block of the system. It is
represented as a rectangle with a tabbed rectangle symbol
inside
• Components have different lifetimes:
• Some exist only at design time
• Classes, associations
• Others exist until compile time
• Source code, pointers
• Some exist at link or only at runtime
• Linkable libraries, executables, addresses
• The Hardware/Software Mapping addresses dependencies and
distribution issues of UML components during system design.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17
Two New UML Diagram Types
• Component Diagram:
• Illustrates dependencies between components at
design time, compilation time and runtime
• Deployment Diagram:
• Illustrates the distribution of components at run-time.
• Deployment diagrams use nodes and connections to
depict the physical resources in the system.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18
UML Component Diagram
• Used to model the top-level view of the system design in
terms of components and dependencies among the
components. Components can be
• source code, linkable libraries, executables
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19
UML Interfaces: Lollipops and
Sockets
• A UML interface describes a group of operations used or
created by UML components.
• There are two types of interfaces: provided and
required interfaces.
• A provided interface is modeled using the lollipop
notation
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20
Component Diagram Example
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21
Deployment Diagram
• Deployment diagrams are useful for showing a system
design after these system design decisions have been
made:
• Subsystem decomposition
• Concurrency :PC :Server
• Hardware/Software Mapping
• A deployment diagram is a graph of nodes and
connections (“communication associations”)
• Nodes are shown as 3-D boxes
• Connections between nodes are shown as solid lines
• Nodes may contain components
• Components can be connected by “lollipops” and
“grabbers”
• Components may contain objects (indicating that
the object is part of the component).
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22
Deployment Diagram Example
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 23
5. Data Management
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 24
Data Management Questions
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 25
Mapping Object Models
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26
6. Global Resource Handling
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 27
Defining Access Control
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 28
Access Matrix
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29
Access matrix example
Access right
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30
Global Resource Questions
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31
7. Decide on Software Control flow
Two major design choices:
1. Choose implicit control
2. Choose explicit control
• Centralized or decentralized
• Centralized control:
• Procedure-driven: Control resides within program code.
• Event-driven: Control resides within a dispatcher calling
functions via callbacks.
• Decentralized control
• Control resides in several independent objects.
• Examples: Message based system, RMI
• Possible speedup by mapping the objects on different
processors, increased communication overhead.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 32
Centralized vs. Decentralized
Designs
• Centralized Design
• One control object or subsystem ("spider") controls
everything
• Pro: Change in the control structure is very easy
• Con: The single control object is a possible
performance bottleneck
• Decentralized Design
• Not a single object is in control, control is distributed;
That means, there is more than one control object
• Con: The responsibility is spread out
• Pro: Fits nicely into object-oriented development
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 33
Centralized vs. Decentralized
Designs (2)
• Should you use a centralized or decentralized design?
• Take the sequence diagrams and control objects from the
analysis model
• Check the participation of the control objects in the
sequence diagrams
• If the sequence diagram looks like a fork =>
Centralized design
• If the sequence diagram looks like a stair =>
Decentralized design.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 34
8. Boundary Conditions
• Initialization
• The system is brought from a non-initialized state to
steady-state
• Termination
• Resources are cleaned up and other systems are
notified upon termination
• Failure
• Possible failures: Bugs, errors, external problems
• Good system design foresees fatal failures and provides
mechanisms to deal with them.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 35
Boundary Condition Questions
• Initialization
• What data need to be accessed at startup time?
• What services have to registered?
• What does the user interface do at start up time?
• Termination
• Are single subsystems allowed to terminate?
• Are subsystems notified if a single subsystem
terminates?
• How are updates communicated to the database?
• Failure
• How does the system behave when a node or
communication link fails?
• How does the system recover from failure?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 36
Modeling Boundary Conditions
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 37
Example: Boundary Use Case for
ARENA
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 38
ManageServer Boundary Use Case
<<include>>
StartServer
Server <<include>>
Administrator
ManageServer ShutdownServer
<<include>>
ConfigureServer
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 39
Summary
• System design activities:
• Concurrency identification
• Hardware/Software mapping
• Persistent data management
• Global resource handling
• Software control selection
• Boundary conditions
• Each of these activities may affect the subsystem
decomposition
• Two new UML Notations
• UML Component Diagram: Showing compile time and
runtime dependencies between subsystems
• UML Deployment Diagram: Drawing the runtime
configuration of the system.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 40
Object Design
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 41
Activities of object design (UML
activity diagram).
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 42