PDF Software Architecture Patterns Understanding Common Architectural Styles and When to Use Them 2nd Edition Mark Richards download
PDF Software Architecture Patterns Understanding Common Architectural Styles and When to Use Them 2nd Edition Mark Richards download
com
https://ebookmeta.com/product/software-architecture-
patterns-understanding-common-architectural-styles-and-when-
to-use-them-2nd-edition-mark-richards/
OR CLICK BUTTON
DOWNLOAD NOW
https://ebookmeta.com/product/flame-carmichael-family-5-1st-edition-
adriana-locke/
ebookmeta.com
https://ebookmeta.com/product/whole-lotta-grump-grumps-unleashed-
book-3-1st-edition-cassie-mint/
ebookmeta.com
https://ebookmeta.com/product/island-love-aloha-love-1st-edition-
imani-jay/
ebookmeta.com
https://ebookmeta.com/product/ash-daddies-of-the-shadows-book-2-1st-
edition-kate-oliver-2/
ebookmeta.com
https://ebookmeta.com/product/a-psychology-of-user-experience-
involvement-affect-and-aesthetics-2nd-edition-phil-turner/
ebookmeta.com
Death by Identity Theft Second Edition Ken Buckler
https://ebookmeta.com/product/death-by-identity-theft-second-edition-
ken-buckler/
ebookmeta.com
SECOND EDITION
Software Architecture
Patterns
Understanding Common Architectural
Styles and When to Use Them
Mark Richards
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Software Architec‐
ture Patterns, the cover image, and related trade dress are trademarks of O’Reilly
Media, Inc.
While the publisher and the author have used good faith efforts to ensure that
the information and instructions contained in this work are accurate, the publisher
and the author disclaim all responsibility for errors or omissions, including without
limitation responsibility for damages resulting from the use of or reliance on this
work. Use of the information and instructions contained in this work is at your
own risk. If any code samples or other technology this work contains or describes is
subject to open source licenses or the intellectual property rights of others, it is your
responsibility to ensure that your use thereof complies with such licenses and/or
rights.
978-1-098-13427-3
[LSI]
Table of Contents
1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
3. Layered Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Description 15
Key Concepts 17
Examples 20
Considerations and Analysis 21
4. Microkernel Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Topology 25
Examples 27
Considerations and Analysis 29
5. Event-Driven Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Topology 33
Example Architecture 35
Event-Driven Versus Message-Driven 37
Considerations and Analysis 38
6. Microservices Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Basic Topology 43
What Is a Microservice? 45
Bounded Context 45
iii
Unique Features 47
Examples and Use Cases 48
Considerations and Analysis 49
7. Space-Based Architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Topology and Components 56
Examples 60
Considerations and Analysis 61
iv | Table of Contents
CHAPTER 1
Introduction
1
system. The second edition of the report addresses both of these
advances.
The second edition also includes other significant enhancements,
along with more information about the intersection of architecture
and data, and an expanded analysis section at the end of each chap‐
ter. These new sections provide you with better guidelines for when
to use (and not to use) each architecture presented in this report.
Another change you’ll notice in the second edition is the use of
the term architecture style rather than architecture pattern for the
architectures described in this report. This distinction helps alleviate
some of the confusion surrounding the differences between, say,
event-driven architecture—an architecture style—and something
like CQRS (Command Query Responsibility Segregation), which is
an architecture pattern.
An architecture style, such as the ones presented in this report,
describe the macro structure of a system. Architecture patterns, on
the other hand, describe reusable structural building block patterns
that can be used within each of the architecture styles to solve a par‐
ticular problem. Take, for example, the well known CQRS pattern,
which describes the structural separation between read and write
operations to a database or eventing system (for example, separate
services and databases for read operations and write operations).
This architecture pattern could be applied to any of the architecture
styles described in this report to optimize database queries and
updates.
Architecture patterns, in turn, differ from design patterns (such as
the Builder design pattern) in that an architecture pattern impacts
the structural aspect of a system, whereas a design pattern impacts
how the source code is designed. For example, you can use the
Builder design pattern as a way to implement the CQRS architecture
pattern, and then use the CQRS pattern as a building block within
a microservices architecture. Figure 1-1 shows this hierarchical rela‐
tionship among the three terms and how they interrelate with each
other to build software systems.
2 | Chapter 1: Introduction
Figure 1-1. Architecture styles can be composed of architecture pat‐
terns, which in turn can be composed of design patterns
Introduction | 3
CHAPTER 2
Architectural Structures and Styles
Architecture Classification
Architecture styles are classified as belonging to one of two main
architectural structures: monolithic (single deployment unit) and
distributed (multiple deployment units, usually consisting of serv‐
ices). This classification is important to understand because as a
group, distributed architectures support much different architecture
characteristics than monolithic ones. Knowing which classification
of architecture to use is the first step in selecting the right architec‐
ture for your business problem.
Monolithic Architectures
Monolithic architecture styles (as illustrated in Figure 2-1) are gen‐
erally much simpler than distributed ones, and as such are easier to
design and implement. These single deployment unit applications
are fairly inexpensive from an overall cost standpoint. Furthermore,
most applications architected using a monolithic architecture style
5
can be developed and deployed much more quickly than distributed
ones.
While cost and simplicity are the main strong points of a monolithic
architecture, operational characteristics such as scalability, fault tol‐
erance, and elasticity are its weak points. A fatal error (such as an
out of memory condition) in a monolithic architecture causes all
of the functionality to fail. Furthermore, mean time to recovery
(MTTR) and mean time to start (MTTS) are usually measured in
minutes, meaning that once a failure does occur, it takes a long time
for the application to start back up. These long startup times also
impact scalability and elasticity. While scalability can sometimes be
achieved through load balancing multiple instances of the applica‐
tion, the entire application functionality must scale, even if only a
small portion of the overall application needs to scale. This is not
only inefficient, but unnecessarily costly as well.
Examples of monolithic architecture styles include the layered
architecture (described in Chapter 3), the modular monolith, the
pipeline architecture, and the microkernel architecture (described in
Chapter 4).
Architecture Classification | 7
Agility (the ability to respond quickly to change) is often another
superpower of distributed architectures. Because application func‐
tionality is divided into separately deployed units of software, it is
easier to locate and apply a change, the testing scope is reduced
to only the service that is impacted, and deployment risk is sig‐
nificantly reduced because only the service impacted is typically
deployed.
Unfortunately, with all those good features come some bad features
as well. Distributed architectures are plagued with what are known
as the fallacies of distributed computing, a set of eight things we
believe to be true about networks and distributed computing, but
are in fact false. Things like “the network is reliable,” “bandwidth is
infinite,” and “latency is zero” all make distributed architectures not
only hard to keep deterministic, but also hard to make completely
reliable. Networks do fail, bandwidth is not infinite, and latency is
not zero. These things are as real today as they were back in the
late ’90s when they were coined.
In addition to the eight fallacies of distributed computing, other
difficulties arise with distributed architectures. Distributed transac‐
tions, eventual consistency, workflow management, error handling,
data synchronization, contract management, and a host of other
complexities are all part of the world of distributed architecture. To
top it off, all this complexity usually means much more cost from an
overall initial implementation and ongoing maintenance cost than
monolithic architectures. Suddenly, all of those great superpowers
don’t sound so great anymore when you consider all the trade-offs of
distributed architectures.
Examples of distributed architectures include event-driven archi‐
tecture (described in Chapter 5), the ever-popular microservices
architecture (described in Chapter 6), service-based architec‐
ture, service-oriented architecture, and space-based architecture
(described in Chapter 7).
Architecture Partitioning
Besides being classified as either monolithic or distributed, architec‐
tures can also be classified by the way the overall structure of the
system is partitioned. Architectures, whether they are monolithic
or distributed, can be either technically partitioned or domain par‐
titioned. The following sections describe the differences between
these partitioning structures and why it’s important to understand
them.
Technical Partitioning
Technically partitioned architectures have the components of the
system organized by technical usage. The classic example of a techni‐
cally partitioned architecture is the layered (n-tiered) architecture
style (see Chapter 3). In this architecture style, components are
organized by technical layers; for example, presentation components
that have to do with the user interface, business layer components
that have to do with business rules and core processing, persistence
layer components that interact with the database, and the database
layer containing the data for the system.
Notice in Figure 2-3 that the components of any given domain are
spread across all of these technical layers. For example, the customer
domain functionality resides in the presentation layer as customer
screens, the business layer as customer logic, the presentation layer
as customer queries, and the database layer as customer tables.
Manifested as namespaces, these components would be organized
Architecture Partitioning | 9
as follows: app.presentation.customer, app.business.customer,
app.persistence.customer, and so on. Notice how the second
node in the namespace specifies the technical layering, and that the
customer node is spread across those layers.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.