Software Architecture by Example v1 Smaller
Software Architecture by Example v1 Smaller
?
O'Reilly Online Training
Neal Ford
ThoughtWorks
Director / Software Architect / Meme Wrangler
http://www.nealford.com
@neal4d
v1
introduction
course agenda
course references
https://www.safaribooksonline.com/library/view/
software-architecture-fundamentals/
9781491998991/
Your Architectural Kata is...
reliability
scalability
performance
availability
architecture characteristics
accessibility evolvability repeatability
accountability extensibility reproducibility
accuracy failure transparency resilience
adaptability fault-tolerance responsiveness
administrability fidelity reusability
affordability flexibility robustness
agility inspectability safety
auditability installability scalability
autonomy integrity seamlessness
availability interchangeability self-sustainability
compatibility interoperability serviceability
composability learnability supportability
configurability maintainability securability
correctness manageability simplicity
credibility mobility stability
customizability modifiability standards compliance
debugability modularity survivability
degradability operability sustainability
determinability orthogonality tailorability
demonstrability portability testability
dependability precision timeliness
deployability predictability traceability
discoverability process capabilities transparency
distributability producibility ubiquity
https://en.wikipedia.org/wiki/List_of_system_quality_attributes
durability provability understandability
effectiveness recoverability upgradability
architecture characteristics
feasibility
agility
elasticity
scalability
architecture katas
identifying driving characteristics
Your Architectural Kata is...
?
◦ participants must be tracked via a reputation index
• Additional Context:
◦ auction company is expanding aggressively by merging with smaller competitors
◦ if nationwide auction is a success, replicate the model overseas
◦ budget is not constrained--this is a strategic direction
◦ company just exited a lawsuit where they settled a suit alleging fraud
users
time
elasticity:
users
time
Your Architectural Kata is...
{
◦ accept payment online or in person/on delivery scalability elasticity
• Additional Context: location
◦ Sandwich shops are franchised, each with a different owner.
◦ Parent company has near-future plans to expand overseas. Customizability sales
◦ Corporate goal is to hire inexpensive labor to maximize profit. recipe
◦ Time to market is critical.
Your Architectural Kata is...
{
◦ accept payment online or in person/on delivery scalability elasticity
• Additional Context: location
◦ Sandwich shops are franchised, each with a different owner.
◦ Parent company has near-future plans to expand overseas. Customizability sales
◦ Corporate goal is to hire inexpensive labor to maximize profit. recipe
◦ Time to market is critical.
building
evolutionary
architectures
Evolutionary
Architecture
An evolutionary architecture supports
guided,
incremental change
across multiple dimensions.
guided
Naming conventions
Postel’s Law
maintainable?
(incoming/outgoing)
Controlled afferent/efferent coupling
ArchUnit
https://www.archunit.org/
ArchUnit
https://www.archunit.org/
coding rules
ArchUnit
interface rules
ArchUnit
layer dependency
ArchUnit
governance
Legality of Open Source Libraries
Penultima ︎e
Legality of Open Source Libraries
Penultima ︎e
Legality of Open Source Libraries
Penultima ︎e
Legality of Open Source Libraries
Penultima ︎e
Legality of Open Source Libraries
Penultima ︎e
component-
based
thinking
component identification
as an architect, you should think about the artifacts
within the architecture in terms of components
component component
component:
building block of the application
well defined set of operations
component
well defined role and responsibility
component component
component identification
component scope
refactor
components as
needed
component identification
identify initial components using core functionality
order fulfillment
order shipping
component identification
assign requirements, use cases, or user
stories to a component
order fulfillment
order shipping
component identification
assign requirements, use cases, or user
stories to a component
order shipping
component identification
assign requirements, use cases, or user
stories to a component
order shipping
component identification
assign requirements, use cases, or user
stories to a component
of order status
component identification
assign requirements, use cases, or user
stories to a component
of order status
customer notification
component identification
component granularity
order manager
auction
auctions
manager items bids
create aution
browse auctions
schedule auction
Your Architectural Kata is...
auction item
auctions
manager items
manager
bids
auction item
auctions
manager items
manager
bid bids
manager
view live video stream enter live bids into system start auction
view live bid stream receive online bid make payment
place a bid mark item as sold track bidder activity
Your Architectural Kata is...
start auction
make payment
system track bidder activity
Your Architectural Kata is...
start auction
make payment
system track bidder activity
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
auto
payment
Your Architectural Kata is...
auction
start auction session
make payment
system track bidder activity bidder
tracker
auto
payment
Your Architectural Kata is...
auctioneer bidder
bidder
tracker
auto
payment
Your Architectural Kata is...
auctioneer bidder
bidder
tracker
auto
payment
Your Architectural Kata is...
auctioneer bidder
bidder
tracker
auto
payment
Your Architectural Kata is...
auctioneer bidder
bidder
tracker
auto
payment
Your Architectural Kata is...
auctioneer bidder
bidder
tracker
auto
payment
Your Architectural Kata is...
auctioneer bidder
bidder
tracker
auto
payment
Your Architectural Kata is...
location
order payment
local
global
info
promotion
global local
product
delivery
standard local
inventory inventory
order location
info info
local
recipes
recipes
Your Architectural Kata is...
local
recipes
recipes local
local
location promotion
inventory
purchase
order payment
global
delivery standard
location promotion
inventory
order location
info info
architectural quantum
An architectural quantum is an
independently deployable component with
high functional cohesion, which includes all
the synchronously coupled structural
elements required for the system to
function.
architectural quantum
layered monolith
architectural quantum?
Architectural characteristics live at
the quantum level.
reliability
scalability
performance
availability
Your Architectural Kata is...
location
order payment
local
global
info
promotion
global local
product
delivery
standard local
inventory inventory
order location
info info
local
recipes
recipes
Your Architectural Kata is...
auctioneer bidder
bidder
tracker
auto
payment
architecture
patterns
architectural quantum
Architectural characteristics live at
the quantum level.
Q
u
a
n
t
u
m
architectural quantum
Architectural characteristics live at
the quantum level.
Q
u
a
n
t
u
Q
u
a
m
n
t
u
m
architecture patterns help define the basic
characteristics and behavior of an application
persistence layer
api layer
system
level
microservices architecture
architectural quanta
sub-system level
microservices architecture
architectural quanta
micro front-end ui ui ui ui ui ui ui ui
service level
microservices architecture
drivers
modularity
agility
fault-tolerance
scalability
testability
deployability
evolvability
microservices architecture
agility deployment testability performance scalability simplicity cost
persis
tence
layer
service-based architecture
client requests client requests client requests
modularity
agility
fault-tolerance
scalability
testability
deployability
simplicity / cost
evolvability
service-based architecture
agility deployment testability performance scalability simplicity cost
persis
tence
layer
layered architecture
layered architecture
drivers
simplicity
cost
layered architecture
agility deployment testability performance scalability simplicity cost
persis
tence
layer
types of monoliths
“big ball
of mud”
unstructured
monolith
layered
architecture
modular monolith
types of monoliths
technical partitioning
layered
architecture
modular monolith
types of monoliths
layered
architecture
modular monolith
layered architecture
agility deployment testability performance scalability simplicity cost
persis
tence
layer
layered architecture
agility deployment testability performance scalability simplicity cost
D
D
persis
tence
layer
layered architecture
agility deployment testability performance scalability simplicity cost
D
D
T persis
tence
layer
event-driven architecture
event
processor
event
event module module
channel event
module module
event event
processor processor
module module
event module module
module module
channel module module
event event
processor processor
module module
event module module
module module
channel module module
event-driven architecture
mediator topology
event
event
event
queue
mediator
event
module module module module module module module module module module
event-driven architecture
drivers
modularity
agility
fault-tolerance
scalability
performance
elasticity
adaptability
evolvability
event-driven architecture
agility deployment testability performance scalability simplicity cost
D
D
T persis
tence
layer
T
pipeline architecture
a.k.a. pipes and filters architecture
pipe pipe
producer transformer transformer
pipe
pipe
consumer tester
pipeline architecture
drivers
modularity
simplicity
cost
agility
adaptability
evolvability
pipeline architecture
agility deployment testability performance scalability simplicity cost
D
D
T persis
tence
layer
T
T
microkernel architecture
core
plug-in component plug-in component
system
plug-in component plug-in component
microkernel architecture
drivers
modularity evolvability
simplicity agility
cost testability
adaptability deployability
microkernel architecture
agility deployment testability performance scalability simplicity cost
D
D
T persis
tence
layer
T
T
microkernel architecture
agility deployment testability performance scalability simplicity cost
D
D
T persis
tence
layer
T
T
T
D
space-based architecture
processing unit processing unit processing unit
virtualized middleware
db
space-based architecture
drivers
scalability
elasticity
performance
space-based architecture
agility deployment testability performance scalability simplicity cost
D
D
T persis
tence
layer
T
T
T
D
T
architecture katas
identifying architecture patterns
Your Architectural Kata is...
performance
availability
reliability
scalability
elasticity
Your Architectural Kata is...
performance
availability
reliability
scalability
elasticity
Your Architectural Kata is...
performance
availability
reliability
scalability
elasticity
option 1
Your Architectural Kata is...
performance
availability
reliability
scalability
elasticity
option 1 option 2
Your Architectural Kata is...
performance
availability
reliability
scalability
elasticity
performance
availability
reliability
scalability
elasticity
option 2 option 3
Your Architectural Kata is...
performance
availability
reliability
scalability
elasticity
option 3
Your Architectural Kata is...
bidder
tracker
auto
payment
Your Architectural Kata is...
Auto Bidder
Payment Tracker
Service Service
Your Architectural Kata is...
queue
queue
Auto Bidder
Payment Tracker
Service Service
Your Architectural Kata is...
availability
reliability
scalability
Customizability
Your Architectural Kata is...
availability
reliability
scalability
Customizability
simplicity
Your Architectural Kata is...
availability
reliability
scalability
Customizability
simplicity
domain isomorphism
Your Architectural Kata is...
availability
reliability
scalability
Customizability
simplicity
domain isomorphism
Your Architectural Kata is...
availability
reliability
scalability
Customizability
simplicity
domain isomorphism
Your Architectural Kata is...
availability
reliability
scalability
Customizability
simplicity
domain isomorphism
Your Architectural Kata is...
user interface
product location
purchase promotions
local!
orders local overrides
dev!
Your Architectural Kata is...
user interface
product location
location
custom
inventory
promotion purchase
promotion
standard delivery
inventory orders
global local
local
local
diagramming
software
architecture
diagramming architecture
diagramming architecture
user interface
product location
purchase promotions
custom
{REST}
inventory
standard {REST}
{REST} delivery
inventory orders
global local
local
local
Your Architectural Kata is...
topology
product {REST} location
location {REST}
custom
{REST}
inventory
standard {REST}
{REST} delivery
inventory orders
global local
local
local
Your Architectural Kata is...
protocols topology
product {REST} location
location {REST}
custom
{REST}
inventory
standard {REST}
{REST} delivery
inventory orders
global local
local
local
Your Architectural Kata is...
entire quantum
I’ll Have the BLT
BFF (iOS) BFF (Android) Web BFF (other)
{JSON} {JSON} {JSON} {JSON}
user interface
protocols topology
product {REST} location
location {REST}
custom
{REST}
inventory
standard {REST}
{REST} delivery
inventory orders
global local
local
local
C4:
C
O
N
T
A
I
N
E
R
No correct answers in
software architecture…
…only tradeoffs.
Your Architectural Kata is...
http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions
ADR semantic
versioning
short text
file doc/arch/adr-NNN.md
numbered no number
sequentially reused
Textile
asciidoc
reversed ADR
kept—
marked
superseded
Architecture Decision Records
Title: short noun phrase
the scenario
justifying decisions
the requirement: you need to federate
the hub
external
b2b
justifying decisions
the decision: dedicated broker
instances?
external
b2b
justifying decisions
the decision: centralized broker
external
b2b
21. Centralized message broker for federated gateway hub
Status
Accepted
Context
The incoming gateway hub is federated into 3 separate hubs. Access to the customer information
functionality in the application is only through JMS using ActiveMQ via the hub. The two options are to use
a centralized broker or to use dedicated broker instances for each hub instance.
Decision
We will use a centralized message broker instance for all federated gateway hubs.
We currently have low request volumes (200 requests/sec) and anticipate this will remain stable for the
foreseeable future. Therefore we do not see a performance bottleneck issue.
We will leverage the ActiveMQ failover protocol coupled with clustered ActiveMQ broker instances to
address any single point of failure issues.
Consequences
The customer information application will only require a single connection to the ActiveMQ broker
instance.
The gateway hubs can be expanded and consolidated without any coding changes to the application.
The application doesn’t need to be concerned about where the request came from.
adr-001.md
the case for Asciidoc(tor)
http://asciidoc.org http://asciidoctor.org
the case for Asciidoc(tor)
http://asciidoctor.org/docs/asciidoctor-diagram/
the case for Asciidoc(tor)
the case for Asciidoc(tor)
architecture katas
documenting architecture decisions
Your Architectural Kata is...
cache
Context
Decision
Consequences
1. Asynchronous messaging between bidding services
Status
Proposed
Context
The Bid Capture Service, upon receiving a bid from an online bidder or from a live bidder via the auctioneer,
must forward that bid onto the Bid Streamer Service and the Bidder Tracker Service. This could be done
using async p2p or pub/sub messaging or REST via the Online Auction API Layer.
Decision
Consequences
1. Asynchronous messaging between bidding services
Status
Proposed
Context
The Bid Capture Service, upon receiving a bid from an online bidder or from a live bidder via the auctioneer,
must forward that bid onto the Bid Streamer Service and the Bidder Tracker Service. This could be done
using async p2p or pub/sub messaging or REST via the Online Auction API Layer.
Decision
We will use asynchronous messaging between the Bid Capture Service, Bid Streamer Service, and the
Bidder Tracker Service.
The Bid Capture Service does not need any information back from the Bid Streamer Service or Bidder
Tracker Service.
The Bid Streamer Service must receive bids in the exact order they were accepted by the Bid Capture
Service. Using messaging and queues automatically guarantees the bid order for the stream.
Using async pub/sub messaging will increase the performance of the bidding process and allow for
extensibility of bidding information.
Consequences
1. Asynchronous messaging between bidding services
Status
Proposed
Context
The Bid Capture Service, upon receiving a bid from an online bidder or from a live bidder via the auctioneer,
must forward that bid onto the Bid Streamer Service and the Bidder Tracker Service. This could be done
using async p2p or pub/sub messaging or REST via the Online Auction API Layer.
Decision
We will use asynchronous messaging between the Bid Capture Service, Bid Streamer Service, and the
Bidder Tracker Service.
The Bid Capture Service does not need any information back from the Bid Streamer Service or Bidder
Tracker Service.
The Bid Streamer Service must receive bids in the exact order they were accepted by the Bid Capture
Service. Using messaging and queues automatically guarantees the bid order for the stream.
Using async pub/sub messaging will increase the performance of the bidding process and allow for
extensibility of bidding information.
Consequences
We will require clustering and high availability of the message queues
Internal bid events will be bypassing security checks done in the API layer.
Your Architectural Kata is...
## Status
_PROPOSED_
## Context
Two key requirements of the system (_promotions_ and _location services_) have both global (affects all stores) and local (specific to location) requirements.
The current design features a modular monolith architecture, allowing individual stores to upload their behavior using JAR files, shown in _Figure 1_.
Currently, stores must specify custom behavior (product specials, promotions, location exemptions) via a JAR file, uploaded to the global site via FTP. Operations must certify the JAR, leading to delays in depl
All local customizations reside in one service and in one set of tables in the master database. Over time, as new customizations accrued, it has become a tangled mess.
To allow stores to most easily add and customize local behavior, the architects propose moving to a micro-kernel architecture, shown in _Figure 2_.
The new design allows easy update of global policy (products, inventory, promotions) while allowing local stores to selectively those choices when appropriate.
## Decision
The architects decided to migrate the current monolith to become the core system for the new microkernel architecture, and build new functionality via plug-ins.
## Consequences
The architects take advantage of the restructuring opportunity to localize databases to individual domains. Communication between services now occurs via messaging.
The new design also incorporates the BFF patterns, discussed in [004 BFF for device independence](001-use-of-microkernel.html).
## Status
_PROPOSED_
## Context
Two key requirements of the system (_promotions_ and _location services_) have both global (affects all stores) and local (specific to location) requirements.
The current design features a modular monolith architecture, allowing individual stores to upload their behavior using JAR files, shown in _Figure 1_.
Currently, stores must specify custom behavior (product specials, promotions, location exemptions) via a JAR file, uploaded to the global site via FTP. Operations must certify the JAR, leading to delays in depl
All local customizations reside in one service and in one set of tables in the master database. Over time, as new customizations accrued, it has become a tangled mess.
To allow stores to most easily add and customize local behavior, the architects propose moving to a micro-kernel architecture, shown in _Figure 2_.
The new design allows easy update of global policy (products, inventory, promotions) while allowing local stores to selectively those choices when appropriate.
## Decision
The architects decided to migrate the current monolith to become the core system for the new microkernel architecture, and build new functionality via plug-ins.
## Consequences
The architects take advantage of the restructuring opportunity to localize databases to individual domains. Communication between services now occurs via messaging.
The new design also incorporates the BFF patterns, discussed in [004 BFF for device independence](001-use-of-microkernel.html).
reliability
availability
persistence layer
reliability
availability
performance
http://nealford.com/katas/
more
resources
http://evolutionaryarchitecture.com
more
resources
https://www.thoughtworks.com/podcasts
more
resources
https://www.codeproject.com/Articles/1167140/The-C-Software-Architecture-Model
DeveloperToArchitect.com
go do some
architecture!
O'Reilly Online Training
Architecture by Example
Mark Richards
Independent Consultant
Hands-on Software Architect, Published Author
Founder, DeveloperToArchitect.com
http://www.wmrichards.com
@markrichardssa
Neal Ford
ThoughtWorks
Director / Software Architect / Meme Wrangler
http://www.nealford.com
@neal4d