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

Introduction to Software Engineering Lecture 6 André van der Hoek

  • View
    222

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Introduction to Software Engineering Lecture 6 André van der Hoek

Introduction to Software Engineering

Lecture 6

André van der Hoek

Page 2: Introduction to Software Engineering Lecture 6 André van der Hoek

Today’s Lecture

Architecture design

Page 3: Introduction to Software Engineering Lecture 6 André van der Hoek

Magic View

Requirements

Code

Page 4: Introduction to Software Engineering Lecture 6 André van der Hoek

Professional View

Requirements

Code

Page 5: Introduction to Software Engineering Lecture 6 André van der Hoek

ICS 52 Life CycleRequirements

phaseVerify

DesignphaseVerify

ImplementationphaseTest

TestingphaseVerify

Page 6: Introduction to Software Engineering Lecture 6 André van der Hoek

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 André van der Hoek

Spotify Example

Architecturaldesign

Moduledesign

Provided Interface

Audio EncoderRequired Interface

Provided Interface

SelectorRequired Interface

Provided Interface

Audio PlayerRequired Interface

Com

pre

ssor

Provided Interface

Enco

der

Reader

Required Interface

Page 8: Introduction to Software Engineering Lecture 6 André van der Hoek

Design Interaction

Architectural design(this lecture)

Module design(next lecture)

Page 9: Introduction to Software Engineering Lecture 6 André van der Hoek

Architectural Design

Elements 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

Buildings

Software

Page 10: Introduction to Software Engineering Lecture 6 André van der Hoek

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 André van der Hoek

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 André van der Hoek

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 André van der Hoek

We Can Do Anything…

Provided Interface

Big ComponentRequired Interface

Provided Interface

Tiny ComponentRequired Interface

Provided Interface

B ComponentRequired Interface

Provided Interface

Mr. ComponentRequired Interface

Provided Interface

A ComponentRequired Interface

Provided Interface

Yet ComponentRequired Interface

Provided Interface

Some ComponentRequired Interface

Provided Interface

One ComponentRequired Interface

Provided Interface

Mrs. ComponentRequired Interface

Page 14: Introduction to Software Engineering Lecture 6 André van der Hoek

…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 André van der Hoek

Style 1: Hierarchy

Connections are function or method calls

Provided Interface

Main componentRequired Interface

Provided Interface

SubcomponentRequired Interface

Provided Interface

SubcomponentRequired Interface

Provided Interface

SubcomponentRequired Interface

Provided Interface

SubcomponentRequired Interface

Provided Interface

SubcomponentRequired Interface

Provided Interface

SubcomponentRequired Interface

Provided Interface

SubcomponentRequired Interface

Provided Interface

SubcomponentRequired Interface

Page 16: Introduction to Software Engineering Lecture 6 André van der Hoek

Style 2: Client-Server

Connections are remote procedure calls or remote method invocations

Provided Interface

ClientRequired Interface

Provided Interface

ClientRequired Interface

Provided Interface

ClientRequired Interface

Provided Interface

ServerRequired Interface

Page 17: Introduction to Software Engineering Lecture 6 André van der Hoek

Style 3: Blackboard

Provided Interface

Blackboard

Connections are encapsulated global variables

Provided Interface

One “Part”Required Interface

Provided Interface

My “Bit”Required Interface

Provided Interface

Her “Piece”Required Interface

Provided Interface

A “Part”Required Interface

Provided Interface

Another “Piece”Required Interface

Provided Interface

His “Bit”Required Interface

Page 18: Introduction to Software Engineering Lecture 6 André van der Hoek

Style 4: Peer-to-Peer

Connections are remote procedure calls or remote method invocations

Provided Interface

PeerRequired Interface

Provided Interface

PeerRequired Interface

Provided Interface

PeerRequired Interface

Page 19: Introduction to Software Engineering Lecture 6 André van der Hoek

Style 5: Pipe-and-Filter

Connections are pipes (also called data flows)

Pro

vid

ed

In

terf

ace

Filt

er

Req

uir

ed

In

terf

ace

Pro

vid

ed

In

terf

ace

Filt

er

Req

uir

ed

In

terf

ace

Pro

vid

ed

In

terf

ace

Filt

er

Req

uir

ed

In

terf

ace

Pro

vid

ed

In

terf

ace

Filt

er

Req

uir

ed

In

terf

ace

Page 20: Introduction to Software Engineering Lecture 6 André van der Hoek

Style 6: Implicit Invocation

Connections are events on the software bus

Provided Interface

ComponentRequired Interface

Provided Interface

ComponentRequired Interface

Provided Interface

ComponentRequired Interface

Provided Interface

ComponentRequired Interface

Provided Interface

BusRequired Interface

Page 21: Introduction to Software Engineering Lecture 6 André van der Hoek

Style 7: Layers (Take 1)

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

Provided Interface

Layer 4Required Interface

Provided Interface

Layer 3Required Interface

Provided Interface

Layer 2Required Interface

Provided Interface

Layer 1Required Interface

Provided Interface

Layer 4Required Interface

Provided Interface

Layer 3Required Interface

Provided Interface

Layer 2Required Interface

Provided Interface

Layer 1Required Interface

Page 22: Introduction to Software Engineering Lecture 6 André van der Hoek

Style 7: Layers (Take 2)

Connections are function or method calls

extended

basic

corecore

Page 23: Introduction to Software Engineering Lecture 6 André van der Hoek

Many Other (Variants of) Styles

Interpreters Batch sequential Data abstraction/OO systems Model View Controller (MVC) …

Page 24: Introduction to Software Engineering Lecture 6 André van der Hoek

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 André van der Hoek

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 André van der Hoek

Mixing Styles Is Often Necessary

Blackboard + Client-Server

Provided Interface

BlackboardProvided Interface

One “Part”Required Interface

Provided Interface

My “Bit”Required Interface

Provided Interface

Her “Piece”Required Interface

Provided Interface

A “Part”Required Interface

Provided Interface

Another “Piece”Required Interface

Provided Interface

His “Bit”Required Interface

Page 27: Introduction to Software Engineering Lecture 6 André van der Hoek

Provided Interface

BlackboardProvided Interface

One “Part”Required Interface

Provided Interface

My “Bit”Required Interface

Provided Interface

Her “Piece”Required Interface

Provided Interface

A “Part”Required Interface

Provided Interface

Another “Piece”Required Interface

Provided Interface

His “Bit”Required Interface

Original Blackboard

Page 28: Introduction to Software Engineering Lecture 6 André van der Hoek

Mixing Styles is often Necessary

Blackboard + Implicit Invocation

Provided Interface

BlackboardProvided Interface

One “Part”Required Interface

Provided Interface

A “Piece”Required Interface

Provided Interface

Some “Bit”Required Interface

Provided Interface

BusRequired Interface

Page 29: Introduction to Software Engineering Lecture 6 André van der Hoek

Mixing Styles Is Often Necessary

Pipe-and-Filter + Client-Server + Hierarchy

PipeFCalls

Provided Interface

Audio EncoderRequired Interface

Provided Interface

TunerRequired Interface

Provided Interface

Audio PlayerRequired Interface

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

Your Tasks

1. Read and study slides of this lecture

2. Memorize the architectural styles

3. Read and study Chapter 11 of van Vliet