Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 ·...

61
Achieving Qualities

Transcript of Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 ·...

Page 1: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Achieving Qualities

Page 2: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

The Whole Story

Tactics Selection

Quality

Requirements

Business

Requirements

Tactics Implementation:

Design Patterns &

Architectural Patterns

Page 3: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Tactics

• A tactic is a design decision that influences a quality attribute.

• e.g. using redundancy to increase availability

• Tactics can be refined to other tactics to become more concrete; e.g. redundancy: redundancy of data + process

Page 4: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Availability Tactics

Page 5: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Goal of modifiability tactics

Page 6: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Modifiability Tactics

Page 7: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

General Definition & Performance

Definition of tactics

Performance tactics

Page 8: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Performance Tactics

• The goal is to generate a response to an arriving

event within some time constraint.

– Event: single or stream; message, expiration of a time

interval, detection of a state change, etc.

• Performance tactics control the time within which

a response is generated.

• Latency is the time between the arrival of an

event & the generation of a response.

Page 9: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Resource Demand

• Event streams are the source of resource

demand.

• Two characteristics:

– time between events in a stream

– how much of a resource is consumed by each

request

• Tactic: reduce resources required to process an

event stream

– increase computational efficiency

– reduce computational overhead

Page 10: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Resource Demand, con’t

• Tactic: reduce the number of events processed

– manage event rate

– control frequency of sampling

• Tactic: control use of resources

– bound execution times

– bound queue lengths

Page 11: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Resource Management

• If the demand for resources isn’t controllable,

they might be managed by these tactics:

– introduce concurrency

– maintain multiple copies of either data or computations

– increase available resources

Page 12: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Resource Arbitration

• When there is contention for a resource, the

resource must be scheduled:

– processors, buffers, networks are all scheduled

• A scheduling policy has two parts:

– a priority assignment

– dispatching

Page 13: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Common Scheduling Policies

• First-in/First-out all requests are equal

• Fixed-priority scheduling are prioritized based

on:

– semantic importance - statically assigned based on domain characteristics (mainframes)

– deadline monotonic - statically assigned with higher priority to streams with shorter deadlines (real-time)

– rate monotonic - statically assigned with higher priority to streams with shorter periods (real-time)

Page 14: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Scheduling Policies, con’t

• Dynamic priority scheduling

– round robin

– earliest deadline first

• Static scheduling - cyclic executive schedule

with pre-emption points & sequence determined

offline

Page 15: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Summary of performance tactics

Page 16: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Summary of tactics for security

Page 17: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Summary of testability tactics

Page 18: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Architectural Styles -1

• An architectural style is a description of component types and a pattern of their runtime control and/or data transfer.

• A style

– is found repeatedly in practice

– is a package of design decisions

– has known properties that permit reuse

– describes a class of architectures

Page 19: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Architectural Styles -2

• A style is determined (described) by

– a set of component types (e.g., data

repository, process, object)

– a topological layout of these components

– a set of semantic constraints (e.g., a data

repository is not allowed to change stored

values)

– a set of interaction mechanisms (e.g.,

subroutine call, event, pipe)

Page 20: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Architectural Styles -3

• David Garlan and Mary Shaw have compiled a catalog of architectural styles [Shaw 95].

• There is no complete list.

• There is no unique, non-overlapping list.

• Styles overlap.

Page 21: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

A small catalog of architectural patterns, organized

by is-a relations

Page 22: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Famous Pattern (Style) categories

Data-centered– Repository– Blackboard (publisher-subscriber)

• Structural solution to integrability of data

• Scalability

• Modifiability

Client

Client Client

Client

Shared Data

Page 23: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Dataflow– Bach sequential

– Pipes and filters

• Reusability

• Modifiability

• Not interactive

• Poor performance

Famous Pattern (Style) categories

Page 24: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Virtual Machine

– Interpreter (e.g. Adaptive Object Model)

• Portability

• Simulation

• Adaptability

• Low performance

Famous Pattern (Style) categories

Page 25: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Call and Return– Main program and sub-routine

• Modifiability

– Remote procedure call• Performance tuning

– Object-oriented or abstract data type• Modifiability

• Reuse

– Layered• Modifiability

• Portability

Famous Pattern (Style) categories

Page 26: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Independent components

– Communicating Processes

• Scalability

– Event Systems

• Modifiability

Famous Pattern (Style) categories

Page 27: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Data-Centered Style -1

•Goals

–integrability

–scalability (new clients/data easily added)

•Examples

–passive data store: repository style

–active data store: blackboard style

Page 28: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Data-Centered Style -2

Client

Shared data

Client Client

Client Client Client

Page 29: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Virtual Machine Style -1

•Goal: simulate non-native functionality for portability or prototyping

•Examples

–interpreters

–rule-based systems

–command language processors

Page 30: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Virtual Machine Style -2

Data UpdatesState data

Programinstructions

outputs Selected instruction

Selected data

Interpretationengine

Internalstate

Data(program state)

Program beinginterpreted

inputs

Page 31: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Call/Return Architectures

• Dominant design style for 30 years

• Goals: vary according to sub-styles

• Sub-styles

– main program/subroutine

– object-oriented

– layered hierarchies

Page 32: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Main Program/Subroutine Style

• Early goals: reuse, independent development

• Example: hierarchical call/return style

Main

Sub 1 Sub 2 Sub 3

Page 33: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Object-Oriented/Abstract Data Style

ObjectObject

Object

ObjectObject

•Goals

–more natural modeling of real world

–reuse by increments

•Example: object-oriented style

Page 34: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Layered Hierarchies

Goals: portability, reuse

Example: ISO Open Systems Interconnection reference model

User interface

Useful system

Basic utility

Core

Page 35: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Heterogeneous Styles

Possible types of Heterogeneity

• Locationally Heterogeneous

• Hierarchically Heterogeneous

• Simultaneously Heterogeneous

Page 36: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Heterogeneous Systems

• Few systems are constructed purely from a single style. Most are heterogeneous mixtures of styles.

• There are three types of heterogeneous systems.

– locational

– simultaneous

– hierarchical

Page 37: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Locational Heterogeneity

• Different styles in different parts of the system

• Example: A-7E used a cooperating process style in function drivers and call/return style elsewhere.

Function

driver 1

Function

driver 2

Data banker

Shared

services

Device

interface

Data banker

Shared

services

Device

interface

Data banker

Shared

services

Device

interface

Function

driver n

Page 38: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Simultaneous Heterogeneity• Different styles due to style overlap

• Example: A-7E simultaneously used layered,

• cooperating process, and object-based styles.

Function driver 2

Shared services

Softwareutilities

Function driver 1 Function driver n

Device interfaces

Extended computer

Application data types

Filterbeh.

Databanker

Phys.models

Page 39: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Hierarchical Heterogeneity

A component of one style may itself be realized bya different style.

High-level style: event system

Component style: layered

Page 40: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Rules of Thumb for Choosing Styles

• The goal of style catalogs is to develop a design handbook: “If your problem looks like x, use

• style y.”

• The practice is not that advanced yet. The best that we can do is offer rules of thumb.

Page 41: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Data-Flow Style

• Use if

– it makes sense to view your system as one that

produces a well-defined, easily-identified

output that is the direct result of sequentially

transforming a well-defined, easily-identified

input in a time-independent fashion

– integrability (in this case, resulting from

relatively simple interfaces between

components) is important

Page 42: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Data-Flow Substyles• Dataflow network: input and output occur

as recurring series, with direct correlation between corresponding members of each series

• Pipeline, pipe and filter: the computation involves transformations on continuous streams of data

• Closed loop control: your system involves controlling continuing action, is embedded in a physical system, and is subject to unpredictable external perturbation so that preset algorithms go awry

Page 43: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Call-and-Return Style

• Use if the order of computation is fixed, and components can make no useful progress while awaiting the results of requests to other components

Page 44: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Call-and-Return Substyles -1

• Object-oriented: overall modifiability and integrability (via careful attention to interfaces) are driving quality requirements

• Abstract data types: many system data types whose representation is likely to change

• Objects: many like modules, commonalties could be exploited through inheritance

Page 45: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Call-and-Return Substyles -2

• Layered

– if the tasks in your system can be divided

between those specific to the application and

those generic to many applications but specific

to the underlying computing platform

– if portability across computing platforms is

important

– if you can use an already-developed computing

infrastructure layer (operating system, network

management package, etc.)

Page 46: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Independent Component Style• Use if

– your system runs on a multi-processor platform

(or may do so in the future)

– your system can be structured as a set of

loosely coupled components (meaning that one

component can continue to make progress

somewhat independently of the state of other

components)

– performance tuning (by re-allocating work

among processes) is important

– performance tuning (by re-allocating processes

to processors) is important

Page 47: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Independent Component

Substyles -1• Communicating processes: message-

passing is sufficient as an interaction mechanism

• Lightweight processes: access to shared data is critical to meet performance goals

• Distributed objects: the reasons for the object-oriented style and the interacting process style all apply

Page 48: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Independent Component

Substyles -2• Broadcast: all of the components need

to be synchronized from time to time, and/or availability is an important requirement

• Event systems: you want to decouple the consumers of events from their signalers, or you want scalability in the form of adding processes that are triggered by events already detected/signaled in the system

Page 49: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Data-Centered Style

• Use if central issue is the storage, representation, management, and retrieval of a large amount of related long-lived data

• Sub-styles– transactional database/repository: order of

component execution is determined by a stream of incoming requests to access/update the data, and the data is highly structured

– blackboard: you want scalability in the form of adding consumers of data without changing the producers; or you want modifiability in the form of changing who produces and consumes which data

Page 50: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Virtual Machine Style

• Use if you have designed a computation, but have no fixed machine to run it on

Page 51: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Example: ATM Software

Develop 3 different architectures for ATM software and compare them regarding fulfillment of quality attributes.

ATM = Automatic Teller Machine

User operations:

– Insert card and enter PIN

– Withdraw money

– Check Balance

Page 52: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Shared-Memory Style

Page 53: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Abstract Data Type Style

Page 54: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Layered Style

Page 55: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Analysis and Comparison

331Change account record format

15139Sum

321Buildability and Integrability

222Availability and Reliability

321Portability

321New service: close account and

withdraw the remained balance

123Performance

LayeredADTShared-

Mem

Page 56: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Rough Comparison of KWIC

Architectures

Change in

algorithm

Change in data

representation

Change infunction

Performance

Reuse

Shared Abstract Implicit Pipe and

data data type invocation filter

- - + +

- + - -

- - + +

+ + - -

- + - +

Page 57: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Lecture Summary

• Architectural styles can be described by the

– nature of their components and connectors

– topography

– kind of qualities and reasoning they support

• Architectural styles have important influences or quality attributes.

– The style(s) used for a system depends on

which qualities are most desired.

– Styles provide a concise way of designing and

describing a system.

Page 58: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Summary of runtime usability

tactics

Page 59: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Patterns

• A pattern is a common abstract solution to a

common abstract problem that

– Can be tailored to a given situation

– Has predefined characteristics

• Abstraction level of patterns

– Business

– Analysis

– Architecture

– Design

– Implementation (Idioms)

– Test Patterns (or guideline to testing patterns)

Page 60: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Relationship of Tactics to Patterns • An architect usually chooses a pattern or a

collection of patterns designed to realize one or more tactics.

• However, each pattern implements multiple tactics, whether desired or not.

• Each of these is often concerned with differentquality attributes, & any implementation of the pattern makes choices about tactics.

• So, the analysis process involves understanding all tactics embedded in an implementation.

• The design process involves making a judicious choice of what combination of tactics will achieve the system’s desired goals.

Page 61: Achieving Qualities - Sharifce.sharif.edu/courses/85-86/2/ce924/resources/root... · 2015-04-06 · Performance Tactics • The goal is to generate a response to an arriving event

Patterns & Styles

• Key features & rules for combining them to preserve architectural integrity:

– a set of element types

– a topological layout indicating their

relationships

– a set of semantic constraints

– a set of interaction mechanisms that

determine coordination