Software Architecture Software Engineering - 2017 Alessio Gambi - - - PowerPoint PPT Presentation

software architecture
SMART_READER_LITE
LIVE PREVIEW

Software Architecture Software Engineering - 2017 Alessio Gambi - - - PowerPoint PPT Presentation

Software Architecture Software Engineering - 2017 Alessio Gambi - Saarland University These slides are based the slides from Cesare Pautasso and Christoph Dorn, and updated from various sources. Architecture Design in the Large Objects and


slide-1
SLIDE 1

Software Architecture

Software Engineering - 2017 Alessio Gambi - Saarland University

These slides are based the slides from Cesare Pautasso and Christoph Dorn, and updated from various sources.

slide-2
SLIDE 2

Architecture

slide-3
SLIDE 3

Design in the Large

  • Objects and methods
  • Modules and components
  • Large and complex systems
  • Systems of systems
slide-4
SLIDE 4

Design in the Large

  • Size of the team
  • Lifetime of the project
  • Cost of development
  • Objects and methods
  • Modules and components
  • Large and complex systems
  • Systems of systems
slide-5
SLIDE 5

Building software as we build buildings ?

  • Software is complex, so are

buildings (blueprint)

  • Architecture implies a systematic

process for design and implementation

  • Architects put together pieces and

materials, they usually do not invent new materials

slide-6
SLIDE 6

It’s just an analogy !

  • We know a lot about buildings

(2000+ years), much less about software

  • Software systems do not obey to

physical laws

  • Software deployment has no

counterpart in building architecture

slide-7
SLIDE 7

Software Architecture

A software system’s architecture is the set of principal design decisions made about the system.

  • N. Taylor et al.
slide-8
SLIDE 8

Software Architecture

A software system’s architecture is the set of principal design decisions made about the system.

  • N. Taylor et al.

Where do the pillars go? Where do the chairs go?

slide-9
SLIDE 9

Abstraction

Manage complexity in the design

slide-10
SLIDE 10

Communication

Document, remember and share design decisions among the team

slide-11
SLIDE 11

Visualization

Depict and highlight important aspects

slide-12
SLIDE 12

Representation

Characterize components and behaviors

slide-13
SLIDE 13

Quality Analysis

Understand, predict, and control

slide-14
SLIDE 14

When SW Architecture Start ?

Since the beginning of design!

slide-15
SLIDE 15

When SW Architecture Stop ?

slide-16
SLIDE 16

Never!

When SW Architecture Stop ?

slide-17
SLIDE 17

Architecture is NOT a development phase Architecture is NOT only “high-level” design

slide-18
SLIDE 18

Every System an Architecture has

slide-19
SLIDE 19

Every System an Architecture has

slide-20
SLIDE 20

Every System an Architecture has

slide-21
SLIDE 21

Architectural Evolution

Decisions are added and changed by multiple actors… sometimes without knowing it

slide-22
SLIDE 22

Architectural Degradation

P

slide-23
SLIDE 23

Architectural Degradation

P D

Ideal P=D

slide-24
SLIDE 24

Architectural Degradation

P D

Ideal P=D Drift P !=D and D does not violate P

slide-25
SLIDE 25

Architectural Degradation

P D

Ideal P=D Drift P !=D and D does not violate P Erosion P !=D and D violates P

slide-26
SLIDE 26

Summary

  • Blueprint for construction and evolution

abstraction • principal design decisions

  • Not only about design

communicate • visualize • represent • assess

  • Every system has (an evolving) one

descriptive • prescriptive • drift • erosion

  • Not a phase, not only “high-level” design
slide-27
SLIDE 27

Design

slide-28
SLIDE 28

How to Design

Even the best architects copy solutions that have proven themselves in practice, adapt them to the current context, improve upon their weaknesses, and then assemble them in novel ways

slide-29
SLIDE 29

How to Design

Even the best architects copy solutions that have proven themselves in practice, adapt them to the current context, improve upon their weaknesses, and then assemble them in novel ways

slide-30
SLIDE 30

How to Design

Even the best architects copy solutions that have proven themselves in practice, adapt them to the current context, improve upon their weaknesses, and then assemble them in novel ways

slide-31
SLIDE 31

Architectural Hoisting

George Fairbanks - http://georgefairbanks.com/blog/architectural-hoisting-original/

Design the architecture with the intent to guarantee a certain quality of the system.

slide-32
SLIDE 32

Architectural Hoisting

George Fairbanks - http://georgefairbanks.com/blog/architectural-hoisting-original/

Design the architecture with the intent to guarantee a certain quality of the system.

Security place sensitive data behind the firewall Scalability make critical components stateless Persistence use a database Extensibility use a plug-in framework

slide-33
SLIDE 33

What makes a “good” SW Architecture?

  • No such things like perfect design and inherently

good/bad architecture

  • Fit to some purpose, and context-dependent
slide-34
SLIDE 34

What makes a “good” SW Architecture?

  • No such things like perfect design and inherently

good/bad architecture

  • Fit to some purpose, and context-dependent
  • Principles, guidelines and the use of collective

experience (method)

slide-35
SLIDE 35

Design Principles Architectural Patterns Architectural Styles

slide-36
SLIDE 36

Design Principles

  • Abstraction
  • Encapsulation - Separation of Concerns
  • Modularization
  • KISS (Keep it simple, stupid)
  • DRY (Don’t repeat yourself)
slide-37
SLIDE 37

Architectural Patterns

Set of architectural design decisions that are applicable to a recurring design problem, and are parameterized to account for the development contexts in which that problem appears.

slide-38
SLIDE 38

Architectural Patterns

Set of architectural design decisions that are applicable to a recurring design problem, and are parameterized to account for the development contexts in which that problem appears.

Layered Component Notification Composition

slide-39
SLIDE 39

Layered Patterns

  • State-Logic-Display

separate elements with different rate of change

  • Model-View-Controller

support many interaction and display modes for the same content

  • Presenter-View

keep a consistent look and feel across a complex UI

slide-40
SLIDE 40

State-Logic-Display

cluster elements that change at the same rate

slide-41
SLIDE 41

Model-View-Controller

separate content (model) from presentation (output) and interaction (input)

slide-42
SLIDE 42

Presenter-View

extract the content from the model to be presented from the rendering into screens/web pages

slide-43
SLIDE 43

Component Patterns

  • Interoperability

enable communication between different platforms

  • Directory

facilitate location transparency (direct control)

  • Dependency Injection

facilitate location transparency (inversion of control)

slide-44
SLIDE 44

Interoperability

map to a standardized intermediate representation and communication style

slide-45
SLIDE 45

Directory

use a directory service to find service endpoints based on abstract descriptions

slide-46
SLIDE 46

Dependency Injection

use a container which updates components with bindings to their dependencies

slide-47
SLIDE 47

Notification Patterns

  • Event Monitor

inform clients about events happening at the service

  • Observer

promptly inform clients about state changes of a service

  • Publish/Subscribe

decouple clients from services generating events

  • Messaging Bridge

connect multiple messaging systems

  • Half Synch/Half Async

interconnect synchronous and asynchronous components

slide-48
SLIDE 48

Event Monitor

poll and compare state snapshots

slide-49
SLIDE 49

Observer

detect changes and generate events at the service

slide-50
SLIDE 50

Publish/Subscribe

factor out event propagation and subscription management into a separate service

slide-51
SLIDE 51

Messaging Bridge

link multiple messaging systems to make messages exchanged on one also available on the others

slide-52
SLIDE 52

Half-Sync/Half-Async

Add a layer hiding asynchronous interactions behind a synchronous interface

slide-53
SLIDE 53

Composition Patterns

  • Scatter/Gather

send the same message to multiple recipients which will/may reply

  • Canary Call

avoid crashing all recipients of a poisoned request

  • Master/Slave

speed up the execution of long running computations

  • Load Balancing

speed up and scale up the execution of requests of many clients

  • Orchestration

improve the reuse of existing applications

slide-54
SLIDE 54

Scatter/Gather

combine the notification of the request with aggregation of replies

slide-55
SLIDE 55

Canary Call

use an heuristic to evaluate the request

slide-56
SLIDE 56

Master/Slave

split a large job into smaller independent partitions which can be processed in parallel

slide-57
SLIDE 57

Load Balancing

deploy many replicated instances of the server

  • n multiple machines
slide-58
SLIDE 58

Composition/Orchestration

build systems out of the composition of existing ones

slide-59
SLIDE 59

Patterns, Patterns, Patterns

Architectural Patterns not Design Patterns

Architectural Design

slide-60
SLIDE 60

Patterns, Patterns, Patterns

Express fundamental structural organizations Specify relationships among (sub-)systems Capture roles in solutions that occur repeatedly Define the relationships among roles

Architectural Patterns not Design Patterns

Architectural Design

slide-61
SLIDE 61

Architectural Styles

Named collections of architectural decisions and constrains for a specific development context that elicit beneficial qualities in each resulting system

slide-62
SLIDE 62

Why Styles?

A common vocabulary for the design elements

improve communication by shared understanding

A predefined configuration and composition rules

known benefits and limitations ensure quality attributes if constraints are followed

Style-specific analyses and visualizations

slide-63
SLIDE 63

Styles and Patterns

One style is dominant The same pattern can be used many times Many patterns are combined General constraints Fine-grained constraints Architecture with
 superior properties Specific to recurrent problems Styles must be refined and adapted

slide-64
SLIDE 64

Many (and Many More)

slide-65
SLIDE 65

Monolithic

  • Lack of structure
  • No Constraints
  • Poor Maintainability
  • Possibly Good Performance

Mainframe COBOL programs ∙ powerpoint ∙ many games

slide-66
SLIDE 66

Layered

  • Communications 1 layer up/down
  • Information hiding, no circular deps
  • Possibly bad performance
  • Good evolvability

Network protocol stacks ∙ Web applications ∙ Virtual Machines

slide-67
SLIDE 67

Component Based

  • Encapsulation
  • Information hiding
  • Components compatibility problem
  • Good reuse, independent development

CORBA ∙ Enterprise JavaBean ∙ OSGi

slide-68
SLIDE 68

Service Oriented

  • Components might be outside control
  • Standard connectors, precise interfaces
  • Interface compatibility problem
  • Loose coupling, reuse

Web Services (WS-*) ∙ Cloud Computing

slide-69
SLIDE 69

Plugin

  • Explicit extension points
  • Static/Dynamic composition
  • Low security (3rd party code)
  • Extensibility and customizability

Eclipse ∙ Photoshop ∙ Browsers’ extensions

slide-70
SLIDE 70

Pipe & Filter

  • Clean separation: filter process, pipe

transport

  • Heterogeneity and distribution
  • Only batch processing, serializable data
  • Composability, Reuse

UNIX shell ∙ Compiler ∙ Graphics Rendering

slide-71
SLIDE 71

Black Board

  • Collective problem solving via shared data
  • Asynchronous components interactions
  • Requires common data format
  • Loose coupling, implicit data flow

Database ∙ Tuple space ∙ Expert systems (AI)

slide-72
SLIDE 72

Event Driven

  • Produce/React to events
  • Asynchronous signals/messages
  • Difficult guarantee performance
  • Loose coupling, scalable

Sensor Monitoring ∙ Complex Event Processing

slide-73
SLIDE 73

Event Driven

  • Produce/React to events
  • Asynchronous signals/messages
  • Difficult guarantee performance
  • Loose coupling, scalable

Sensor Monitoring ∙ Complex Event Processing

slide-74
SLIDE 74

Event Driven

  • Produce/React to events
  • Asynchronous signals/messages
  • Difficult guarantee performance
  • Loose coupling, scalable

Sensor Monitoring ∙ Complex Event Processing

slide-75
SLIDE 75

Publish/Subscribe

  • Event driven + opposite roles
  • Subscription to queues or topics
  • Limited scalability
  • Loose coupling

Twitter ∙ RSS Feeds ∙ Email

slide-76
SLIDE 76

Publish/Subscribe

  • Event driven + opposite roles
  • Subscription to queues or topics
  • Limited scalability
  • Loose coupling

Twitter ∙ RSS Feeds ∙ Email

slide-77
SLIDE 77

Publish/Subscribe

  • Event driven + opposite roles
  • Subscription to queues or topics
  • Limited scalability
  • Loose coupling

Twitter ∙ RSS Feeds ∙ Email

slide-78
SLIDE 78

Client/Server

  • Many clients, active, close to users
  • One server, passive, close to data
  • Single point of failure, scalability
  • Security, scalability

Web Browser/server ∙ Databases ∙ File Servers ∙ Git/SVN

slide-79
SLIDE 79

Client/Server

  • Many clients, active, close to users
  • One server, passive, close to data
  • Single point of failure, scalability
  • Security, scalability

Web Browser/server ∙ Databases ∙ File Servers ∙ Git/SVN

slide-80
SLIDE 80

Peer to Peer

  • Both server and client at the same time
  • Dynamic join/leave
  • Difficult administration, data recovery
  • Scalability, dependability/robustness

File Sharing ∙ Skype (mixed style) ∙ Distributed Hash Tables

slide-81
SLIDE 81

Data Centric

  • Persistence layer
  • Black board like
  • Single point of failure
  • (Eventual) Consistency (BASE/ACID)

Relational DB ∙ Key-Value Stores

slide-82
SLIDE 82

Rule Based

  • Rules dynamically triggered
  • Layered
  • Possibly hard to understand and maintain
  • Evolvability

Business Rule Engines ∙ Expert Systems ∙ Prolog

slide-83
SLIDE 83

Rule Based

  • Rules dynamically triggered
  • Layered
  • Possibly hard to understand and maintain
  • Evolvability

Business Rule Engines ∙ Expert Systems ∙ Prolog

slide-84
SLIDE 84

Mobile Code

  • Code migrates (weak)
  • Code+execution state migrate (strong)
  • Security
  • Fault tolerance, performance

JavaScript ∙ Flash ∙ Java Applets ∙ Mobile Agents ∙ Viruses

slide-85
SLIDE 85

REST

  • Hybrid style
  • Stateless interactions/Stateful

resources

  • Loose coupling, scalability,

interoperability World Wide Web ∙ RESTFul Web APIs

slide-86
SLIDE 86

Summary

  • A great architecture likely combines aspects of

several other architectures

  • Do no limit to just one pattern, but avoid the use of

unnecessary patterns

  • Different styles lead to architectures with different

qualities, and so might do the same style

  • Never stop at the choice of patterns and styles:

further refinement is always needed

slide-87
SLIDE 87

Modeling

slide-88
SLIDE 88

Why modeling?

  • Record decisions
  • Communicate decisions
  • Evaluate decisions
  • Generate artifacts
slide-89
SLIDE 89
slide-90
SLIDE 90

The problem (Domain model)

slide-91
SLIDE 91

The problem (Domain model) The environment

System context Stakeholders

slide-92
SLIDE 92

The system-to-be ( )

Static and dynamic architecture

The problem (Domain model) The environment

System context Stakeholders

Design Model

slide-93
SLIDE 93

The system-to-be ( )

Static and dynamic architecture

Quality attributes and 
 non-functional properties The problem (Domain model) The environment

System context Stakeholders

Design Model

slide-94
SLIDE 94

The system-to-be ( )

Static and dynamic architecture

Quality attributes and 
 non-functional properties The problem (Domain model) The environment

System context Stakeholders

The design process Design Model

slide-95
SLIDE 95

Design Model

System Context Interfaces/API Quality Attributes

Boundary Model

Externally visible behavior

slide-96
SLIDE 96

Design Model

Software Components Software Connectors Component assembly System Context Interfaces/API Quality Attributes

Boundary Model Internal Model

Internal behavior Externally visible behavior

slide-97
SLIDE 97

Reusable unit of composition Can be composed into larger systems

State in a system

Software Components

Locus of computation

slide-98
SLIDE 98

Reusable unit of composition Can be composed into larger systems

State in a system

Software Components

Application-specific

Media Player Math Library Web Server Database Locus of computation

Infrastructure

slide-99
SLIDE 99

Composition vs Distribution

slide-100
SLIDE 100

Component Roles

slide-101
SLIDE 101

Components Modules Objects

Encapsulate state and functionality Coarse-grained Black box architecture elements Structure of architecture Encapsulate state and functionality Fine-grained Can “move” across components Identifiable unit of instantiation Rarely exist at run time May require other modules to compile Package the code

slide-102
SLIDE 102

Component Interfaces

slide-103
SLIDE 103

Provided Interfaces

  • Specify and document the externally visible

features (or public API) offered by the component


  • Data types and model
  • Operations
  • Properties
  • Events and call-backs
slide-104
SLIDE 104

Required Interface

  • Specify the conditions upon which a component

can be (re)used

  • The platform is compatible
  • The environment is setup correctly
slide-105
SLIDE 105

Compatible Interfaces

Adapter Wrapper

slide-106
SLIDE 106

Software Connectors

Model static and dynamic aspects of the
 interaction between component interfaces

slide-107
SLIDE 107

Connector Roles

  • Communication


deliver data and transfer of control

  • Coordination


separate control from computation

  • Conversion


enable interaction of mismatched components

  • Facilitation/Mediation


govern access to shared information

slide-108
SLIDE 108

not always directly visible in the code mostly application-independent

slide-109
SLIDE 109

Connectors are abstractions

When to hide components inside a connector?

slide-110
SLIDE 110

Remote Procedure Call

  • Call
slide-111
SLIDE 111

Remote Procedure Call

  • Call
slide-112
SLIDE 112

Message Bus

  • Publish
  • Subscribe
  • Notify
slide-113
SLIDE 113
  • Get
  • Put
  • Post
  • Delete

Web

slide-114
SLIDE 114

Views and Viewpoints

slide-115
SLIDE 115

Viewpoint View

A subset of related architectural design decisions The common concerns shared by a view

slide-116
SLIDE 116

Views are not always orthogonal and might become inconsistent if design decision are not compatible (erosion)

Consistency

slide-117
SLIDE 117

4+1

Philippe Kruchten

Logical View Development View Physical View Process View Use Case Scenarios

slide-118
SLIDE 118

Use Case Scenarios

  • Unify and link the elements of the other 4 views
  • Help to ensure the architectural model addresses all

the requirements

  • Each scenario can be illustrated using the other 4

views

slide-119
SLIDE 119

MusicApp Example

Use Case Scenarios

✴ Browse for new songs ✴ Buy song ✴ Download the purchased song on the phone ✴ Play the song

slide-120
SLIDE 120

Logical View

  • Decompose the system structure into software

components and connectors

  • Map functionalities (use cases) onto the

components

slide-121
SLIDE 121
slide-122
SLIDE 122

Process View

  • Model the dynamic aspects of the architecture and

the behavior of its parts

  • Describe how components/processes communicate
slide-123
SLIDE 123

Use Cases: Browse, Pay and Play For Songs

slide-124
SLIDE 124

Development View

  • Static organization of the software code artifacts
  • Map elements in the logical view and the code

artifacts

slide-125
SLIDE 125
slide-126
SLIDE 126

Physical View

  • Hardware environment where the software will be

deployed

  • Map logical and physical entities
slide-127
SLIDE 127
slide-128
SLIDE 128
slide-129
SLIDE 129
slide-130
SLIDE 130
slide-131
SLIDE 131
slide-132
SLIDE 132
slide-133
SLIDE 133

References and Readings

  • Textbooks
  • R. N. Taylor, N. Medvidovic, E. M. Dashofy, Software Architecture: Foundations, Theory, and

Practice, Wiley, January 2009.

  • G. Fairbanks, Just Enough Software Architecture: A Risk-Driven Approach, Marshall & Brainerd,

August 2010.

  • Amy Brown and Greg Wilson (eds.) The Architecture of Open Source Applications, 2012.
  • References
  • Mary Shaw and David Garlan, Software Architecture: Pespectives on an Emerging Discipline,

Prentice-Hall, 1996

  • Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, Michael Stal Pattern

Oriented Software Architecture: A System of Patterns, Wiley, 1996

  • William Brown, Raphael Malveau, Hays McCormick, Thomas Mowbray, Anti Patterns:

Refactoring Software, Architectures, and Projects in Crisis, Wiley, 1992

  • Clemens Szyperski, Component Software: Beyond Object-Oriented Programming, 2nd Edition,

Addison-Wesley, 2002

  • Len Bass, Paul Clements, Rick Kazman, Ken Bass, Software Architecture in Practice, 2nd

Edition, Addison-Wesley, 2003

  • Martin Fowler, Patterns of Enterprise Application Architecture, Addison Wesley, 2002
  • Luke Hohmann, Beyond Software Architecture: Creating and Sustaining Winning Solutions,

Addison-Wesley, 2003

  • Ian Gorton, Essential Software Architecture, Springer 2006