0% found this document useful (0 votes)
20 views56 pages

(Week7) Architecture 1

The document discusses software architecture, defining its importance in organizing systems into modules and facilitating stakeholder communication. It introduces various architectural patterns such as MVC, layered architecture, and lambda architecture, each with its own use cases, advantages, and disadvantages. Additionally, it emphasizes the need for multiple views in architectural design to address different stakeholder concerns and balance trade-offs in system characteristics.

Uploaded by

jingnan1412
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views56 pages

(Week7) Architecture 1

The document discusses software architecture, defining its importance in organizing systems into modules and facilitating stakeholder communication. It introduces various architectural patterns such as MVC, layered architecture, and lambda architecture, each with its own use cases, advantages, and disadvantages. Additionally, it emphasizes the need for multiple views in architectural design to address different stakeholder concerns and balance trade-offs in system characteristics.

Uploaded by

jingnan1412
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

SOEN 341

week 7

Architecture, and Design


Design

Architectural Component
design design

Persistence Interface
design design

2
What is software architecture?

Software architecture:
- Defines how the system is organized
- Breaks the entire system into a set of
communicating modules
- Creative process
- Aim is to satisfy the requirements!

3
What is software architecture?
Architecture in the small:
- At the “single system” level
- Defines how a program is broken down into
components/subsystems

Architecture in the large:


- At the “collection of systems” level
- Defines how a system of systems is broken
down into individual systems 4
What is software architecture?
Architecture in the small:
- At the “single system” level
- Defines how a program is broken down into
components/subsystems

Architecture in the large:


- At the “collection of systems” level
- Defines how a system of systems is broken
down into individual systems 5
Why do we need an architecture?
Stakeholder communication:
- Aid for system-level design
System analysis:
- If not discussed, implicit architecture may
be suboptimal, causing big problems later
Large-scale reuse:
- Systems with similar requirements can
reuse architectural components (e.g.,
subsystems, components) 6
Caution note
• In agile processes it is
accepted that an early
stage should focus on
designing an overall
system architecture.
• Incremental
development of
architectures is not
usually successful.
7
The architecture of a
robot control system

8
What are the semantics
of this diagram?

9
Semantics of block diagrams

10
But this is not very
specific!

11
The multi-faceted nature
of software architecture

System architecture needs to express:


- The decomposition into subsystems
- Process interactions
- The distribution of subsystems across
networked devices

12
Specifying all system characteristics in
one architecture model is impractical
Too many perspectives
for one diagram:
- If we attempt to
model everything in
one diagram, it
becomes a mess!

13
Instead, we can use several “views” of a
software architecture

14
4 + 1 view model of software
architecture
• A logical view, which shows the key abstractions
in the system as objects or object classes.
• A process view, which shows how, at run-time,
the system is composed of interacting processes.
• A development view, which shows how the
software is decomposed for development.
• A physical view, which shows the system
hardware and how software components are
distributed across the processors in the system.
• Related using use cases or scenarios (+1) 15
Krutchen’s 4+1 architectural views:

16
An example of logical view

17
An example of process view

18
An example of development view

19
An example of physical view

UML Deployment diagram example

20
What is the primary purpose of the "4+1"
architectural views in software
architecture?

A) To visualize system
security.
B) To describe software
deployment.
C) To understand the
physical hardware layout.
D) To address different
stakeholder concerns.

21
Purposes of architectural models
1. Aiding discussion of system-level design:
- Lightweight block diagrams are valuable
here because they are high-level enough to
be understood by all stakeholders

2. Documenting a system architecture:


- Block diagrams may be insufficient because
they don’t provide enough technical detail
22
Tradeoffs of lightweight vs.
formal architectural models
Lightweight (block):
- Valuable discussion aid
- Easy to produce
- Lacks the rigour needed for formal docs

Heavyweight (formal):
- Valuable for documentation purposes
- Expensive to produce
- Difficult for people to understand 23
How should we approach
architectural design?

24
Architectural design decisions

25
Maximizing non-functional system
characteristics with architectural design
Performance:
- Maximized by creating a small number of
large subsystems
Security:
- Maximized by layering systems with critical
assets protected in the innermost layer
Safety:
- Maximized by placing safety-related
operations in a small number of subsystems
26
Maximizing non-functional system
characteristics with architectural design
Availability:
- Maximized through redundant subsystems
to allow hot-swapping for updates
Maintainability:
- Maximized by creating a large number of
small, independent subsystems

27
Balancing tradeoffs in
architectural design
Performance:
- Maximized by creating a small
number of large subsystems
Maintainability:
- Maximized by creating a large
number of small, independent
subsystems

28
How can we get the most
out of our architecture?
Reuse successful
architectural designs!

29
What is an architectural pattern?

Architectural patterns/styles:
- Are abstract descriptions of tried-and-tested
solutions to common application problems
- Should describe when it is a good idea to
use and when it should be avoided!

30
Architectural pattern 1
Model View Controller (MVC)

31
Web application architecture using the
MVC pattern

32
Architectural pattern 1
Model View Controller (MVC)
Name MVC (Model-View-Controller)

Description Separates presentation and interaction from the system data. The
system is structured into three logical components that interact
with each other. The Model component manages the system data
and associated operations on that data. The View component
defines and manages how the data is presented to the user. The
Controller component manages user interaction (e.g., key presses,
mouse clicks, etc.) and passes these interactions to the View and
the Model.
When used Used when there are multiple ways to view and interact with
data. Also used when the future requirements for interaction and
presentation of data are unknown.
Advantages Allows the data to change independently of its representation
and vice versa. Supports presentation of the same data in different
ways with changes made in one representation shown in all of
them.
Disadvantages Can involve additional code and code complexity when the 33 data
model and interactions are simple.
Architectural pattern 2
Layered architecture

34
Example of a library system

35
Example of multi-layer systems

Application programs

Screen display
facilities Dealing with
application protocols
User account
User management Dealing with
interface connections
File
Application system Dealing with
logic packets
Kernel
Operating system Database Network (handling processes Transmitting
access access communication and swapping) and receiving

a) Typical layers in an b) Typical layers in an c) Simplified view of layers


application program operating system in a communication system

36
Architectural pattern 2
Layered architecture
Name Layered architecture
Description Organizes the system into layers with related functionality
associated with each layer. A layer provides services to the layer
above it so the lowest-level layers represent core services that
are likely to be used throughout the system.
When used Used when building new facilities on top of existing systems;
when the development is spread across several teams with
each team responsibility for a layer of functionality; when there
is a requirement for multi-level security.
Advantages Allows replacement of entire layers so long as the interface is
maintained. Redundant facilities (e.g., authentication) can be
provided in each layer to increase the dependability of the
system.
Disadvantages In practice, providing a clean separation between layers is
often difficult and a high-level layer may have to interact
directly with lower-level layers rather than through the layer
immediately below it. Performance can be a problem because
of multiple levels of interpretation of a service request as it is
37
processed at each layer.
Architectural pattern 3
Repository architecture

38
Architectural pattern 3
Repository architecture
Name Repository
Description All data in a system is managed in a central repository that is
accessible to all system components. Components do not interact
directly, only through the repository.
When used You should use this pattern when you have a system in which large
volumes of information are generated that has to be stored for a long
time. You may also use it in data-driven systems where the inclusion of
data in the repository triggers an action or tool.
Advantages Components can be independent—they do not need to know of the
existence of other components. Changes made by one component can
be propagated to all components. All data can be managed consistently
(e.g., backups done at the same time) as it is all in one place.
Disadvantages The repository is a single point of failure so problems in the
repository affect the whole system. May be inefficiencies in
organizing all communication through the repository. Distributing the
repository across several computers may be difficult. 39
Architectural pattern 4
Client-server architecture

40
Architectural pattern 4
Client-server architecture
Name Client-server

Description In a client–server architecture, the functionality of the system is


organized into services, with each service delivered from a separate
server. Clients are users of these services and access servers to make
use of them.
When used Used when data in a shared database has to be accessed from a range
of locations. Because servers can be replicated, may also be used
when the load on a system is variable.
Advantages The principal advantage of this model is that servers can be
distributed across a network. General functionality (e.g., a printing
service) can be available to all clients and does not need to be
implemented by all services.
Disadvantages Each service is a single point of failure so susceptible to denial of
service attacks or server failure. Performance may be unpredictable
because it depends on the network as well as the system. May be
management problems if servers are owned by different organizations.
41
Architectural pattern 5
Pipe-and-filter architecture

42
Architectural pattern 5
Pipe-and-filter architecture
Name Pipe and filter

Description The processing of the data in a system is organized so that each


processing component (filter) is discrete and carries out one type of
data transformation. The data flows (as in a pipe) from one component
to another for processing.
When used Commonly used in data processing applications (both batch- and
transaction-based) where inputs are processed in separate stages to
generate related outputs.
Advantages Easy to understand and supports transformation reuse. Workflow
style matches the structure of many business processes. Evolution by
adding transformations is straightforward. Can be implemented as
either a sequential or concurrent system.
Disadvantages The format for data transfer has to be agreed upon between
communicating transformations. Each transformation must parse its
input and unparse its output to the agreed form. This increases
system overhead and may mean that it is impossible to reuse
43
functional transformations that use incompatible data structures.
Example: Software compiler

• In the context of pipe and filter architecture, the compiler


can be viewed as a series of processing stages (filters)
connected by communication channels (pipes).
• Each stage performs a specific transformation or analysis
on the input data (source code), and the output of one
stage serves as the input to the next stage.
• For instance, lexical analysis, parsing, semantic analysis,
code generation, and optimization can each be considered
as separate filters in a pipeline.
• The focus here is on the sequential processing of data
through a series of interconnected filters.
44
Which architectures to choose for a
compiler?

A. MVC
B. Layered
C. Repository
D. Client-server
E. Pipe-and-filter

45
A repository architecture for a language
processing system

46
A pipe and filter compiler architecture

47
Data stream analysis
• Data stream: data that is continuously generated by
different sources (clients, other machines, etc.)

• Data stream analysis


• Update machine learning models to reflect dynamic changes
• Provide real-time changes to stakeholders

• Examples
• Computer network traffic
• Sensor data
• Stock market
• Online media (e.g., user clicks)
48
Lambda architecture

49
Lambda architecture

• Batch layer
• Provide more detailed data analysis by analyzing all data
• Output is often a read-only database (e.g., prediction
result)
• Speed layer (stream processing)
• Process data in real-time
• Provide real-time updates on the data (e.g., a dashboard)
• Serving layer
• Storing results from both batch and speed layer
• Allow users to query the results
50
Batch layer at X
• X’s batch layer is
responsible for
processing historical
data in large batches.
• Batch processing jobs
are executed
periodically to compute
batch views, aggregate
statistics, and generate
historical insights.
https://blog.twitter.com/engineering/en_us/a/2015/handling-five-billion-sessions-a-day-in-real-time.html

51
Speed layer at X
• The speed layer at X processes
real-time data streams to
provide up-to-date insights
and analytics. X uses the architecture to handle 5 billion
sessions per day in real-time (2015)
• Real-time processing tasks
include analyzing incoming
tweets, detecting trending
topics, identifying user
interactions, and performing
sentiment analysis in real-
time.
• The speed layer generates
incremental updates or views,
which are stored in a
distributed caching system
such as Apache Cassandra or
Redis.
52
Serving layer at X
• The serving layer integrates the results from both
the batch and speed layers to provide a unified
view of the data to users and applications.
• It combines batch views and real-time views to
serve queries and respond to user interactions in
near real-time.

53
Query interfaces at X
• X provides various query interfaces and APIs for
users, developers, and internal systems to interact
with the data stored in the serving layer.
• These interfaces enable users to search for tweets,
view trending topics, analyze user engagement
metrics, and access other insights derived from the
processed data.

54
Architectural pattern 6
Lambda architecture
Name Lambda architecture

Description It is a data processing design pattern that addresses the challenges of


processing and analyzing large volumes of data in real-time while
ensuring fault tolerance and reliability. It combines batch processing,
stream processing, and a serving layer to provide a comprehensive
and scalable solution
When used Commonly used in big data processing applications and real-time
data analysis systems.
Advantages It allows for horizontal scaling, enabling the processing of large
volumes of data.
It supports a wide range of data processing and analytics tools and
technologies.
It is resilient to hardware or software failures, ensuring data integrity
and availability.
Disadvantages Managing and maintaining multiple components can be challenging.
Implementing and managing both batch and real-time processing 55 can
be resource-intensive.
References
• Ch. 6, Sommerville, Ian. Software Engineering. 10th
edition. Pearson, 2016.

56

You might also like