Software Architecture Course Notes
Software Architecture Course Notes
Software Architecture Course Notes
Software Architecture | 2
TABLE OF CONTENTS
COURSE NOTES 1
Course Overview 4
Module 1: UML Architecture Diagrams 6
Architecture Overview and Process 6
Kruchten’s 4+1 View Model 8
Logical View 9
Process View 10
Development View 11
Physical View 11
Scenarios 11
Component Diagrams 12
Package Diagrams 14
Deployment Diagram 18
Activity Diagram 22
Module 2: Architectural Styles 25
Language-Based Systems 25
Abstract Data Types and Object Oriented Design 26
Main Program and Subroutine 27
Repository-Based Systems 30
Databases 31
Layered Systems 34
Client Server n-Tier 38
Interpreter-Based Systems 43
Dataflow Systems 45
Pipes and Filters 45
Implicit Invocation Systems 47
Event Based 47
Process Control Systems 51
Feedback Loops 51
Other Variations 52
Module 3: Architecture in Practice 55
Quality Attributes 55
Analyzing and Evaluating an Architecture 62
Availability Example 64
Architecture Trade-off Analysis Method 66
Relationship to Organizational Structure 72
Product Lines and Product Families 73
Implementing Product Lines 74
Reference Architecture 77
Course Resources 81
Course Resources 81
Glossary 82
Software Architecture | 3
COURSE OVERVIEW
This is the third course of the Software Design and Architecture
specialization brought to you in partnership by Coursera and the
University of Alberta. The first two courses of this specialization were
Object-Oriented Design and Design Patterns. The two courses
provide a foundation for this Software Architecture course,
although you can take each course separately.
Software Architecture | 4
Upon completion of this course, you will be able to:
Software Architecture | 5
MODULE 1: UML ARCHITECTURE DIAGRAMS
Software Architecture | 6
Some advantages of software architecture include:
Software Architecture | 7
Software architecture typically have the following stakeholders.
Each will have their own perspective.
Stakeholder Description
Software Software architecture helps developers create
developers and evolve software by providing strong
direction and organization on what needs to be
done.
End users Users may not care how the software is actually
designed, but they do care that it “works well”
for them.
Software Architecture | 8
Focusing on this functionality and the needed objects leads to a
perspective called the logical view.
Logical View
Software Architecture | 9
A class diagram establishes the vocabulary of the problem and
resulting system. By defining all of the classes, their attributes, and
their behaviours it becomes easy to understand the key abstractions
and terminology. Class diagrams are also useful for specifying
database schemes. The class diagram makes it easier to see how
classes interact and how data should relate to each other in a
database.
Process View
Software Architecture | 10
Development View
Physical View
The physical view handles how elements in the logical, process, and
development views must be mapped to different nodes or
hardware for running the system.
Scenarios
Scenarios align with the use cases or user tasks of a system and
show how the four other views work together.
Software Architecture | 11
Component Diagrams
Software Architecture | 12
Finally, component diagrams can
illustrate an assembly relationship. An
assembly relationship occurs when one
component’s provided interface matches
another component’s required interface.
The provided interface is depicted by a
ball, and the required interface is
depicted by a socket.
Software Architecture | 13
Package Diagrams
Software Architecture | 14
Packages are depicted by tabbed folders. If there are no elements
to show in the package, then the package name goes into the
centre of the folder. If details are needed, there are two ways this
can be expressed.
Software Architecture | 15
Notice in the above example that plus (+) and minus (-) signs have
been used to indicate if elements are public or private. Public
elements can be accessed outside of the package by their fully
qualified names. Relationships are denoted through dotted-line
arrows.
Software Architecture | 16
Packages can also be merged, as in the diagram below. Merging
typically occurs when two packages or concepts need to come
together into one. This is a use of generalization that allows different
definitions to be provided for the same concept.
Software Architecture | 17
The bonus relationship is also special because it has a uses
relationship with a normal level. The uses relationship implies that
the bonus level requires a normal level for its full implementation. If
there is no definition for level, there cannot be a definition for bonus
level.
Deployment Diagram
• specification-level diagrams
• instance level diagrams
Software Architecture | 18
A specification-level diagram provides an overview of artifacts and
deployment targets, without referencing specific details like
machine names. It focuses on a general overview of your
deployment rather than the specifics.
Software Architecture | 19
Manifestation is a relationship where an artifact is a physical
realization of a software component. It can be represented with a
“manifests” indicator, as below.
Software Architecture | 20
In a deployment diagram, there is a distinct hierarchy of
deployment targets. This hierarchy is very important. You should
start from the highest level of your deployment information, from
application name down to device and operating system. In this
example, the application, the device, the operating system, and the
execution environment are all listed. When you look at each of these
nodes, it is clear what environment is necessary to run the
application.
Note that only the most important artifacts are represented in this
diagram so that it is kept at a high level. Remember, deployment
diagrams provide a high-level overview of artifacts, libraries, main
components, machines, and devices that your application needs to
run.
Software Architecture | 21
Activity Diagram
There are start and end notes that look like labelled circles. These
circles are where the diagram must begin. They show the starting
activity that initializes the control flow of the application. The end
node shows the final activity of the diagram. Intermediate activities
are shaped like an oval, and they describe all of the activities that
change the game state before the game ends.
Software Architecture | 22
All essential activities must be included in a diagram as well as the
conditions.
Software Architecture | 23
In this example, the activity diagram begins by playing the game.
The player then plays the level activity. When the level is complete,
the player encounters the first condition. If the score is high enough,
then the player may move on to the bonus level. If the player cannot
play the bonus level, then the game is ended, as denoted by a
circle.
Software Architecture | 24
MODULE 2: ARCHITECTURAL STYLES
Language-Based Systems
Software Architecture | 25
In previous courses, the following object-oriented principles were
explored:
Software Architecture | 26
Objects may interact with each other through the use of their
methods. The object-oriented paradigm allows for inheritance
among abstract data types. This means that one abstract type can
be declared an extension of another type.
Instructor’s Note:
For a review on object-oriented thinking, see the Object-
Oriented Design course of Software Design and
Architecture specialization.
Note that for this section, the terms routine, procedure, and function
are used interchangeably with the term subroutine.
Software Architecture | 27
The diagram above represents a main program and subroutine
architectural style. In the diagram, subroutines are connected by
procedure calls, and they may have nested calls. In nested calls,
subroutines may call other subroutines, which may call yet more
subroutines, and so on. This means that the structure of the
resulting code is not flat, but rather it is hierarchical, so it can be
modelled as a directed graph. The structure of the subroutines that
build up the system affect the structure of the system as a whole.
The subroutines declared in the code are structure as a big “call
tree.”
Software Architecture | 28
Each subroutine may have its own local variables. A subroutine has
access to all data within its scope. To access data outside its scope,
data may be passed into the subroutines as parameters, by value or
by reference, and data may be passed out of a subroutine as a
return value.
Software Architecture | 29
Repository-Based Systems
Software Architecture | 30
Below is a diagram of a data-centric software architecture.
Databases
Software Architecture | 31
Relational databases use Structured Query Language (SQL) to
query or “ask” the database for information and to perform
transactions or “tell” the database to do something. These abilities
allow for information to be shared through a database between
data accessors.
Software Architecture | 32
Data-centric architecture presents many advantages over a basic
object-oriented system, because of the integration of a centralized
database. These advantages include:
Software Architecture | 33
In summary, data-centric software architecture is a commonly used
design by many companies. They allow large amounts of data to be
stored and managed in a central data repository, making a system
more stable, reusable, maintainable, and exhibit better
performance. They also separate the functionality of data accessors,
so it is easier to scale the system. Finally, they also facilitate data
sharing between data accessors through database queries and
transactions.
Layered Systems
In this diagram, there are three groups, which are the three layers of
the organization. People in the adjacent layers interact. So, students
and the principal only interact with one layer—the teachers, while
teachers interact with two adjacent layers—students and the
principal. People in each layer can also interact with each other. So,
teachers can also interact with other teachers.
Software Architecture | 34
Usually, the inner or bottom layer provides services or abstractions
for the layer outside or above it. The interfaces provided by the
components of a layer should be well defined and driven by the
needs of the system.
The kernel is the core of the operating system. One of its main
responsibilities is to interface with the hardware and allocating
resources. Above the kernel layer is the system and application
libraries layer. This layer provides the higher-level functions for
saving files or drawing graphics. Above this layer is the utilities and
applications layer, which to most users is the operating system.
Utilities are tools included with the operating system, such as
command-line programs. Applications are additional programs,
often installed by the user for specific needs.
Software Architecture | 35
Advantages of layered systems include the fact that:
Software Architecture | 36
The diagram would be reworked as below:
Some layered systems may have more than one grouping in a layer.
Software Architecture | 37
In summary, layered architecture:
A tier can act as both a server and a client, fulfilling the requests of
its clients and making requests of its servers at the same time.
Software Architecture | 38
Consider the deployment diagram below, illustrating the setup of a
simple media server.
One computer hosts the media server process, where movies and
TV shows are stored and can be streamed on demand. When a
client requests a movie or TV show, the media server streams it to
the client. The server process does not know the number of clients it
may have. More clients can be added as necessary.
Instructor’s Note:
A server is usually specified by the type of service it
provides. For example, these servers might be called web
servers, application servers, file servers, and print servers.
Software Architecture | 39
The client, in this case, a media player, requests to see what the
media server has in its library. The server sends that information
back. After the user makes a selection, the client requests the
chosen video from the media server, which starts streaming it.
Software Architecture | 40
Client requests are often designed to run asynchronously, because
it is often preferable to have clients be responsive for other tasks
even if they are waiting for information from the server.
You could add even more tiers to your architecture if you want, as
long as the tiers serve a specific relationship.
Software Architecture | 41
Two potential drawbacks of n-Tier architecture include:
When a system can be split into service roles and request roles, a
client/server architecture should be considered.
Software Architecture | 42
Interpreter-Based Systems
Interpreters can run scripts and macros. Scripts are often used for
automating common tasks, such as scheduling tasks, performing
repetitive actions, and composing complex tasks that invoke other
commands. Macros are an evolution of scripts that became popular
with the introduction of graphical user interfaces. A macro records
keyboard and mouse inputs, so they may be executed later.
Software Architecture | 43
Interpreter-based systems offer certain advantages. In particular,
interpreters make systems more portable, so they can work on
platforms that the interpreter supports. This is an important feature
with the growth of virtual machines and virtual environments—more
and more services are being hosted in the cloud.
Software Architecture | 44
Dataflow Systems
This section will explore designing a data flow system through the
pipe and filter architectural style, a specific type of data flow
architecture.
The order in which the filters transform data may change the end
result. This is similar to mathematics—the order in which addition or
multiplication occurs in an expression can change the end result.
Software Architecture | 45
UML component diagrams are a good option for showing the
details of pipe and filter architecture.
• Reusability. Each filter can be called and used over and over
again with different inputs. Filters can be repeatedly used in
many different applications for different purposes.
Software Architecture | 46
• This architecture cannot be used for interactive applications.
Applications that require rapid responses will not find this
architecture suitable, as data transfers and transformations
take time depending on the amount of data being
transmitted.
Pipe and filter architectures are popular in use, such as in the UNIX
operating system for text-based utilities. If different data sets need
to be manipulated in a system, the pipe and filter architecture is a
good choice.
Event Based
Software Architecture | 47
When the event bus detects an event, it distributes the event to all
appropriate event consumers. The event bus is a critical part of the
system. The observer design pattern actually manifests the event-
based architectural style.
Software Architecture | 48
Functions can be coordinated for access to shared data through a
semaphore. A semaphore is a variable or abstract data type that
toggles between two values, available and unavailable, and that is
used to control access to shared data. Available indicates that the
shared data is not in use, and unavailable indicates that the shared
data is in use by a function.
Software Architecture | 49
This icon has a functionality—it will purchase a special automatic
clicker that automatically clicks the cookie at regular time intervals,
thus reducing work on the user’s part to collect points. Users can
“purchase” multiple cursors at the cost of some points.
A main event loop listens for event. Depending on where users click
within the window, a different event consumer will be invoked.
When the cookie is clicked, the function registered to handle this
click event is called and total points increases by one. When the
“buy clicker” icon is clicked, then the function registered to handle
this click event is called. This first reduces the score, as a purchase
was made. Then, an automatic clicker function is added to the
system, along with a timer function.
Software Architecture | 50
Process Control Systems
Feedback Loops
The frequency, or how often the loop runs, depends on the desired
level of control and the sensitivity of the system. For example, room
temperature changes slower compared to other processes, so it is
not necessary or useful to have a high frequency, such as every
microsecond.
Software Architecture | 51
Other Variations
More complex problems will have many sensors and ways to control
the process. Process control architecture for complex problems will
therefore be more complex. Below is a diagram for a complex
example of a self-driving car.
Software Architecture | 52
This architecture is based on a MAPE-K structure, which has four
major steps: monitor, analyze, plan, and execute. All four of these
steps must have knowledge of the process.
Step Description
Monitor The component or collection of components that
interfaces with sensors, turning raw signals into
meaningful information for the software.
Analyze The software must next analyze this data. Data could be
integrated from several sensors, so analysis might be
quite sophisticated. More sophistication generally
requires a better model of the process.
Software Architecture | 53
Knowledge is very important in MAPE-K systems, particularly
complex ones. Currently, technology companies are investing
heavily in such systems, due to the advent of machine learning and
big data. This investment goes towards real-world testing, machine
learning, and data modelling in order to operate these systems.
Effective software architecture is key. Even though it is handled by
specialized professionals, it is important to be aware of process
control. Software is becoming a bigger part of controlling physical
systems.
Software Architecture | 54
MODULE 3: ARCHITECTURE IN PRACTICE
Quality Attributes
Software Architecture | 55
Individual design patterns and principles are concerned primarily
with functional software issues, while software architecture
considers functional and non-functional requirements. Software
architecture must address the big picture. Architecture sets
guidelines for design patterns and principles in order to ensure
conceptual integrity and consistency throughout.
Software Architecture | 56
If system architectures are not measured as inherently good or bad,
there must be a way to determine if the architectural design is
capable of meeting system requirements. This quality of a system is
determined by quality attributes. Quality attributes are measurable
properties of a system used to gauge a system’s design, run-time
performance, and usability.
Software Architecture | 57
Quality Measurement of
Attribute
Maintainability The ease at which your system is capable of
undergoing changes.
Software Architecture | 58
In addition to qualities to account for from a developer’s
perspective, it is also necessary to take into consideration qualities
from a user’s perspective. The table below covers some of these
quality attributes and what they are measuring.
Quality Measurement of
Attribute
Availability The amount of time the system is operational over a
set period of time.
Software Architecture | 59
Performance The system’s throughput and latency in response to
user commands and events.
Software Architecture | 60
A high-quality system does not need to be “complex.” An overly
complex system makes it difficult and time consuming to produce. It
is good practice to try to minimize complexity in the design. If a
simpler architecture can satisfy all the system requirements and
achieve a high-quality design while needing less time and less
money, it makes sense to go with that.
Software Architecture | 61
Structural rules that ensure there is conceptual integrity when
implementing the system include:
Software Architecture | 62
In order to measure quality attributes, quality attribute scenarios
can be used to determine if a system is able to meet requirements
set for the attribute. There are two kinds of scenarios:
Software Architecture | 63
Scenarios are built to identify situations that impact the quality
attributes of a system. In the context of analyzing and evaluating
architecture, you should focus on situations that are outside of the
normal execution path. This means that scenarios involving
incorrect input, heavy system loads, or potential security breaches
should be prioritized highly.
Availability Example
Software Architecture | 64
Below is an example of a general availability scenario.
Concrete scenarios are more focused. They can help you test an
architecture with a specific stimulus under specific system
environments and measure how well the system can respond.
Software Architecture | 65
Let us expand our example on availability. Availability of a web
server can be hindered in its ability to process requests when at
resource limits or under heavy load. A server’s availability should be
measured under different conditions.
Software Architecture | 66
There are three different groups of participants in ATAM.
Software Architecture | 67
Scenarios can then be analyzed, resulting in an evaluation of the
system, which includes trade-offs, sensitivity points, non-risk
scenarios, and risk scenarios. Since the risk scenarios have a
negative impact on the quality of the system, each of them are
analyzed and categorized into “risk themes.”
The entire ATAM process itself can be broken down into nine steps.
Software Architecture | 68
3. Present the architecture.
Both current and expected state of the architecture is
presented as well as constraints such as time, cost, difficulty
of the problem, and quality expectations.
Software Architecture | 69
In quality attribute trees, ASRs are given priority values to
denote if they are “must-haves” or not. The example above
uses high (H), medium (M), and low (L) designations, but
these values could differ from system to system.
Software Architecture | 70
Scenarios are prioritized based on importance to each
stakeholder, and the evaluation team compares the list with
the prioritized ASRs in the utility tree. If the priorities of the
stakeholders match closely with the priorities in the utility
tree, then there is good alignment.
Software Architecture | 71
Modern systems are becoming more and more complex, and
creating an architecture that can achieve all the requirements for
quality attributes is becoming increasingly important. Being able to
evaluate and analyze architectures helps successfully create high-
quality systems.
This study supports Conway’s Law. This law states that a software
system will tend to take a form that is congruous to the organization
that produced it.
Software Architecture | 72
When putting together a team of developers, it is a good idea to
first plan the architecture that works best for the system and
organize the team around that architecture. For example, if you are
building a web application using the n-Tier architecture, you could
have one team for the data backend, one team for the application
logic layer, and one for the presentation tier.
Conway’s Law may entail extra work to provide unified and scalable
architectures. There may be need of a team whose purpose is to
consolidate and enforce common services across the whole system.
Instructor’s Note:
Even though Conway’s Law is called a “law,” it is actually
more of an observation that can be stretched or broken in
some situations. Even so, it is helpful to be aware of the law
and the implications it holds for putting together a team of
developers or software architecture.
Software Architecture | 73
Product lines present several advantages:
1. Commonalities
The features that stay the same in every product should be
identified.
2. Variations
The features of the product line that vary between products
should be identified. For example, for a line of tablets, a
variation could be support for different cellular network
connections.
Software Architecture | 74
3. Product specifics
The features that are unique to one and only product should
be identified. These features will be developed by the team
that is responsible for that product. For example, maybe one
of the tablets developed will also specialize in reading
eBooks. Its product specifics could be additional tools for
managing eBooks and support for an eInk section.
Software Architecture | 75
Once these considerations are established, you can turn to
development of product lines. Product line development teams are
generally divided into two camps:
Software Architecture | 76
Reference Architecture
Software Architecture | 77
The reference architecture must:
Software Architecture | 78
Replacement technique. In this technique, there could be a default
component that is replaced with alternatives to realize variation.
There may not even be a default; instead there is a gap in the
system, and the developers must supply one of the components.
See below for a diagram of a replacement technique.
Software Architecture | 79
Variations can be realized at different times. Different variations may
even come in at different stages—they can be formed early on,
during the design or development process of the application
engineering team, or they can be formed when the software is
compiled and built. Similarly, variations can be realized at different
times, like when the software is launched or after the software is
launched, whenever they are needed.
Software Architecture | 80
COURSE RESOURCES
Course Resources
Software Architecture | 81
Glossary
Word Definition
Abstract data type A data type that is defined by the programmer and
not built into the language. It is a grouping of related
information that is denoted with a type, which allows
data to be organized in a meaningful way.
Software Architecture | 82
Availability The amount of time the system is operational over a
set period of time.
Behavioural design Patterns that focus on how objects distribute work and
how they collaborate together to achieve a common
patterns
goal.
Conway’s Law A law that states that a system will tend to take a form
that is congruous to the organization that produced it.
Software Architecture | 83
Data flow A system architecture that considers the system as
simply a series of transformation on sets of data.
architecture
Data persistence The assurance that data will live on after a process has
been terminated.
Software Architecture | 84
Event generators Also known as event consumers. Event generators
send events, and event consumers receive and
process these events.
Software Architecture | 85
Interoperability The ability of your system to understand
communications and share data with external systems.
Software Architecture | 86
Packageable Elements that can be packaged together, including
data, classes, or even other packages.
elements
Pipe and filter A type of data flow architecture that has filters that
perform transformations on data input they receive
architecture
and pipes that serve as connectors for the stream of
data being transformed.
Software Architecture | 87
Quality attribute A scenario used to determine if a system is able to
meet the requirements that were set for the quality
scenarios
attributes.
Software Architecture | 88
Separation of A principle of software design, which suggests that
software should be organized so that different
concerns
concerns in the software are separated into different
sections and addressed effectively.
Software Architecture | 89
UML activity A UML diagram that represents the control flow from
one activity to another in a software system.
diagram
Software Architecture | 90