architectural stylesrtholmes/teaching/2010... · - software architecture: foundations, theory, and...

34
Lecture 6 - Thursday, September 30 2010. Material and some slide content from: - Emerson Murphy-Hill - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes

Upload: others

Post on 13-Jun-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

Lecture 6 - Thursday, September 30 2010.

Material and some slide content from:- Emerson Murphy-Hill- Software Architecture: Foundations, Theory, and Practice- Essential Software Architecture

Architectural StylesReid Holmes

Page 3: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

ArchitecturalStyles

LanguageBased

Layered Dataflow

SharedMemory

InterpreterImplicit

Invocation

Peer-to-Peer

Main program &Subroutines

Object-oriented

VirtualMachine

ClientServer

Batch-sequential

Pipe-and-Filter

Blackboard

Rule-based Interpreter

Mobilecode

Publish-subscribe

Event-based

[TOPOLOGY FROM TAILOR ET AL.]

Page 4: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Good properties of an architecture‣ ?

‣ Resilient in the face of (inevitable) changes

‣ Source of guidance through product lifetime

‣ Reuse of established engineering knowledge

[CZARNECKI]

Page 5: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

“Pure” architectural styles‣ Pure architectural styles are rarely used in practice

‣ Systems in practice:

‣ Regularly deviate from pure styles.

‣ Typically feature many architectural styles.

‣ Architects must understand the “pure” styles to understand the strength and weaknesses of the style as well as the consequences of deviating from the style.

[CZARNECKI]

Page 6: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Lunar lander example[TAILOR ET AL.]

Page 7: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Language-based‣ Influenced by the languages that implement them.

‣ Lower-level, very flexible.

Page 8: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Main program & subroutine

Page 9: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Main program & subroutine‣ Decomposition of functional elements.

‣ Components:

‣ Main program and subroutines.

‣ Connections:

‣ Function / procedure calls.

‣ Data elements:

‣ Values passed in / out of subroutines.

‣ Topology:

‣ Directed graph between subroutines and main program.

[TAILOR ET AL.]

Page 10: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Main program & subroutine‣ Additional constraints:

‣ None.

‣ Qualities:

‣ Modularity, as long as interfaces are maintained.

‣ Typical uses:

‣ Small programs.

‣ Cautions:

‣ Poor scalability. Data structures are ill-defined.

‣ Relations to languages and environments:

‣ BASIC, Pascal, or C.

[TAILOR ET AL.]

Page 11: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Object-oriented[TAILOR ET AL.]

Page 12: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Object-oriented‣ Encapsulation of state and actions.

‣ Components:

‣ Objects or ADTs.

‣ Connections:

‣ Method calls.

‣ Data elements:

‣ Method arguments.

‣ Topology:

‣ Varies. Data shared through calls and inheritance.

[TAILOR ET AL.]

Page 13: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Additional constraints:

‣ Commonly used with shared memory (pointers). Object preserves identity of representation.

‣ Qualities:

‣ Data integrity. Abstraction. Change implementations without affecting clients. Can break problems into interacting parts.

‣ Typical uses:

‣ With complex, dynamic data. Correlation to real-world entities.

‣ Cautions:

‣ Distributed applications hard. Often inefficient for sci. computing. Potential for high coupling via constructors. Understanding can be difficult.

‣ Relations to languages and environments:

‣ C++, Java.

Style: Object-oriented[TAILOR ET AL.]

Page 14: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Layered‣ Layered systems are

hierarchically organized providing services to upper layers and acting as clients for lower layers.

‣ Lower levels provide more general functionality to more specific upper layers.

‣ In strict layered systems, layers can only communicate with adjacent layers.

[CZARNECKI]

Page 15: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Virtual machine[TAILOR ET AL.]

Page 16: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Virtual machine‣ An ordered sequence of layers; each layer (VM)

provides functionality to the layers above it.

‣ Components:

‣ Layers, consisting of programs (sub-components).

‣ Connections:

‣ Typically procedure calls.

‣ Data elements:

‣ Parameters passed between layers.

‣ Topology:

‣ ?

[TAILOR ET AL.]

Page 17: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Additional constraints:

‣ None.

‣ Qualities:

‣ ?

‣ Typical uses:

‣ Operating systems; network protocol stacks.

‣ Cautions:

‣ Strict adherence to levels can be inefficient.

Style: Virtual machine[TAILOR ET AL.]

Page 18: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Client-server[TAILOR ET AL.]

Page 19: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Client-server‣ Clients communicate with server which performs actions

and returns data. Client initiates communication.

‣ Components:

‣ ?

‣ Connections:

‣ Protocols, RPC.

‣ Data elements:

‣ Parameters and return values sent / received by connectors.

‣ Topology:

‣ Two level. Typically many clients.

[TAILOR ET AL.]

Page 20: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Additional constraints:

‣ ?

‣ Qualities:

‣ Centralization of computation. Server can handle many clients.

‣ Typical uses:

‣ Applications where: client is simple; data integrity important; computation expensive.

‣ Cautions:

‣ ?

Style: Client-server[TAILOR ET AL.]

Page 21: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Dataflow‣ A data flow system is one in which:

‣ The availability of data controls computation.

‣ The structure of the design is determined by the orderly motion of data between components.

‣ The pattern of data flow is explicit.

‣ Variations:

‣ Push vs. pull.

‣ Degree of concurrency.

‣ Topology.

[CZARNECKI]

Page 22: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Batch-sequential

Page 23: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Separate programs executed in order passed, each step proceeding after the the previous finishes.

‣ Components:

‣ Independent programs.

‣ Connections:

‣ Sneaker-net.

‣ Data elements:

‣ ?

‣ Topology:

‣ Linear.

[TAILOR ET AL.]

Style: Batch-sequential

Page 24: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Additional constraints:

‣ ?

‣ Qualities:

‣ Interruptible execution.

‣ Typical uses:

‣ Transaction processing in financial systems.

‣ Cautions:

‣ ?

[TAILOR ET AL.]

Style: Batch-sequential

Page 25: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Pipe-and-filter

Page 26: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Streams of data are passed concurrently from one program to another.

‣ Components:

‣ ?

‣ Connections:

‣ Explicitly routed by OS.

‣ Data elements:

‣ Linear data streams, often text.

‣ Topology:

‣ Typically pipeline.

[TAILOR ET AL.]

Style: Pipe-and-filter

Page 27: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Qualities:

‣ ?

‣ Typical uses:

‣ Very common in OS utilities.

‣ Cautions:

‣ Not optimal for interactive programs or for complex data structures.

[TAILOR ET AL.]

Style: Pipe-and-filter

Page 28: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Shared state‣ Characterized by a central store that represents

system state and a collection accessed and modified by a collection of components.

‣ Central store is explicitly designed and structured.

Page 29: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Rule-based

Page 30: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Inference engine parses input to determine fact/query. Facts are added to knowledge base; otherwise the knowledge base tries to resolve query using applicable rules.

‣ Components:

‣ UI, Inference engine, knowledge base.

‣ Connections:

‣ Tight connections using procedure calls.

‣ Data elements:

‣ Facts and queries.

‣ Topology:

‣ ?

[TAILOR ET AL.]

Style: Rule-based

Page 31: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Qualities:

‣ ?

‣ Typical uses:

‣ For programs that involve solving a series of predicates.

‣ Cautions:

‣ ?

[TAILOR ET AL.]

Style: Rule-based

Page 32: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Style: Blackboard

Page 33: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Independent programs communicate exclusively through shared global data repository.

‣ Components:

‣ ?

‣ Connections:

‣ Varies: memory reference, procedure call, DB query.

‣ Data elements:

‣ Data stored on blackboard.

‣ Topology:

‣ Star; knowledge sources surround blackboard.

[TAILOR ET AL.]

Style: Blackboard

Page 34: Architectural Stylesrtholmes/teaching/2010... · - Software Architecture: Foundations, Theory, and Practice - Essential Software Architecture Architectural Styles Reid Holmes. REID

REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

‣ Variants:

‣ ?

‣ ?

‣ Qualities:

‣ Efficient sharing of large amounts of data. Strategies to complex problems do not need to be pre-planned.

‣ Typical uses:

‣ Heuristic problem solving.

‣ Cautions:

‣ Not optimal if regulation of data is needed or the data frequently changes and must be updated on all clients.

[TAILOR ET AL.]

Style: Blackboard