architectural styles i - ktikti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf ·...

80
Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern KMI, TU Graz Nov 14, 2012 Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 1 / 80

Upload: others

Post on 21-May-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Architectural Styles ISoftware Architecture VO/KU (707.023/707.024)

Denis Helic, Roman Kern

KMI, TU Graz

Nov 14, 2012

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 1 / 80

Page 2: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Recap

Software architecture defines the components and theirrelationships in a (complex) system

Software architecture tries to solve the non-functional requirements

... and focus on the non-runtime quality attributes - X-ability

e.g. maintainability, evolvability, testability, reusability, integrability,configurability, scalability

Some of them can be measured, some only estimated

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 2 / 80

Page 3: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Recap

Software architecture is also influenced by infrastructure

e.g. organizational issues (team), implementation issues(programming language), contextual issues (open source)

⇒ the job is to find the best compromise

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 3 / 80

Page 4: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Outline

1 Non-Functional Concepts

2 Introduction to Architectural Syles

3 Data-flow Architectures

4 Data-centered Architectures

5 Layered Architectures

6 Notification Architectures

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 4 / 80

Page 5: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Functionality Shared between Software Components

Requirements not covered by individual components

Instead requirements needed to be addressed by each component

Or constraints imposed on each component

⇒ Cross-cutting concerns

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 5 / 80

Page 6: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Examples for Cross-Cutting Concerns

Logging

Auditing

Monitoring

Exception/error handling

Security (e.g. authentication, authorisation)

Caching

Localisation

Configuration management

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 6 / 80

Page 7: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Cross-Cutting Functionality Implications

Why are cross-cutting aspects a problem?

They do need to be consistently used/implemented by all components

Some components might not allow this

If the cross-cutting functionality need to be adapted, all componentsneed to be modified

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 7 / 80

Page 8: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Cross-Cutting Concerns on the Implementation Level

Cross-cutting concerns also exist on the implementation level

Addressed by aspect oriented programming

Aspects are factored out and moved away from the functionality

E.g. logging is done in a separate module and at runtime injectedinto the method calls

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 8 / 80

Page 9: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Cross-Cutting Concerns on the SA Level

Keep cross-cutting functionality in separate components (is possible)

E.g. dedicated component for authentication/authorisation

Use components that utilise for example aspect oriented programming

Interceptor architectural pattern

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 9 / 80

Page 10: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Communication between Software Components

Software components communicate with each other

They need to agree on a protocol, API, ...

Thus components share common information (e.g. protocolspecification, contract, ...)

E.g. The receiver implements the API, the sender uses the API

This relationship is therefore directed

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 10 / 80

Page 11: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Coupling

Coupling: degree to which software components depend on eachother

The degree is influenced on a couple of aspects (more than in OOlanguages)

E.g. how generic is the protocol?

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 11 / 80

Page 12: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Degree of Coupling

Loose coupling vs. tight coupling

These are the both extremes

In existing systems this is often a continuum

Components might be tightly in one aspect and loosely coupled inanother

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 12 / 80

Page 13: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Aspects of Coupling

Level Loose Coupling Tight CouplingPhysical coupling Physic intermediary Direct physical link re-

quiredCommunicationstyle

Asynchronous Synchronous

Type system Data-centric, self-contained messages

OO-Style, complex ob-ject trees

Control of processlogic

Distributed logic compo-nents

Central control

Platform depen-dencies

OS- and programminglanguage independent

Strong OS and program-ming language depen-dencies

Source: Enterprise SOA

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 13 / 80

Page 14: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Consequences of Tight Coupling

If one software component changes, the other (dependant)components need to be changed as well

API/protocol specific to the needed requirements

Often enforced by cross-cutting concerns

Typically it is easier (less effort) to create tightly coupled components

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 14 / 80

Page 15: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Consequences of Loose Coupling

Components can be easily exchanged

Components are required to be more generic

E.g. use standard protocols instead of custom ones

Will typically require more effort and better design/planning

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 15 / 80

Page 16: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Type of Coupling in Regard to Quality Attributes

Coupling has an impact on quality attributes

Loose coupling will typically improve maintainability, evolvability,reusability

Tight coupling will typically improve the achievable performance (andtraceability)

For some attributes it is not clear, e.g. testability

⇒ Therefore slight preference to loose coupling

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 16 / 80

Page 17: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Examples of Coupling

External System

HTTP

CalcViewerAppControl

AppControl

GUI

Controller

NetAnalyzerData

NetAnalysis NotifServ

Calcs Datasets Users

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 17 / 80

Page 18: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Non-Functional Concepts

Examples of Coupling

Tight coupling between Controller and the NetAnalyzer

Due to callback (both need to know each other, there might even bea temporal coupling here)

Loose coupling between NetAnalyzer and External System

The external system does not need to know the NetAnalyzer

The external system uses a standard protocol (e.g. SMTP)

⇒ Easy to exchange the external system

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 18 / 80

Page 19: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Introduction to Architectural Syles

Experience in building software systems

Over the years a lot of experience has been gained

Certain patterns and structures appear very often

Such patterns and structures become a part of the vocabulary

Vocabulary is used by designers to think and talk about thearchitectural design

An architectural style is a particular pattern that focuses on thelarge-scale structure of a system typically described by the commonvocabulary

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 19 / 80

Page 20: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Introduction to Architectural Syles

Architectural style definition

Architectural style defines the structural pattern, which consists of

the components that are used

the connections that can be used

set of constraints how they can be used

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 20 / 80

Page 21: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Introduction to Architectural Syles

Architectural style

An architectural style is constrained by a particular principle of how tobuild systems

How components are organized, how data is manipulated, howcomponents communicate, ...?

E.g. a hierarchy of components, sequential processing of data,asynchronous communication, ...

Each principle influences some quality attributes in a positive andsome other in a negative way

It is again balancing between advantages and disadvantages

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 21 / 80

Page 22: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Introduction to Architectural Syles

Classification of styles

1 Data-flow architectures

2 Data-centered architectures

3 Abstraction layer architectures

4 N-tier architectures

5 Notification architectures

6 Remote invocation and service architectures

7 Heterogeneous architectures

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 22 / 80

Page 23: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Data-flow architectures

These architectures have the goal of achieving the quality of reuseand modifiability.

The data-flow style is characterized by viewing the system as a seriesof transformations on successive pieces of input data.

Data enter the system and then flows through the components one ata time until

Finally, the data is assigned to some final destination (output or adata store).

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 23 / 80

Page 24: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Data-flow architectures

Data-flow architectures can be classified into batch-sequentialarchitectures and pipe and filters

In the batch sequential style each step runs to completion before thenext step starts

E.g. UNIX command line pipes

In pipe and filters style steps might run concurrently processing partsof data incrementally

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 24 / 80

Page 25: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters

Data flows through pipes: communication channels between filters

Processing units: filters

Depending on where the filters reside different execution architectures

E.g. same process: filters run within threads

E.g. same machine: filters run within own processes

E.g. network: pipes use the networking architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 25 / 80

Page 26: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters

Conceptually filters consume data from input and write data to output

Input and output: communication channels, i.e. pipes

Depending on where the filters reside different execution architectures

Filters do not know anything about other filters

Ideally they are completely independent from each other

Data flows in streams: good for processing of images, audio, video, ...

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 26 / 80

Page 27: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters

Figure: Pipe and filters style

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 27 / 80

Page 28: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters

Variations: structural and communicational

Structural: more complex topologies might be used

E.g. loops, branches, more than one input, ...

Term pipeline used for linear sequence of filters

Communicational: are filters blocked and wait for data?

Term bounded pipe for limited amount of data in the pipe

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 28 / 80

Page 29: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters

What is the data-structure within the pipe?

All components in the pipe have to agree

Term typed pipe if data is structured

The more specific the data-structures are, the tighter the coupling

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 29 / 80

Page 30: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters

How is the data consumed?

Streaming, or

All data at once (batch sequential), or

Chunks of data

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 30 / 80

Page 31: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters

Figure: Pipe and filters style

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 31 / 80

Page 32: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters - advantages

Pipes are conceptually simple (helps maintainability)

Components can be reused

Easy to add and remove components (helps evolvability)

Allow injection of special components to address cross-cuttingconcerns

E.g. monitor throughput, logging, ...

Allow concurrent/parallel execution (helps scalability)

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 32 / 80

Page 33: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-flow Architectures

Pipes and filters - disadvantages

Pipes often lead to batch processing

Therefore not well suited for interactive applications

E.g. hard to implement incremental updates

Lowest common denominator for data structure

Each filter has to parse/unparse the data (bad for performance)

Adds complexity to each component

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 33 / 80

Page 34: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Data-centered architectures

These architectures have the goal of achieving the quality ofintegrability of data.

The term refers to systems in which the access and update of awidely accessed data store is their primary goal.

Basically, it is nothing more than a centralized data store thatcommunicates with a number of clients

Important for this styles are three protocols: communication, datadefinition and data manipulation protocol

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 34 / 80

Page 35: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Data-centered architectures

The means of communication distinguishes the two subtypes:repository and blackboard

Repository: a client sends a request to the system to perform anecessary action (e.g. insert data)

Blackboard: the system sends notification and data to subscriberswhen data of interest changes, and is thus active

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 35 / 80

Page 36: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Repository

Figure: Repository style

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 36 / 80

Page 37: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Blackboard

Figure: Blackboard style

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 37 / 80

Page 38: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Database architecture

One of the most well-known examples of the data-centeredarchitecture, is a database architecture

There is a common database schema (i.e. meta-structure of therepository) - created with data definition protocol

E.g. in RDBMS a set of related tables with fields, data types, keys, ...

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 38 / 80

Page 39: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Database architecture

Clients use data manipulation protocol to work with the data

E.g. SQL for inserting, selecting, deleting data, ...

Depending on where clients are situated communication protocolmight be

An inner-process communicationCommunication between components on the same machineCommunication over network, e.g. LAN, Internet, etc.

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 39 / 80

Page 40: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Database architecture

Pipes with shared data are similar to data-centered architectures

Blackboard architecture traditionally used for complex systems

E.g. Speech and pattern recognition

Allows loosely coupled components

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 40 / 80

Page 41: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Data-centered architectures: advantages

Ensures data integrity

Reliable, secure, testability guaranteed

Clients independent from the system: performance and usability onthe client side is typically good

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 41 / 80

Page 42: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Data-centered architectures: disadvantages

Problems with scalability, reliability (single point of failure)

Solutions: shared repositories, replication but this increases complexity

Unclear border which functionality lies in the DB and which in theclient

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 42 / 80

Page 43: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Web architecture

Another example of data-centered architectures is the Webarchitecture

There is a common data schema (i.e. meta-structure of the Web)

Follows hypermedia data model

Pages (nodes) and links between them, as well as addressingmechanism

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 43 / 80

Page 44: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Web architecture

Data manipulation not directly in the system but typically achievedthrough applications

Although HTTP protocol has methods for data manipulation

Communication protocol is HTTP

Analysis: integrity not guaranteed (404 error) but extremely scalable

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 44 / 80

Page 45: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Data-centered Architectures

Resource-Oriented Architecture

Such architectures look onto the Web as a huge distributed database

Data model: nodes addressable by URL and interlinked

Data manipulation: HTTP methods (GET, PUT, POST, DELETE)

Scalable, good performance, usability, etc.

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 45 / 80

Page 46: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Abstract layer architectures

Layering: the structure of the system is organized into set of layers

Each layer is on the top of another layer

Well-defined interfaces between layers

Reduces complexity, improves modularity, reusability, maintainability

Different criteria for layering: most notably abstraction

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 46 / 80

Page 47: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Abstract layer architectures

Topological constraints:

Number of layers?

Limit access to next lower layer?

Access to layer above?

Sometimes abstraction is not completely opaque

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 47 / 80

Page 48: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Example

Figure: Layered architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 48 / 80

Page 49: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Operating systems

Typically organized into layers

Successive layers provide more sophisticated services to the layersabove them

Hardware services, kernel services, system services, UI services

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 49 / 80

Page 50: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Operating systems

Figure: Operating system

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 50 / 80

Page 51: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Virtual machines

A virtual machine implements an instruction set for an imaginerymachine

Often virtual machines are the underlaying mechanism by which aprogramming language is executed

E.g. Java virtual machine, different interpreters

Specifies an interface between compiler and a real machine

From conceptual point of view very similar to OS

Improves portability

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 51 / 80

Page 52: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Virtual machines

Figure: Virtual machine

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 52 / 80

Page 53: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Interpreter

Similar to a virtual machine, but only limited to execute code

E.g. shell script

State might be shared between the system components and the script

Allows more flexibility

At the cost of performance

Might help in terms of configurability

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 53 / 80

Page 54: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Peer-to-peer protocol stacks

A common example of layered architecture is a network protocol stack

E.g. TCP/IP protocol stack

Four layers

The lowest layer handles communication between two computers

The internet layer handles routing of packets accross the network

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 54 / 80

Page 55: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Peer-to-peer protocol stacks

The transport layer guarantees that packets are error-free and thatthey are received in the same order as they are sent

The application layer supports application-specific protocols

E.g. HTTP, SMTP, FTP, ...

The layers constitute a series of increasingly abstract operations

Higher layers span a virtual connection between computers on thenetwork

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 55 / 80

Page 56: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Peer-to-peer protocol stacks

Figure: TCP/IP protocol stack

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 56 / 80

Page 57: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Layered architecture - advantages

Each layer is only coupled to the adjacent layers

Helps evolvability, as one can exchange a single layer and limitmodifications to neighbour layers

Helps reusability, as layers can by used by multiple systems

Especially, if the communication is standardised

In practice each layer is often maintained by dedicated developmentteams

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 57 / 80

Page 58: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Layered architecture - disadvantages

Not all systems lend themselves to be organised in layers

Abstraction might have negative effect of performance

E.g. specific optimisations not possible

Hard to find right level of abstraction

In practice lot of effort to implement features which affect multiplelayers

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 58 / 80

Page 59: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

N-tier architectures

Thr N-tier architecture is the modern client-server architecture

Originated with business applications

Through the popularity of the Web today typically related with Webapplications

Conceptually separate architecture into presentation, application anddata storage layers

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 59 / 80

Page 60: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

2-tier architectures

Clients are typically rich (ui+applogic+communication)

Servers store data

Each client runs a complete application

Drawbacks: each client has to know how to communicate with alldata servers

Scalability is compromised because client are tightly coupled withservers

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 60 / 80

Page 61: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

2-tier architectures

Figure: 2-tier architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 61 / 80

Page 62: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

3-tier architectures

Evolved from 2-tier architectures to solve their drawbacks

A third tier is inserted between clients and data servers

Application or business logic tier: middle tier

Typically middle tier is on the server side (but recently might be splitbetween the server and the client)

Scalability improved because clients are thiner

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 62 / 80

Page 63: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

3-tier architectures

Figure: 3-tier architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 63 / 80

Page 64: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

3-tier architectures

Another advantages

Easier client maintenance because the middle tier can be updated inisolation

Better isolation of specifics of the data storage: extensibility,configurability

Better network utilization

Possibility of adding additional processing layers in the middle layer

Cleanly seprates presentation, application logic and data storage

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 64 / 80

Page 65: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

3-tier architectures

Figure: Presentation, application, data

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 65 / 80

Page 66: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Rich clients

A rich client contains full knowledge of application

It has access to the full suite of UI mechanisms on the platform

Two types of rich clients

Clients for standard applications using a standard protocol (e.g.e-mail clients)

Clients for custom applications using a custom protocol

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 66 / 80

Page 67: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Rich clients

Figure: Rich client architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 67 / 80

Page 68: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Thin clients

Thin clients have no knowledge on application

The complete application knowledge is on the server

Most notably: Web clients

Even if we use AJAX: it is served by server, i.e. the applicationknowledge is on the server

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 68 / 80

Page 69: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Thin clients

Another form: a graphical thin client

Only displays a graphical user interface

In this architecture we have a so-called display server

It resides on the server side but acts as a user-interface screen

It transmits changes in the user-screen to the client

X-server and X-windows on UNIX systems

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 69 / 80

Page 70: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Layered Architectures

Thin clients

Figure: Thin client architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 70 / 80

Page 71: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

Architectures where information and activity is propagated by anotification mechanism

When there are complex communication patterns that are not knownat design time

Basically, components interested in events register their interest

When an event occurs the interested components are notified

Well-known example: event handling in GUIs

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 71 / 80

Page 72: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

Also called: publish-and-subscribe

Other terminology: listeners and callbacks

Observer pattern

Similar to blackboard data-centric architectures

Notification architectures are more general because any kind of eventsmight occur not only data-related events

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 72 / 80

Page 73: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

At execution level two variants

Components interested in events register directly with the processthat generates these events

Components register with a dedicated notification component

The communication style in both variants is callback

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 73 / 80

Page 74: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

Additional variants

When an event occurs the notifying component may send the eventto all registered components (broadcast)

Another possibility is to send the event only to interested components

Variations in communication style

Notification might include all the relevant data (push style)

Notification just signals that something happened: the registeredcomponent pulls the relevant data

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 74 / 80

Page 75: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

Figure: Notification architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 75 / 80

Page 76: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

Figure: Notification architecture

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 76 / 80

Page 77: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

Similar to notification architecture: message queues

Used to control process flow

Two types: publish/subscribe and point-to-point

Publish/subscribe also known as topics

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 77 / 80

Page 78: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures

Examples of notification style architectures

Triggers in databases, consistency check

Spell checking in editors

Separation of presentation from persistence of data

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 78 / 80

Page 79: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures - advantages

Loose coupling

Notification receivers can easily be changed and added

Helps evolvability

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 79 / 80

Page 80: Architectural Styles I - KTIkti.tugraz.at/staff/rkern/courses/sa/2012/slides_as_i.pdf · Architectural Styles I Software Architecture VO/KU (707.023/707.024) Denis Helic, Roman Kern

Notification Architectures

Notification architectures - disadvantages

No control over process flow

Due to asynchronous nature, might not be deterministic (bad fortestability)

Unclear which data should be passed with the notification

If too little data is passed, the receiver might need to fetch it(increases coupling)

Performance issues due to update storm

Even worse, there might be endless loops

Denis Helic, Roman Kern (KMI, TU Graz) Architectural Styles I Nov 14, 2012 80 / 80