introduction to software engineering lecture 6

30
Introduction to Software Engineering Lecture 6 André van der Hoek

Upload: geneva

Post on 25-Feb-2016

39 views

Category:

Documents


2 download

DESCRIPTION

Introduction to Software Engineering Lecture 6. André van der Hoek. Today’s Lecture. Architecture design. Magic View. Requirements. Code. Professional View. Requirements. Code. Implementation phase. Testing phase. Test. Verify. ICS 52 Life Cycle. Requirements phase. Verify. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction to Software Engineering Lecture 6

Introduction to Software Engineering

Lecture 6

André van der Hoek

Page 2: Introduction to Software Engineering Lecture 6

Today’s Lecture Architecture design

Page 3: Introduction to Software Engineering Lecture 6

Magic View

Requirements

Code

Page 4: Introduction to Software Engineering Lecture 6

Professional View

Requirements

Code

Page 5: Introduction to Software Engineering Lecture 6

ICS 52 Life CycleRequirements

phaseVerify

DesignphaseVerify

ImplementationphaseTest

TestingphaseVerify

Page 6: Introduction to Software Engineering Lecture 6

Design Architectural design

High-level partitioning of a software system into separate modules (components)

Focus on the interactions among parts (connections)

Focus on structural properties (architecture) “How does it all fit together?”

Module design Detailed design of a component Focus on the internals of a component Focus on computational properties

“How does it work?”

Page 7: Introduction to Software Engineering Lecture 6

Spotify Example

Architecturaldesign

Moduledesign

Provided InterfaceAudio Encoder

Required Interface

Provided InterfaceSelector

Required Interface

Provided InterfaceAudio PlayerRequired Interface

Com

pres

sor

Provided Interface

Enco

der

Read

er

Required Interface

Page 8: Introduction to Software Engineering Lecture 6

Design Interaction

Architectural design(this lecture)

Module design(next lecture)

Page 9: Introduction to Software Engineering Lecture 6

Architectural DesignElements

Floors Walls Rooms

Types Office building Villa Aircraft hanger

Styles Colonial Victorian Southwestern

Rules and regulations Electrical Structural

Elements Components Interfaces Connections

Types Office automation Game Space shuttle control

Styles Pipe and filter Layered Implicit invocation

Rules and regulations Use of interfaces Methods of change

Build

ings

Software

Page 10: Introduction to Software Engineering Lecture 6

Software Architecture: Essentials Components

What are the main parts? What aspects of the requirements do they

correspond to? Where did they come from? Examples: filters, databases, GUIs, interpreters

Connections How do components communicate? Examples: procedure calls, messages, pipes, event

broadcast Topology

How are the components and connections organized topologically?

Constraints (including constraints on change)

Page 11: Introduction to Software Engineering Lecture 6

Comparison to Module Design

Architecture Modules• interactions among parts •

implementations of parts• structural properties • computational

properties• system-level performance • algorithmic

performance• outside module boundary • inside module

boundary

Page 12: Introduction to Software Engineering Lecture 6

Where do Architectures and Components Come From? Architectures: typically driven by kind of

application Often possible to solve one problem many

different ways Components: many design strategies

ICS 52 component strategy: Component design by information hiding Designing systems for ease of extension and

contraction An OO design approach

Rationale: design systems that have a long, useful lifetime

Page 13: Introduction to Software Engineering Lecture 6

We Can Do Anything…

Provided InterfaceBig Component

Required Interface

Provided InterfaceTiny Component

Required InterfaceProvided Interface

B ComponentRequired Interface

Provided InterfaceMr. Component

Required Interface

Provided InterfaceA Component

Required Interface

Provided InterfaceYet Component

Required Interface

Provided InterfaceSome Component

Required Interface

Provided InterfaceOne Component

Required Interface

Provided InterfaceMrs. Component

Required Interface

Page 14: Introduction to Software Engineering Lecture 6

…But Style Has Proven to Help Architectural styles restrict the way in

which components can be connected Prescribe patterns of interaction Promote fundamental principles

Rigor, separation of concerns, anticipation of change, generality, incrementality

Low coupling High cohesion

Architectural styles are based on success stories Almost all compilers are build as “pipe-and-

filter” Almost all network protocols are build as

“layers”

Page 15: Introduction to Software Engineering Lecture 6

Style 1: Hierarchy

Connections are function or method calls

Provided InterfaceMain component

Required Interface

Provided InterfaceSubcomponent

Required Interface

Provided InterfaceSubcomponent

Required Interface

Provided InterfaceSubcomponent

Required Interface

Provided InterfaceSubcomponent

Required Interface

Provided InterfaceSubcomponent

Required Interface

Provided InterfaceSubcomponent

Required Interface

Provided InterfaceSubcomponent

Required Interface

Provided InterfaceSubcomponent

Required Interface

Page 16: Introduction to Software Engineering Lecture 6

Style 2: Client-Server

Connections are remote procedure calls or remote method invocations

Provided InterfaceClient

Required Interface

Provided InterfaceClient

Required Interface

Provided InterfaceClient

Required Interface

Provided InterfaceServer

Required Interface

Page 17: Introduction to Software Engineering Lecture 6

Style 3: Blackboard

Provided InterfaceBlackboard

Connections are encapsulated global variables

Provided InterfaceOne “Part”

Required Interface

Provided InterfaceMy “Bit”

Required Interface

Provided Interface Her “Piece”Required Interface

Provided InterfaceA “Part”

Required Interface

Provided Interface Another “Piece”

Required Interface

Provided InterfaceHis “Bit”

Required Interface

Page 18: Introduction to Software Engineering Lecture 6

Style 4: Peer-to-Peer

Connections are remote procedure calls or remote method invocations

Provided InterfacePeer

Required Interface

Provided InterfacePeer

Required Interface

Provided InterfacePeer

Required Interface

Page 19: Introduction to Software Engineering Lecture 6

Style 5: Pipe-and-Filter

Connections are pipes (also called data flows)

Prov

ided

Inte

rface

Filte

rRe

quire

d In

terfa

ce

Prov

ided

Inte

rface

Filte

rRe

quire

d In

terfa

ce

Prov

ided

Inte

rface

Filte

rRe

quire

d In

terfa

ce

Prov

ided

Inte

rface

Filte

rRe

quire

d In

terfa

ce

Page 20: Introduction to Software Engineering Lecture 6

Style 6: Implicit Invocation

Connections are events on the software bus

Provided InterfaceComponentRequired Interface

Provided InterfaceComponentRequired Interface

Provided InterfaceComponentRequired Interface

Provided InterfaceComponentRequired Interface

Provided InterfaceBus

Required Interface

Page 21: Introduction to Software Engineering Lecture 6

Style 7: Layers (Take 1)

Connections are function or method calls + “something in between”

Provided InterfaceLayer 4

Required Interface

Provided InterfaceLayer 3

Required Interface

Provided InterfaceLayer 2

Required Interface

Provided InterfaceLayer 1

Required Interface

Provided InterfaceLayer 4

Required Interface

Provided InterfaceLayer 3

Required Interface

Provided InterfaceLayer 2

Required Interface

Provided InterfaceLayer 1

Required Interface

Page 22: Introduction to Software Engineering Lecture 6

Style 7: Layers (Take 2)

Connections are function or method calls

extended

basic

corecore

Page 23: Introduction to Software Engineering Lecture 6

Many Other (Variants of) Styles Interpreters Batch sequential Data abstraction/OO systems Model View Controller (MVC) …

Page 24: Introduction to Software Engineering Lecture 6

Different Styles, Different Situations Layers

Seven network layers in OSI reference model

Blackboard Databases Inventory/stock management systems

Client-server Web browser/Web server

Peer-to-peer Distributed databases Communication satellites

Page 25: Introduction to Software Engineering Lecture 6

Choosing the Right Style Ask questions on whether a certain style

makes sense The Internet as a blackboard

Does that scale? Stock exchange as a layers

How to deal with the continuous change? Math as hierarchy

How to properly call different modules for different functions?

Draw a picture of the major entities Look for the natural paradigm Look for what “feels right”

Page 26: Introduction to Software Engineering Lecture 6

Mixing Styles Is Often Necessary

Blackboard + Client-Server

Provided InterfaceBlackboard

Provided InterfaceOne “Part”

Required Interface

Provided InterfaceMy “Bit”

Required Interface

Provided Interface Her “Piece”Required Interface

Provided InterfaceA “Part”

Required Interface

Provided Interface Another “Piece”

Required Interface

Provided InterfaceHis “Bit”

Required Interface

Page 27: Introduction to Software Engineering Lecture 6

Provided InterfaceBlackboard

Provided InterfaceOne “Part”

Required Interface

Provided InterfaceMy “Bit”

Required Interface

Provided Interface Her “Piece”Required Interface

Provided InterfaceA “Part”

Required Interface

Provided Interface Another “Piece”

Required Interface

Provided InterfaceHis “Bit”

Required Interface

Original Blackboard

Page 28: Introduction to Software Engineering Lecture 6

Mixing Styles is often Necessary

Blackboard + Implicit Invocation

Provided InterfaceBlackboard

Provided InterfaceOne “Part”

Required Interface

Provided InterfaceA “Piece”

Required Interface

Provided InterfaceSome “Bit”Required Interface

Provided InterfaceBus

Required Interface

Page 29: Introduction to Software Engineering Lecture 6

Mixing Styles Is Often Necessary

Pipe-and-Filter + Client-Server + Hierarchy

Pipe FCallsProvided Interface

Audio EncoderRequired Interface

Provided InterfaceTuner

Required Interface

Provided InterfaceAudio PlayerRequired Interface

Page 30: Introduction to Software Engineering Lecture 6

Your Tasks1. Read and study slides of this lecture

2. Memorize the architectural styles

3. Read and study Chapter 11 of van Vliet