+ All Categories
Home > Documents > Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce...

Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce...

Date post: 15-Jan-2016
Category:
View: 216 times
Download: 0 times
Share this document with a friend
Popular Tags:
55
Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability Plan for future modifications
Transcript
Page 1: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Design: HOW to implement a system

Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability Plan for future modifications

Page 2: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Design Issues

Architecture

User Interface

Data Types

Operations

Data

Representations

Algorithms

Page 3: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Design

System design (high level design) Focus on architecture

Identification of subsystems

Object design (lower level design) Modules and their implementations

Focus on data representations and

algorithms

Page 4: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

System Design Choose high-level strategy for solving

problem and building solution Decide how to organize the system

into subsystems Identify concurrency / tasks Allocate subsystems to HW and SW

components

Page 5: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

System Design

Major conceptual and policy decisions Approach for management of data stores Access mechanism for global resources Software control mechanism

Handle boundary conditions Prioritize trade-offs

Page 6: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Design Principles Consider alternative approaches

Do pro and con analysis Delay decisions until superior choice is

clear Isolate decisions so alternative

implementations can be evaluated later Avoid unnecessary embellishments But don’t oversimplify

Page 7: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Design Principles (cont.) Make design traceable to

requirements Use uniform documentation style Reuse existing designs when

possible Keep design simple unless

performance, maintainability, etc. DEMAND otherwise

Page 8: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Design Principles (cont.)

Define interfaces between modules carefully

Consider how to handle the unexpected Don’t code!! Document decisions Review, review, review . . .

Page 9: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

System Architecture

Overall organization of system into subsystems

Decide basic interaction patterns Numerous architectural styles

for different applications Architecture provides context for

detailed design decisions

Page 10: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Subsystem Identification

Divide system into a manageable

number of components

Each major component is a

subsystem

Subsystem groups components

with common properties/function

Page 11: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Subsystem

Collection of Classes

Associations

Operations

Events

Constraints

Interrelated Good cohesion

Well-defined, small interface with other subsystems Low coupling

Identified by the service it provides

Page 12: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Subsystem Discussion

Provide services for other sub-

systems Group of related functions

Share a common purpose Divide system into components (>20)

Subsystems are decomposed . . . Module is the lowest level of subsystem

Page 13: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Subsystem Relationships

Client-Server relationship Client subsystems actively drive the system

by requesting services provided by a server

subsystem

Peer-to-peer relationship Subsystems interact and communicate to

accomplish a common goal

Page 14: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Client-Server Relationship

Server supplies services for clients Need not know identity of clients

Need not know interface of clients

Client calls server Client knows interface of server

Server performs some service and

returns a result

Page 15: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Peer-to-Peer Relationship

Subsystems call one another The results of/responses to calls may

not be immediately visible Subsystems must know the interfaces of

other subsystems More likely to have communication

dependencies

Page 16: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Strategies for Decompositions

Layers: Horizontal decomposition Open

Closed

Partitions: Vertical decomposition

System topology: General decompositions

Page 17: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Layered Subsystems

Set of “virtual” worlds Each layer is defined in terms of the layer(s)

below it Knowledge is one way: Layer knows about

layer(s) below it

Objects within layer can be independent Lower layer (server) supplies services for

objects (clients) in upper layer(s)

Page 18: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Example: Layered architecture

Interactive Graphics Application

Windows Operations

Screen Operations

Pixel Operations

Device I/O Operations

Page 19: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Closed Architectures

Each layer is built only in terms of the immediate lower layer

Reduces dependencies between layers

Facilitates change

Page 20: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Open Architectures

Layer can use any lower layerReduces the need to redefine

operations at each levelMore efficient /compact codeSystem is less robust/harder to

change

Page 21: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Properties of Layered Architectures

Top and bottom layers specified by the problem statement Top layer is the desired system Bottom layer is defined by available

resources (e.g. HW, OS, libraries)

Easier to port to other HW/SW platforms

Page 22: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Partitioned Architectures

Divide system into weakly-coupled

subsystems

Each provides specific services

Vertical decomposition of problem

Page 23: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Ex: Partitioned ArchitectureOperating System

File

System

Process

Control

Virtual

Memory

Manage-

ment

Device

Control

Page 24: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Typical Application Architecture

Application package

Window graphics

Screen graphics

Pixel graphics

Operating system

Computer hardware

User dialogue control

Simulation package

Page 25: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

System Topology

Describe information flow

Can use DFD to model flow

Some common topologies

Pipeline (batch)

Star topology

Page 26: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Ex: Pipeline Topology

Lexical analyzer

Semantic analyzer

Code generator

Code optimizer

source program token stream

abstract syntax tree

code sequence

object code

Compiler:

Page 27: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Ex: Star ToplogyMonitoring system:

SafeHome software

Sensors

Control panel

Alarm

Telephone line

sensor status

display information

commands, data

On/Off signals, alarm type

number tones

Page 28: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Modularity Organize modules according to

resources/objects/data types Provide cleanly defined interfaces

operations, methods, procedures, ...

Hide implementation details Simplify program understanding Simplify program maintainance

Page 29: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Abstraction Control abstraction

structured control statements exception handling concurrency constructs

Procedural abstraction procedures and functions

Data abstraction user defined types

Page 30: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Abstraction (cont.)

Abstract data types

encapsulation of data

Abstract objects

subtyping

generalization/inheritance

Page 31: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Cohesion

Contents of a module should be

cohesive

Improves maintainability Easier to understand

Reduces complexity of design

Supports reuse

Page 32: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

(Weak) Types of cohesiveness

Coincidentally cohesive contiguous lines of code not exceeding a

maximum size

Logically cohesive all output routines

Temporally cohesive all initialization routines

Page 33: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

(Better) Types of cohesiveness

Procedurally cohesive routines called in sequence

Communicationally cohesive work on same chunk of data

Functionally cohesive work on same data abstraction at a

consistent level of abstraction

Page 34: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Example: Poor Cohesion

package Output is

procedure DisplayDice( . . .);

procedure DisplayBoard( . . .);Dice

Board

I/O device

Output

Page 35: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Example: Good Cohesion

package Dice is

procedure Display ( . . .);

procedure Roll( . . .);

I/O device

Dice

Board

Page 36: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Coupling

Connections between modules

Bad coupling

Global variables

Flag parameters

Direct manipulation of data structures by

multiple classes

Page 37: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Coupling (cont.)

Good coupling Procedure calls Short argument lists Objects as parameters

Good coupling improves maintain-ability Easier to localize errors, modify

implementations of an objects, ...

Page 38: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Information Hiding Hide decisions likely to change

Data representations, algorithmic details, system dependencies

Black box Input is known Output is predictable Mechanism is unknown

Improves maintainability

Page 39: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Information Hiding

Page 40: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Abstract data types Modules (Classes, packages)

Encapsulate data structures and their operations

Good cohesion implement a single abstraction

Good coupling pass abstract objects as parameters

Black boxes hide data representations and algorithms

Page 41: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Identifying Concurrency

Inherent concurrency May involve synchronization Multiple objects receive events at the same

time with out interacting Example:

User may issue commands through control panel at same time that the sensor is sending status information to the SafeHome system

Page 42: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Determining Concurrent Tasks

Thread of control Path through state diagram with only one active

object at any time

Threads of control are implemented as tasks Interdependent objects Examine state diagram to identify objects that can

be implemented in a task

Page 43: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Management of Data Stores

Data stores permit separations

between subsystems Internal or external

Common types of data stores Files

Databases

Page 44: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

File Data Stores When to use a database

Require access to voluminous data at fine levels of detail by multiple users

Access can be efficiently managed with DBMS commands

Application must port across many HW and OS platforms

Store is to be accessed by multiple application programs

Page 45: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Database Data Stores

Advantages Infrastructure support Common interface Standard access language (SQL)

Disadvantages Performance penalty Awkward programming language

Page 46: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

File Data Stores

When to use file data stores Data does not fit structure of DBMS Voluminous data that is low in information

density

“Raw” data

Volatile data only retained for a short time

Page 47: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Global Resources

Identify global resources and determine access patterns

Examples physical units (processors, tape drives) available space (disk, screen, buttons) logical names (object IDs, filenames) access to shared data (database, file)

Page 48: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Software Control Mechanism

How SW will control interactions between objects Internal control

flow of control within a process

External control flow of externally-visible events among

objects

Uniform control style for objects

Page 49: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Internal Control

Under control of programmer Structured for convenience

efficiency, clarity, reliability, . . .

Common types of control flow Procedure calls Quasi-concurrent inter-task calls Concurrent inter-task calls

Page 50: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

External Control

Procedure-driven systems

Event-driven systems

Concurrent systems

Page 51: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Procedure-driven systems

Control resides within the program code procedure issues request, waits for reply,

then continues execution

System state defined by program counter, stack of procedure calls,

local variables

Page 52: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Event-Driven Systems Control resides within a central

dispatcher calls to the dispatcher send output or

enable input dispatcher invokes procedures when

events occur (“call back”) state maintained

using global variables, or by dispatcher for procedures

Page 53: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Concurrent Systems

Control resides concurrently in independent tasks

Events are implemented as messages between tasks

OS schedules tasks for execution

Page 54: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Boundary Conditions Initialization

Constants, parameters, global variables, tasks, guardians, class hierarchy

Termination Release external resources, notify other

tasks

Failure Clean up and log failure info

Page 55: Topic Design: HOW to implement a system Goals: Satisfy the requirements Satisfy the customer Reduce development costs Provide reliability Support maintainability.

Topic

Identify Trade-off Priorities Establish priorities for choosing

between incompatible goals Implement minimal functionality

initially and embellish as appropriate Isolate decision points for later

evaluation Trade efficiency for simplicity,

reliability, . . .


Recommended