Architectural Patterns
Architectural Patterns
Architectural patterns
References
• Pattern oriented Software architecture by
Frank Buschmann et al.,
• web materials by Noorhosseini
• P. Avgeriou, U. Zdun, Architectural Patterns
Revisited – A Pattern Language, the European
Pattern Languages of Programming
(EuroPLOP) 6–10 July 2005, Irsee, Germany.
Introduction
• Classification of patterns
– Programming
– Design
– Architectural
– Organizational
4
Software Architectural Patterns(2)
• Architectural patterns are a key concept in the
field of software architecture:
– They offer solutions to architectural problems,
– Help to document the architectural design
decisions,
– Facilitate communication between stakeholders
through a common vocabulary,
– Describe the quality attributes of a software system
as forces.
• It is systematic
5
Software Architectural Patterns(3)
6
Classifying Architectural Patterns:
7
Architectural View
• An Architectural View is a representation of a system
from the perspective of a related set of concerns
• Views
– Components
– Connectors
– Module
– Allocation
8
An Overview on Patterns(1)
1. The Layered View deals with how the system as a complex heterogeneous entity
can be decomposed into interacting parts.
– LAYERS
– INDIRECTION LAYER (a variant of this pattern is called “virtual Machine”
2. The Data Flow View deals with how streams of data are successively processed or
transformed by components.
– BATCH SEQUENTIAL
– PIPES AND FILTERS
3. The Data-centered View is appropriate when the concerns involve how a central
repository of data is accessed by multiple components.
– SHARED REPOSITORY
– ACTIVE REPOSITORY
– BLACKBOARD
4. The Adaptation View deals with how the system adapts itself during evolution.
– MICROKERNEL
– REFLECTION
– INTERCEPTOR
9
An Overview on Patterns(2)
5. The Language Extension View is concerned with how systems offer an abstraction layer to
the computation infrastructure.
– INTERPRETER
– VIRTUAL MACHINE
– RULE-BASED SYSTEM
6. The User Interaction View shows the runtime structure of components that offer a user
interface.
– MODEL-VIEW-CONTROLLER
– PRESENTATION-ABSTRACTION-CONTROL
– C2
7. The Component Interaction View focuses on how individual components exchange
messages but retain their autonomy.
– EXPLICIT INVOCATION (called “communicating processes”)
– IMPLICIT INVOCATION (also called “event systems”)
– CLIENT-SERVER
– PEER-TO-PEER
– PUBLISH-SUBSCRIBE (called “publisher-subscriber” )
8. The Distribution View tackles concerns about disseminating components in a networked
environment.
– BROKER
– REMOTE PROCEDURE CALLS (called “distributed objects)
– MESSAGE QUEUING (called “messaging” )
10
1.Layered View
• In the Layered View the system is viewed as a
complex heterogeneous entity that can be
decomposed into interacting parts. The
concerns addressed by this view are:
– What are the parts that make up the whole
system?
– How do these parts interact with each other?
– How do the parts perform their functionality and
still remain decoupled from each other?
– How are the quality attributes of modifiability,
scalability, and integrability supported?
11
Layered View
Pattern: LAYERS
• Decoupling the components in a vertical manner
• On the other hand components also require some
horizontal structuring
• Within each LAYER all constituent components work
at the same level of abstraction and can interact
through connectors.
• In the pure form of the pattern, layers should not be
by-passed: higher-level layers access lower-level
layers only through the layer beneath.
• Explicit interface/change the details inside
• Two adjacent LAYERS can be considered as a
CLIENT-SERVER pair, the higher layer being the
client and the lower layer being the server.
12
Layered View
Pattern: INDIRECTION LAYER
14
Data Flow View
Pattern: BATCH SEQUENTIAL
16
• Traditional Compiler Architecture
program
source
Opt Code
object
code
• Pipelined Compiler Architecture
Lex Syn Sem Opt Code
program object
source code
17
3.Data-centered View
• In the Data-centered View the system is viewed as a persistent, shared
data store that is accessed and modified by a number of elements. The
concerns addressed by this view are:
– How is the shared data store created, accessed, and updated?
– How is data distributed?
– Is the data store passive or active, i.e. does it notify its accessors or are the
accessors responsible of finding data of interest to them?
– How does the data store communicate with the elements that access it?
– Do the accessor elements communicate indirectly through the shared data or
also directly with each other?
– How are the quality attributes of scalability, modifiability, reusability, and
integrability supported?
• The data store and the elements that access it are components.
• The data store is independent of the components, and the components
are usually independent of one another.
y 18
Data-centered View
Pattern: SHARED REPOSITORY
• In the SHARED REPOSITORY pattern one component of the system is
used as a central data store, accessed by all other independent
components.
• The SHARED REPOSITORY
– must be scalable to meet the clients’ requirements
– it must ensure data consistency
– It must handle problems of resource contention
• for example by locking accessed data.
20
Data-centered View
Pattern: BLACKBOARD
• In an immature domain in which no deterministic approach to a
solution is known
• Step-wise improvement of the solution.
• The complex task is divided into smaller sub-tasks for which
• Each client can access the BLACKBOARD to see if new inputs are
presented for further processing and to deliver results after
processing.
• Image and speech recognition application
• A control component monitors the blackboard and coordinates the
clients according to the state of the blackboard
– separate component,
– it may be part of the clients,
– the blackboard itself,
– or a combination of the above.
21
Overview: Patterns of the Layered,
Data Flow and Data-centered Views
22
4.Adaptation View
• In the Adaptation View the system is viewed as a core
part that remains invariable and an adaptable part that
either changes over time or in different versions of a
system. The concerns addressed by this view are:
– How can a system adapt better to evolution over time or to
multiple different versions of a basic architecture?
– What is the system functionality that is more likely to change
and what will possibly remain invariable?
– How do the invariable parts communicate with the adaptable
parts?
– How are the quality attributes of modifiability, reusability,
evolvability, and integrability supported?
1. Invariable components
2. Adaptable components(Variation points)
23
Adaptation View
Pattern: MICROKERNEL
• Consider a system family where different versions of a system need to
be supported.
• Nonetheless, the system family should be realized using a common
architecture to ease software maintenance and foster reuse.
• A MICROKERNEL realizes services that all systems, derived from the
system family, need and a plug-and-play infrastructure for the system-
specific services.
• Internal servers (not visible to clients) are used to realize version-
specific services and they are only accessed through the
MICROKERNEL.
• External servers offer APIs and user interfaces to clients by using the
MICROKERNEL.
24
Adaptation View
Pattern: REFLECTION
26
5.Language Extension View
• In the Language Extension View the system is viewed
as a part that is native to the software/hardware
environment and another part that is not. The
concerns addressed by this view are:
– How can a part of the system that is written in a non-
native language be integrated with the software system?
– How can the non-native part be translated into the native
environment?
– How are the quality attribute of portability and
modifiability supported?
• These communicate indirectly through another type of
component, an interpreter component that
“translates” the latter into the former.
27
Language Extension View
Pattern: INTERPRETER
• An INTERPRETER for the language is provided,
which provides both parsing facilities and an
execution environment.
• The program that needs to be interpreted is
provided in form of scripts which are
interpreted at runtime.
28
Language Extension View
Pattern: VIRTUAL MACHINE
• An efficient execution environment for a programming
language is needed. The architecture should facilitate
portability, code optimizations, and native machine
code generation
• Runtime interpretation of the language is not
necessarily required.
• A VIRTUAL MACHINE defines a simple machine
architecture on which not machine code but an
intermediate form called the byte-code can be
executed. The language is compiled into that byte-
code.
29
Language Extension View
Pattern: RULE-BASED SYSTEM
• Logical problems are hard to express
– an expert system that provides the knowledge of an expert or a
set of constraints
• Alternative for if-else statements
• It consists mainly of three things:
– facts,
• represent data
– Rules,
• Represent knowledge in form of a condition and associated actions
– an engine that acts on them
• A RULE-BASED SYSTEM applies its rules to the known facts.
• The actions of a rule might assert new facts, which, in turn,
trigger other rules.
30
Overview: patterns of the
Adaptation and Language Extension
View
31
6.User Interaction View
• In the User Interaction View the system is viewed
as a part that represents the user interface and a
part that contains the application logic,
associated with the user interface. The concerns
addressed by this view are:
– What is the data and the application logic that is
associated to the user interface?
– How is the user interface decoupled from the
application logic?
– How are the quality attributes of usability,
modifiability, and reusability supported?
32
User Interaction View
Pattern: MODEL-VIEW-CONTROLLER
33
User Interaction View
Pattern: PRESENTATION-ABSTRACTION-CONTROL
• An interactive system may offer multiple diverse functionalities that
need to be presented to the user through a coherent user interface.
1. the leaves of the tree are agents that are responsible for specific
functionalities
2. At the middle layers there are agents that combine the functionalities of
related lower-level agents to offer greater services;
3. at the top of the tree, there is only one agent that orchestrates the
middle-layer agents to offer the collective functionality.
• Each agent is comprised of three parts:
– A Presentation takes care of the user interface;
– An Abstraction maintains application data and the logic that modifies it;
– A Control intermediates between the Presentation and the Abstraction
and handles all communication with the Controls of other Agents.
34
User Interaction View
Pattern: C2
36