Uncoupling
Michael T. Nygard
@mtnygard
About the Speaker
Developer
Architect
Operations
Blog: http://www.michaelnygard.com/
Twitter: http://twitter.com/mtnygard
Tensegrity
This Photo by Unknown Author is licensed under CC BY
No-tegrity
This Photo by Unknown Author is licensed under CC BY-NC-SA
Coupling
Scharfenberg Coupler
Watt’s
Linkage
Chebyshev
Linkage
Standard Model
Particle
Interactions
Coupling
Coupling
•Determines degrees of freedom.
Coupling
•Determines degrees of freedom.
•Enables some movements.
Coupling
•Determines degrees of freedom.
•Enables some movements.
•Inhibits other movements.
Coupling
•Determines degrees of freedom.
•Enables some movements.
•Inhibits other movements.
•Connects effects.
Everything is coupled to everything
• Ambient temperature
• Ambient atmosphere
• Acoustic vibrations
• Electromagnetic field
• Gravity
• Higgs field
We cannot attend to all things all the
time
Kinds of Coupling
Type Effect
Operational Consumer cannot run without the provider
Development Changes in producer and consumer must be
coordinated
Semantic Change together because of shared concepts
Functional Change together because of shared responsibility
Incidental Change together for no good reason.
Analyzing Coupling I
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Email Component
[Component: C#]
Sends emails
Analyzing Coupling I
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Email Component
[Component: C#]
Sends emails
Operational: Strong. SMTP is synchronous, connection-oriented, conversational
Analyzing Coupling I
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Email Component
[Component: C#]
Sends emails
Operational: Strong. SMTP is synchronous, connection-oriented, conversational
Development: Weak. SMTP is well-defined standard with history of interoperability
Analyzing Coupling I
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Email Component
[Component: C#]
Sends emails
Operational: Strong. SMTP is synchronous, connection-oriented, conversational
Development: Weak. SMTP is well-defined standard with history of interoperability
Semantic: Very strong. SMTP defines entities, attributes, and allowed values.
Analyzing Coupling I
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Email Component
[Component: C#]
Sends emails
Operational: Strong. SMTP is synchronous, connection-oriented, conversational
Development: Weak. SMTP is well-defined standard with history of interoperability
Semantic: Very strong. SMTP defines entities, attributes, and allowed values.
Functional: Very weak. Sender and MTA both use network connections.
Analyzing Coupling II-A
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
SQL connection
to RDBMS
Analyzing Coupling II-A
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
SQL connection
to RDBMS
Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy
Analyzing Coupling II-A
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
SQL connection
to RDBMS
Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy
Development: Very strong. Dependent on schema, server version, protocol version.
Analyzing Coupling II-A
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
SQL connection
to RDBMS
Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy
Development: Very strong. Dependent on schema, server version, protocol version.
Semantic: Very strong. Tables, columns, and joins must be known to both parties.
Analyzing Coupling II-A
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy
Development: Very strong. Dependent on schema, server version, protocol version.
Semantic: Very strong. Tables, columns, and joins must be known to both parties.
Functional: Weak. Functions of data maintenance don’t overlap with retrieval into objects.
SQL connection
to RDBMS
Suppose we use REST instead of SQL?
Analyzing Coupling II-B
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
HTTPS request
to REST API
Analyzing Coupling II-B
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Operational: Strong, but less than before. Dependent on availability of server.
HTTPS request
to REST API
Analyzing Coupling II-B
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Operational: Strong, but less than before. Dependent on availability of server.
Development: Strong, but less. Insulated from data format changes. Open encoding can further reduce coupling
HTTPS request
to REST API
Analyzing Coupling II-B
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Operational: Strong, but less than before. Dependent on availability of server.
Development: Strong, but less. Insulated from data format changes. Open encoding can further reduce coupling
Semantic: Still very strong. REST resources and C# entities must align. Concepts will still map 1:1
HTTPS request
to REST API
Analyzing Coupling II-B
Reference Data System
[Software System]
Managesreference data for all
counterpartiesthe bank interacts
with
Getscounterparty
datafrom
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Operational: Strong, but less than before. Dependent on availability of server.
Development: Strong, but less. Insulated from data format changes. Open encoding can further reduce coupling
Semantic: Still very strong. REST resources and C# entities must align. Concepts will still map 1:1
Functional: Still weak. Different languages, techniques, design patterns apply.
HTTPS request
to REST API
What if we invert the flow of control?
Analyzing Coupling II-C
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Reference Data Receiver
[Component: C#]
Accepts and caches data from the
reference datasystem
Broadcasts
Message Broker
[Software System]
Pub/sub hub, bub
Broadcasts
Analyzing Coupling II-C
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Reference Data Receiver
[Component: C#]
Accepts and caches data from the
reference datasystem
Broadcasts
Message Broker
[Software System]
Pub/sub hub, bub
Broadcasts
Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken.
Analyzing Coupling II-C
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Reference Data Receiver
[Component: C#]
Accepts and caches data from the
reference datasystem
Broadcasts
Message Broker
[Software System]
Pub/sub hub, bub
Broadcasts
Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken.
Development: Weak. Insulated from schema changes.
Analyzing Coupling II-C
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Reference Data Receiver
[Component: C#]
Accepts and caches data from the
reference datasystem
Broadcasts
Message Broker
[Software System]
Pub/sub hub, bub
Broadcasts
Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken.
Development: Weak. Insulated from schema changes.
Semantic: Strong, but not as strong. Broker allows for remapping concepts.
Analyzing Coupling II-C
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Reference Data Receiver
[Component: C#]
Accepts and caches data from the
reference datasystem
Broadcasts
Message Broker
[Software System]
Pub/sub hub, bub
Broadcasts
Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken.
Development: Weak. Insulated from schema changes.
Semantic: Strong, but not as strong. Broker allows for remapping concepts.
Functional: Moderate. All components must share the same messaging tech.
Coupling was present in all examples –
It is necessary and inescapable
Development &
semantic coupling
inhibit change more
than operational
coupling
Semantic Chains of Coupling
Chains of Coupling
Retek IBM PIM Informatica
Everybody
Else
Dotcom
Catalog
3rd
Party Data
Vendors
Reviews,
Ratings,
Imagery
Dotcom
Promotions
Online
Store
Faceted
Search
SKU SKU SKU
SKU
SKU SKU SKU
SKU
Chains of Coupling
Retek IBM PIM Informatica
Everybody
Else
Dotcom
Catalog
3rd
Party Data
Vendors
Reviews,
Ratings,
Imagery
Dotcom
Promotions
Online
Store
Faceted
Search
SKU SKU SKU
SKU
SKU SKU SKU
SKU
Price Point
Chains of Coupling
Retek IBM PIM Informatica
Everybody
Else
Dotcom
Catalog
3rd
Party Data
Vendors
Reviews,
Ratings,
Imagery
Dotcom
Promotions
Online
Store
Faceted
Search
SKU SKU SKU
SKU
SKU SKU SKU
SKU
Price Point Price Point
Price Point
Price Point Price Point
Price Point
Price Point
Chains of Coupling – Semantic Polymer
Retek IBM PIM Informatica
Everybody
Else
Dotcom
Catalog
3rd
Party Data
Vendors
Reviews,
Ratings,
Imagery
Dotcom
Promotions
Online
Store
Faceted
Search
SKU SKU SKU
SKU
SKU SKU SKU
SKU
Price Point Price Point
Price Point
Price Point Price Point
Price Point
Price Point
Development
Coupling -
Long Arrows
Each “interface” was really a chain
1. Extract tables to files
2. Push files across network
3. Load tables into “LZ”
4. Process into “cold” DB
5. Swap hot & cold DBs (hours later)
1. Send message to queue
2. Take message from queue, unwrap, inspect,
and dispatch to 1-of-N other queues.
3. Drain queue to file
4. Batch job wakes up 2 times a day, does FTP
to remote end
5. Another batch job pulls a reconciliation file,
drops file into file system
6. Parser reads the file, shreds it into
messages, puts them on another queue
Operational Characteristics in Long Chains
• Latency strictly worse than the slowest link in the chain.
• Availability strictly worse than the least available link.
• Throughput strictly worse than the throughput of the worst bottleneck
• Security strictly worse than the security of the weakest link
Digging Out
Information Hiding
“On the Criteria To Be Used in
Decomposing Systems into Modules",
David Parnas,
CACM, 1972
A KWIC Example
• Input
Software comprises an endless supply of structures.
• Output
an endless supply of structures. Software comprises
comprises an endless supply of structures. Software
endless supply of structures. Software comprises an
of structures. Software comprises an endless supply
Software comprises an endless supply of structures.
structures. Software comprises an endless supply of
supply of structures. Software comprises an endless
Modularization 1
1. Input
Read EBCDIC characters, store them in core. 6-bit
characters packed 4 per word. EOL is a special character.
2. Circular shifter
Prepare index; pair of addr of first char of shift, original
index of line in input array
3. Alphabetizer
Take arrays from 1 & 2, produce new array of pairs like
in 2, but in alphabetical order.
4. Output
Using arrays from 1 & 3, format output
5. Control
Allocate memory, call operations in1 - 4, report errors.
Consider the Effect of Changes
For each change case listed here, how many modules have to be changed?
• Read and print ASCII instead of EBCDIC.
• Stop using packed characters, store one character per word.
• Write index for circular shifts to offline storage instead of core to support larger
input documents.
Modularization 2
1. Line Storage
Offers functional interface: SETCH, GETCH, GETW,
DELW, DELLINE
2. Input
Reads EBCDIC chars, calls line storage to put them into
lines.
3. Circular Shifter
Offers same interface as line storage. Makes it appear to
have all shifts of all lines.
4. Alphabetizer
Offers sort function INIT, and access function iTH that
gets a line.
5. Output
Repeatedly call iTH on alphabetizer, printing the line.
6. Control
Similar to first approach, call each module in sequence.
Consider the Effect of Changes
For each change case listed here, how many modules have to be changed?
• Read and print ASCII instead of EBCDIC.
• Stop using packed characters, store one character per word.
• Write index for circular shifts to offline storage instead of core to support larger
input documents.
Why is the second one better?
• It hides decisions inside modules.
• Functional interfaces provide an abstract representation of the underlying data.
• Information hiding
Line
Line
Line
Line
Line
Ordered
Ordered
Storage
Input
Circular Shifter
Alphabetizer
Output
"Needs an interface"
"Offers an interface"
Why did the second
modularization survive
change better?
• Very few data types
• Small number of well
defined interfaces
• Highly composable
LineLine
LineLine
Line
Ordered Storage
Input
Circular ShifterOutput
Ordered
Alphabetizer
Controller run
run
Creates all
components
Composing Interfaces
LineLine
LineLine
Line
Ordered Storage
Input
Circular ShifterOutput
Ordered
Alphabetizer
Controller run
run
Creates all
components
Composing Interfaces
Consider each connector with respect to
Operational, Development, Semantic, and Functional coupling
Better Composability
Fewer interfaces
Fewer data types
Uncoupling
Orthogonality in Software
• Separation of concerns
• High cohesion within a module or component
• Low coupling between modules or components
• Little overlap in functionality between modules
• Information hiding / decision hiding
Batch Process
File System
[Container: Network File Share]
Stores risk reports
Report Distributor
[Component: C#]
Publishes the report for the web
application
Publishesrisk reportsto
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Central Monitoring Service
[Software System]
The bank-wide monitoringand
alertingdashboard
Trade Data System
[Software System]
The system of record for trades of
type X
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Getstrade datafrom
Sendscritical failure alertsto
[SNMP]
Getscounterparty
datafrom
Email Component
[Component: C#]
Sends emails
Trade Data Importer
[Component: C#]
Imports data from the trade data
system
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Report Checker
[Component: C#]
Checks that the report has been
generated by 9 a.m. Singapore
time
Alerter
[Component: C# with SNMP
library]
Sends SNMPalerts
Sendsalerts using
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Sendsemail
using
Importsdata
using
Importsdata
using
Risk Calculator
[Component: C#]
Does math
Report Generator
[Component: C# and
Microsoft.Office.Interop.Excel]
Generates an Excel compatible
risk report
Generatesthe risk
report using
Calculatesrisk
using
Scheduler
[Component: Quartz.net]
Starts the risk calculation process
at 5 p.m. New York time
Starts
Starts
Publishesthe risk
report using
Batch Process
File System
[Container: Network File Share]
Stores risk reports
Report Distributor
[Component: C#]
Publishes the report for the web
application
Publishesrisk reportsto
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Central Monitoring Service
[Software System]
The bank-wide monitoringand
alertingdashboard
Trade Data System
[Software System]
The system of record for trades of
type X
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Getstrade datafrom
Sendscritical failure alertsto
[SNMP]
Getscounterparty
datafrom
Email Component
[Component: C#]
Sends emails
Trade Data Importer
[Component: C#]
Imports data from the trade data
system
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Report Checker
[Component: C#]
Checks that the report has been
generated by 9 a.m. Singapore
time
Alerter
[Component: C# with SNMP
library]
Sends SNMPalerts
Sendsalerts using
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Sendsemail
using
Importsdata
using
Importsdata
using
Risk Calculator
[Component: C#]
Does math
Report Generator
[Component: C# and
Microsoft.Office.Interop.Excel]
Generates an Excel compatible
risk report
Generatesthe risk
report using
Calculatesrisk
using
Scheduler
[Component: Quartz.net]
Starts the risk calculation process
at 5 p.m. New York time
Starts
Starts
Publishesthe risk
report using
Risk calculator produces a data structure that the
report generator must consume.
Example from c4model.com
Batch Process
File System
[Container: Network File Share]
Stores risk reports
Report Distributor
[Component: C#]
Publishes the report for the web
application
Publishesrisk reportsto
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Central Monitoring Service
[Software System]
The bank-wide monitoringand
alertingdashboard
Trade Data System
[Software System]
The system of record for trades of
type X
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Getstrade datafrom
Sendscritical failure alertsto
[SNMP]
Getscounterparty
datafrom
Email Component
[Component: C#]
Sends emails
Trade Data Importer
[Component: C#]
Imports data from the trade data
system
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Report Checker
[Component: C#]
Checks that the report has been
generated by 9 a.m. Singapore
time
Alerter
[Component: C# with SNMP
library]
Sends SNMPalerts
Sendsalerts using
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Sendsemail
using
Importsdata
using
Importsdata
using
Risk Calculator
[Component: C#]
Does math
Report Generator
[Component: C# and
Microsoft.Office.Interop.Excel]
Generates an Excel compatible
risk report
Generatesthe risk
report using
Calculatesrisk
using
Scheduler
[Component: Quartz.net]
Starts the risk calculation process
at 5 p.m. New York time
Starts
Starts
Publishesthe risk
report using
Risk calculator produces a data structure that the
report generator must consume.
Data importers probably have similar
implementation needs
Example from c4model.com
Batch Process
File System
[Container: Network File Share]
Stores risk reports
Report Distributor
[Component: C#]
Publishes the report for the web
application
Publishesrisk reportsto
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Central Monitoring Service
[Software System]
The bank-wide monitoringand
alertingdashboard
Trade Data System
[Software System]
The system of record for trades of
type X
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Getstrade datafrom
Sendscritical failure alertsto
[SNMP]
Getscounterparty
datafrom
Email Component
[Component: C#]
Sends emails
Trade Data Importer
[Component: C#]
Imports data from the trade data
system
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Report Checker
[Component: C#]
Checks that the report has been
generated by 9 a.m. Singapore
time
Alerter
[Component: C# with SNMP
library]
Sends SNMPalerts
Sendsalerts using
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Sendsemail
using
Importsdata
using
Importsdata
using
Risk Calculator
[Component: C#]
Does math
Report Generator
[Component: C# and
Microsoft.Office.Interop.Excel]
Generates an Excel compatible
risk report
Generatesthe risk
report using
Calculatesrisk
using
Scheduler
[Component: Quartz.net]
Starts the risk calculation process
at 5 p.m. New York time
Starts
Starts
Publishesthe risk
report using
Risk calculator produces a data structure that the
report generator must consume.
Data importers probably have similar
implementation needs
Report checker doesn’t appear to connect with
the file system that holds the reports. FS location
is latent coupling that will be a nasty surprise later.
Example from c4model.com
Batch Process
File System
[Container: Network File Share]
Stores risk reports
Report Distributor
[Component: C#]
Publishes the report for the web
application
Publishesrisk reportsto
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Central Monitoring Service
[Software System]
The bank-wide monitoringand
alertingdashboard
Trade Data System
[Software System]
The system of record for trades of
type X
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Getstrade datafrom
Sendscritical failure alertsto
[SNMP]
Getscounterparty
datafrom
Email Component
[Component: C#]
Sends emails
Trade Data Importer
[Component: C#]
Imports data from the trade data
system
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Report Checker
[Component: C#]
Checks that the report has been
generated by 9 a.m. Singapore
time
Alerter
[Component: C# with SNMP
library]
Sends SNMPalerts
Sendsalerts using
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Sendsemail
using
Importsdata
using
Importsdata
using
Risk Calculator
[Component: C#]
Does math
Report Generator
[Component: C# and
Microsoft.Office.Interop.Excel]
Generates an Excel compatible
risk report
Generatesthe risk
report using
Calculatesrisk
using
Scheduler
[Component: Quartz.net]
Starts the risk calculation process
at 5 p.m. New York time
Starts
Starts
Publishesthe risk
report using
Risk calculator produces a data structure that the
report generator must consume.
Data importers probably have similar
implementation needs
Report checker doesn’t appear to connect with
the file system that holds the reports. FS location
is latent coupling that will be a nasty surprise later.
Orchestrator might end need
to do lots of data
transformation to bridge
interfaces.
Example from c4model.com
Batch Process
File System
[Container: Network File Share]
Stores risk reports
Report Distributor
[Component: C#]
Publishes the report for the web
application
Publishesrisk reportsto
Reference Data System
[Software System]
Manages reference data for all
counterparties the bank interacts
with
Central Monitoring Service
[Software System]
The bank-wide monitoringand
alertingdashboard
Trade Data System
[Software System]
The system of record for trades of
type X
E-mail system
[Software System]
Microsoft Exchange
Sendsanotification that
areport isready to
Getstrade datafrom
Sendscritical failure alertsto
[SNMP]
Getscounterparty
datafrom
Email Component
[Component: C#]
Sends emails
Trade Data Importer
[Component: C#]
Imports data from the trade data
system
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Report Checker
[Component: C#]
Checks that the report has been
generated by 9 a.m. Singapore
time
Alerter
[Component: C# with SNMP
library]
Sends SNMPalerts
Sendsalerts using
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Sendsemail
using
Importsdata
using
Importsdata
using
Risk Calculator
[Component: C#]
Does math
Report Generator
[Component: C# and
Microsoft.Office.Interop.Excel]
Generates an Excel compatible
risk report
Generatesthe risk
report using
Calculatesrisk
using
Scheduler
[Component: Quartz.net]
Starts the risk calculation process
at 5 p.m. New York time
Starts
Starts
Publishesthe risk
report using
Risk calculator produces a data structure that the
report generator must consume.
Data importers probably have similar
implementation needs
Report checker doesn’t appear to connect with
the file system that holds the reports. FS location
is latent coupling that will be a nasty surprise later.
Orchestrator might end need
to do lots of data
transformation to bridge
interfaces.
Example from c4model.com
Let’s explore options to uncouple these
Problem: Risk calculator
produces a data structure
that the report generator
must consume.
Solutions depend on architectural style
Here we’re in a Windows service so we
might use a shared library to define the interface.
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Risk Calculator
[Component: C#]
Does math
Report Generator
[Component: C# and
Microsoft.Office.Interop.Excel]
Generates an Excel compatible
risk report
Generatesthe risk
report using
Calculatesrisk
using
Problem: Redundant implementation details
This would be a good place to use a
shared library for common implementation.
Trade Data Importer
[Component: C#]
Imports data from the trade data
system
Reference Data Importer
[Component: C#]
Imports data from the reference
datasystem
Orchestrator
[Component: C#]
Orchestrates the risk calculation
process
Importsdata
using
Importsdata
using
File System
[Container: Network File Share]
Stores risk reports
Report Distributor
[Component: C#]
Publishes the report for the web
application
Publishesrisk reportsto
Report Checker
[Component: C#]
Checks that the report has been
generated by 9 a.m. Singapore
time
Alerter
[Component: C# with SNMP
library]
Sends SNMPalerts
Sendsalerts using
Scheduler
[Component: Quartz.net]
Starts
Publishesthe risk
Problem: Latent coupling about filesystem
layout.
Solution: A module to hide the decision
about filesystem layout from
both the Report Distributor and the
Report Checker
Find solutions by rotating your perspective
• When looking at components, think about modules
• When looking at modules, think about components
• When looking at data, think about code
• When looking at code, think about data
Use all your tools
1. Module structure – layout of your code and libraries
2. Component structure – interactions between runtime components
3. Abstraction – Emphasize similar interfaces & data formats
Coupling
• Determines degrees of freedom.
• Enables some movements.
• Inhibits other movements.
• Connects effects.
Kinds of Coupling
• Operational
• Development
• Semantic
• Functional
• Incidental
Summary
• Hide decisions
• Choose degrees of freedom that matter
• Avoid semantic polymers
• Use static and dynamic structures
• Find more instances of fewer, more general interfaces
• Prefer explicit to tacit
Uncoupling
Michael T. Nygard
@mtnygard

Michael Nygard - Uncoupling

  • 1.
  • 2.
    About the Speaker Developer Architect Operations Blog:http://www.michaelnygard.com/ Twitter: http://twitter.com/mtnygard
  • 5.
    Tensegrity This Photo byUnknown Author is licensed under CC BY
  • 6.
    No-tegrity This Photo byUnknown Author is licensed under CC BY-NC-SA
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
    Coupling •Determines degrees offreedom. •Enables some movements.
  • 15.
    Coupling •Determines degrees offreedom. •Enables some movements. •Inhibits other movements.
  • 16.
    Coupling •Determines degrees offreedom. •Enables some movements. •Inhibits other movements. •Connects effects.
  • 20.
    Everything is coupledto everything • Ambient temperature • Ambient atmosphere • Acoustic vibrations • Electromagnetic field • Gravity • Higgs field
  • 21.
    We cannot attendto all things all the time
  • 22.
    Kinds of Coupling TypeEffect Operational Consumer cannot run without the provider Development Changes in producer and consumer must be coordinated Semantic Change together because of shared concepts Functional Change together because of shared responsibility Incidental Change together for no good reason.
  • 23.
    Analyzing Coupling I E-mailsystem [Software System] Microsoft Exchange Sendsanotification that areport isready to Email Component [Component: C#] Sends emails
  • 24.
    Analyzing Coupling I E-mailsystem [Software System] Microsoft Exchange Sendsanotification that areport isready to Email Component [Component: C#] Sends emails Operational: Strong. SMTP is synchronous, connection-oriented, conversational
  • 25.
    Analyzing Coupling I E-mailsystem [Software System] Microsoft Exchange Sendsanotification that areport isready to Email Component [Component: C#] Sends emails Operational: Strong. SMTP is synchronous, connection-oriented, conversational Development: Weak. SMTP is well-defined standard with history of interoperability
  • 26.
    Analyzing Coupling I E-mailsystem [Software System] Microsoft Exchange Sendsanotification that areport isready to Email Component [Component: C#] Sends emails Operational: Strong. SMTP is synchronous, connection-oriented, conversational Development: Weak. SMTP is well-defined standard with history of interoperability Semantic: Very strong. SMTP defines entities, attributes, and allowed values.
  • 27.
    Analyzing Coupling I E-mailsystem [Software System] Microsoft Exchange Sendsanotification that areport isready to Email Component [Component: C#] Sends emails Operational: Strong. SMTP is synchronous, connection-oriented, conversational Development: Weak. SMTP is well-defined standard with history of interoperability Semantic: Very strong. SMTP defines entities, attributes, and allowed values. Functional: Very weak. Sender and MTA both use network connections.
  • 29.
    Analyzing Coupling II-A ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem SQL connection to RDBMS
  • 30.
    Analyzing Coupling II-A ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem SQL connection to RDBMS Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy
  • 31.
    Analyzing Coupling II-A ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem SQL connection to RDBMS Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy Development: Very strong. Dependent on schema, server version, protocol version.
  • 32.
    Analyzing Coupling II-A ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem SQL connection to RDBMS Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy Development: Very strong. Dependent on schema, server version, protocol version. Semantic: Very strong. Tables, columns, and joins must be known to both parties.
  • 33.
    Analyzing Coupling II-A ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy Development: Very strong. Dependent on schema, server version, protocol version. Semantic: Very strong. Tables, columns, and joins must be known to both parties. Functional: Weak. Functions of data maintenance don’t overlap with retrieval into objects. SQL connection to RDBMS
  • 34.
    Suppose we useREST instead of SQL?
  • 35.
    Analyzing Coupling II-B ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem HTTPS request to REST API
  • 36.
    Analyzing Coupling II-B ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem Operational: Strong, but less than before. Dependent on availability of server. HTTPS request to REST API
  • 37.
    Analyzing Coupling II-B ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem Operational: Strong, but less than before. Dependent on availability of server. Development: Strong, but less. Insulated from data format changes. Open encoding can further reduce coupling HTTPS request to REST API
  • 38.
    Analyzing Coupling II-B ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem Operational: Strong, but less than before. Dependent on availability of server. Development: Strong, but less. Insulated from data format changes. Open encoding can further reduce coupling Semantic: Still very strong. REST resources and C# entities must align. Concepts will still map 1:1 HTTPS request to REST API
  • 39.
    Analyzing Coupling II-B ReferenceData System [Software System] Managesreference data for all counterpartiesthe bank interacts with Getscounterparty datafrom Reference Data Importer [Component: C#] Imports data from the reference datasystem Operational: Strong, but less than before. Dependent on availability of server. Development: Strong, but less. Insulated from data format changes. Open encoding can further reduce coupling Semantic: Still very strong. REST resources and C# entities must align. Concepts will still map 1:1 Functional: Still weak. Different languages, techniques, design patterns apply. HTTPS request to REST API
  • 40.
    What if weinvert the flow of control?
  • 41.
    Analyzing Coupling II-C ReferenceData System [Software System] Manages reference data for all counterparties the bank interacts with Reference Data Receiver [Component: C#] Accepts and caches data from the reference datasystem Broadcasts Message Broker [Software System] Pub/sub hub, bub Broadcasts
  • 42.
    Analyzing Coupling II-C ReferenceData System [Software System] Manages reference data for all counterparties the bank interacts with Reference Data Receiver [Component: C#] Accepts and caches data from the reference datasystem Broadcasts Message Broker [Software System] Pub/sub hub, bub Broadcasts Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken.
  • 43.
    Analyzing Coupling II-C ReferenceData System [Software System] Manages reference data for all counterparties the bank interacts with Reference Data Receiver [Component: C#] Accepts and caches data from the reference datasystem Broadcasts Message Broker [Software System] Pub/sub hub, bub Broadcasts Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken. Development: Weak. Insulated from schema changes.
  • 44.
    Analyzing Coupling II-C ReferenceData System [Software System] Manages reference data for all counterparties the bank interacts with Reference Data Receiver [Component: C#] Accepts and caches data from the reference datasystem Broadcasts Message Broker [Software System] Pub/sub hub, bub Broadcasts Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken. Development: Weak. Insulated from schema changes. Semantic: Strong, but not as strong. Broker allows for remapping concepts.
  • 45.
    Analyzing Coupling II-C ReferenceData System [Software System] Manages reference data for all counterparties the bank interacts with Reference Data Receiver [Component: C#] Accepts and caches data from the reference datasystem Broadcasts Message Broker [Software System] Pub/sub hub, bub Broadcasts Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken. Development: Weak. Insulated from schema changes. Semantic: Strong, but not as strong. Broker allows for remapping concepts. Functional: Moderate. All components must share the same messaging tech.
  • 46.
    Coupling was presentin all examples – It is necessary and inescapable
  • 47.
    Development & semantic coupling inhibitchange more than operational coupling
  • 48.
  • 49.
    Chains of Coupling RetekIBM PIM Informatica Everybody Else Dotcom Catalog 3rd Party Data Vendors Reviews, Ratings, Imagery Dotcom Promotions Online Store Faceted Search SKU SKU SKU SKU SKU SKU SKU SKU
  • 50.
    Chains of Coupling RetekIBM PIM Informatica Everybody Else Dotcom Catalog 3rd Party Data Vendors Reviews, Ratings, Imagery Dotcom Promotions Online Store Faceted Search SKU SKU SKU SKU SKU SKU SKU SKU Price Point
  • 51.
    Chains of Coupling RetekIBM PIM Informatica Everybody Else Dotcom Catalog 3rd Party Data Vendors Reviews, Ratings, Imagery Dotcom Promotions Online Store Faceted Search SKU SKU SKU SKU SKU SKU SKU SKU Price Point Price Point Price Point Price Point Price Point Price Point Price Point
  • 52.
    Chains of Coupling– Semantic Polymer Retek IBM PIM Informatica Everybody Else Dotcom Catalog 3rd Party Data Vendors Reviews, Ratings, Imagery Dotcom Promotions Online Store Faceted Search SKU SKU SKU SKU SKU SKU SKU SKU Price Point Price Point Price Point Price Point Price Point Price Point Price Point
  • 53.
  • 54.
    Each “interface” wasreally a chain 1. Extract tables to files 2. Push files across network 3. Load tables into “LZ” 4. Process into “cold” DB 5. Swap hot & cold DBs (hours later) 1. Send message to queue 2. Take message from queue, unwrap, inspect, and dispatch to 1-of-N other queues. 3. Drain queue to file 4. Batch job wakes up 2 times a day, does FTP to remote end 5. Another batch job pulls a reconciliation file, drops file into file system 6. Parser reads the file, shreds it into messages, puts them on another queue
  • 55.
    Operational Characteristics inLong Chains • Latency strictly worse than the slowest link in the chain. • Availability strictly worse than the least available link. • Throughput strictly worse than the throughput of the worst bottleneck • Security strictly worse than the security of the weakest link
  • 56.
  • 57.
    Information Hiding “On theCriteria To Be Used in Decomposing Systems into Modules", David Parnas, CACM, 1972
  • 58.
    A KWIC Example •Input Software comprises an endless supply of structures. • Output an endless supply of structures. Software comprises comprises an endless supply of structures. Software endless supply of structures. Software comprises an of structures. Software comprises an endless supply Software comprises an endless supply of structures. structures. Software comprises an endless supply of supply of structures. Software comprises an endless
  • 59.
    Modularization 1 1. Input ReadEBCDIC characters, store them in core. 6-bit characters packed 4 per word. EOL is a special character. 2. Circular shifter Prepare index; pair of addr of first char of shift, original index of line in input array 3. Alphabetizer Take arrays from 1 & 2, produce new array of pairs like in 2, but in alphabetical order. 4. Output Using arrays from 1 & 3, format output 5. Control Allocate memory, call operations in1 - 4, report errors.
  • 60.
    Consider the Effectof Changes For each change case listed here, how many modules have to be changed? • Read and print ASCII instead of EBCDIC. • Stop using packed characters, store one character per word. • Write index for circular shifts to offline storage instead of core to support larger input documents.
  • 61.
    Modularization 2 1. LineStorage Offers functional interface: SETCH, GETCH, GETW, DELW, DELLINE 2. Input Reads EBCDIC chars, calls line storage to put them into lines. 3. Circular Shifter Offers same interface as line storage. Makes it appear to have all shifts of all lines. 4. Alphabetizer Offers sort function INIT, and access function iTH that gets a line. 5. Output Repeatedly call iTH on alphabetizer, printing the line. 6. Control Similar to first approach, call each module in sequence.
  • 62.
    Consider the Effectof Changes For each change case listed here, how many modules have to be changed? • Read and print ASCII instead of EBCDIC. • Stop using packed characters, store one character per word. • Write index for circular shifts to offline storage instead of core to support larger input documents.
  • 63.
    Why is thesecond one better? • It hides decisions inside modules. • Functional interfaces provide an abstract representation of the underlying data. • Information hiding
  • 64.
    Line Line Line Line Line Ordered Ordered Storage Input Circular Shifter Alphabetizer Output "Needs aninterface" "Offers an interface" Why did the second modularization survive change better? • Very few data types • Small number of well defined interfaces • Highly composable
  • 65.
  • 66.
    LineLine LineLine Line Ordered Storage Input Circular ShifterOutput Ordered Alphabetizer Controllerrun run Creates all components Composing Interfaces Consider each connector with respect to Operational, Development, Semantic, and Functional coupling
  • 67.
  • 68.
  • 69.
    Orthogonality in Software •Separation of concerns • High cohesion within a module or component • Low coupling between modules or components • Little overlap in functionality between modules • Information hiding / decision hiding
  • 70.
    Batch Process File System [Container:Network File Share] Stores risk reports Report Distributor [Component: C#] Publishes the report for the web application Publishesrisk reportsto Reference Data System [Software System] Manages reference data for all counterparties the bank interacts with Central Monitoring Service [Software System] The bank-wide monitoringand alertingdashboard Trade Data System [Software System] The system of record for trades of type X E-mail system [Software System] Microsoft Exchange Sendsanotification that areport isready to Getstrade datafrom Sendscritical failure alertsto [SNMP] Getscounterparty datafrom Email Component [Component: C#] Sends emails Trade Data Importer [Component: C#] Imports data from the trade data system Reference Data Importer [Component: C#] Imports data from the reference datasystem Report Checker [Component: C#] Checks that the report has been generated by 9 a.m. Singapore time Alerter [Component: C# with SNMP library] Sends SNMPalerts Sendsalerts using Orchestrator [Component: C#] Orchestrates the risk calculation process Sendsemail using Importsdata using Importsdata using Risk Calculator [Component: C#] Does math Report Generator [Component: C# and Microsoft.Office.Interop.Excel] Generates an Excel compatible risk report Generatesthe risk report using Calculatesrisk using Scheduler [Component: Quartz.net] Starts the risk calculation process at 5 p.m. New York time Starts Starts Publishesthe risk report using
  • 71.
    Batch Process File System [Container:Network File Share] Stores risk reports Report Distributor [Component: C#] Publishes the report for the web application Publishesrisk reportsto Reference Data System [Software System] Manages reference data for all counterparties the bank interacts with Central Monitoring Service [Software System] The bank-wide monitoringand alertingdashboard Trade Data System [Software System] The system of record for trades of type X E-mail system [Software System] Microsoft Exchange Sendsanotification that areport isready to Getstrade datafrom Sendscritical failure alertsto [SNMP] Getscounterparty datafrom Email Component [Component: C#] Sends emails Trade Data Importer [Component: C#] Imports data from the trade data system Reference Data Importer [Component: C#] Imports data from the reference datasystem Report Checker [Component: C#] Checks that the report has been generated by 9 a.m. Singapore time Alerter [Component: C# with SNMP library] Sends SNMPalerts Sendsalerts using Orchestrator [Component: C#] Orchestrates the risk calculation process Sendsemail using Importsdata using Importsdata using Risk Calculator [Component: C#] Does math Report Generator [Component: C# and Microsoft.Office.Interop.Excel] Generates an Excel compatible risk report Generatesthe risk report using Calculatesrisk using Scheduler [Component: Quartz.net] Starts the risk calculation process at 5 p.m. New York time Starts Starts Publishesthe risk report using Risk calculator produces a data structure that the report generator must consume. Example from c4model.com
  • 72.
    Batch Process File System [Container:Network File Share] Stores risk reports Report Distributor [Component: C#] Publishes the report for the web application Publishesrisk reportsto Reference Data System [Software System] Manages reference data for all counterparties the bank interacts with Central Monitoring Service [Software System] The bank-wide monitoringand alertingdashboard Trade Data System [Software System] The system of record for trades of type X E-mail system [Software System] Microsoft Exchange Sendsanotification that areport isready to Getstrade datafrom Sendscritical failure alertsto [SNMP] Getscounterparty datafrom Email Component [Component: C#] Sends emails Trade Data Importer [Component: C#] Imports data from the trade data system Reference Data Importer [Component: C#] Imports data from the reference datasystem Report Checker [Component: C#] Checks that the report has been generated by 9 a.m. Singapore time Alerter [Component: C# with SNMP library] Sends SNMPalerts Sendsalerts using Orchestrator [Component: C#] Orchestrates the risk calculation process Sendsemail using Importsdata using Importsdata using Risk Calculator [Component: C#] Does math Report Generator [Component: C# and Microsoft.Office.Interop.Excel] Generates an Excel compatible risk report Generatesthe risk report using Calculatesrisk using Scheduler [Component: Quartz.net] Starts the risk calculation process at 5 p.m. New York time Starts Starts Publishesthe risk report using Risk calculator produces a data structure that the report generator must consume. Data importers probably have similar implementation needs Example from c4model.com
  • 73.
    Batch Process File System [Container:Network File Share] Stores risk reports Report Distributor [Component: C#] Publishes the report for the web application Publishesrisk reportsto Reference Data System [Software System] Manages reference data for all counterparties the bank interacts with Central Monitoring Service [Software System] The bank-wide monitoringand alertingdashboard Trade Data System [Software System] The system of record for trades of type X E-mail system [Software System] Microsoft Exchange Sendsanotification that areport isready to Getstrade datafrom Sendscritical failure alertsto [SNMP] Getscounterparty datafrom Email Component [Component: C#] Sends emails Trade Data Importer [Component: C#] Imports data from the trade data system Reference Data Importer [Component: C#] Imports data from the reference datasystem Report Checker [Component: C#] Checks that the report has been generated by 9 a.m. Singapore time Alerter [Component: C# with SNMP library] Sends SNMPalerts Sendsalerts using Orchestrator [Component: C#] Orchestrates the risk calculation process Sendsemail using Importsdata using Importsdata using Risk Calculator [Component: C#] Does math Report Generator [Component: C# and Microsoft.Office.Interop.Excel] Generates an Excel compatible risk report Generatesthe risk report using Calculatesrisk using Scheduler [Component: Quartz.net] Starts the risk calculation process at 5 p.m. New York time Starts Starts Publishesthe risk report using Risk calculator produces a data structure that the report generator must consume. Data importers probably have similar implementation needs Report checker doesn’t appear to connect with the file system that holds the reports. FS location is latent coupling that will be a nasty surprise later. Example from c4model.com
  • 74.
    Batch Process File System [Container:Network File Share] Stores risk reports Report Distributor [Component: C#] Publishes the report for the web application Publishesrisk reportsto Reference Data System [Software System] Manages reference data for all counterparties the bank interacts with Central Monitoring Service [Software System] The bank-wide monitoringand alertingdashboard Trade Data System [Software System] The system of record for trades of type X E-mail system [Software System] Microsoft Exchange Sendsanotification that areport isready to Getstrade datafrom Sendscritical failure alertsto [SNMP] Getscounterparty datafrom Email Component [Component: C#] Sends emails Trade Data Importer [Component: C#] Imports data from the trade data system Reference Data Importer [Component: C#] Imports data from the reference datasystem Report Checker [Component: C#] Checks that the report has been generated by 9 a.m. Singapore time Alerter [Component: C# with SNMP library] Sends SNMPalerts Sendsalerts using Orchestrator [Component: C#] Orchestrates the risk calculation process Sendsemail using Importsdata using Importsdata using Risk Calculator [Component: C#] Does math Report Generator [Component: C# and Microsoft.Office.Interop.Excel] Generates an Excel compatible risk report Generatesthe risk report using Calculatesrisk using Scheduler [Component: Quartz.net] Starts the risk calculation process at 5 p.m. New York time Starts Starts Publishesthe risk report using Risk calculator produces a data structure that the report generator must consume. Data importers probably have similar implementation needs Report checker doesn’t appear to connect with the file system that holds the reports. FS location is latent coupling that will be a nasty surprise later. Orchestrator might end need to do lots of data transformation to bridge interfaces. Example from c4model.com
  • 75.
    Batch Process File System [Container:Network File Share] Stores risk reports Report Distributor [Component: C#] Publishes the report for the web application Publishesrisk reportsto Reference Data System [Software System] Manages reference data for all counterparties the bank interacts with Central Monitoring Service [Software System] The bank-wide monitoringand alertingdashboard Trade Data System [Software System] The system of record for trades of type X E-mail system [Software System] Microsoft Exchange Sendsanotification that areport isready to Getstrade datafrom Sendscritical failure alertsto [SNMP] Getscounterparty datafrom Email Component [Component: C#] Sends emails Trade Data Importer [Component: C#] Imports data from the trade data system Reference Data Importer [Component: C#] Imports data from the reference datasystem Report Checker [Component: C#] Checks that the report has been generated by 9 a.m. Singapore time Alerter [Component: C# with SNMP library] Sends SNMPalerts Sendsalerts using Orchestrator [Component: C#] Orchestrates the risk calculation process Sendsemail using Importsdata using Importsdata using Risk Calculator [Component: C#] Does math Report Generator [Component: C# and Microsoft.Office.Interop.Excel] Generates an Excel compatible risk report Generatesthe risk report using Calculatesrisk using Scheduler [Component: Quartz.net] Starts the risk calculation process at 5 p.m. New York time Starts Starts Publishesthe risk report using Risk calculator produces a data structure that the report generator must consume. Data importers probably have similar implementation needs Report checker doesn’t appear to connect with the file system that holds the reports. FS location is latent coupling that will be a nasty surprise later. Orchestrator might end need to do lots of data transformation to bridge interfaces. Example from c4model.com
  • 76.
    Let’s explore optionsto uncouple these
  • 77.
    Problem: Risk calculator producesa data structure that the report generator must consume. Solutions depend on architectural style Here we’re in a Windows service so we might use a shared library to define the interface. Orchestrator [Component: C#] Orchestrates the risk calculation process Risk Calculator [Component: C#] Does math Report Generator [Component: C# and Microsoft.Office.Interop.Excel] Generates an Excel compatible risk report Generatesthe risk report using Calculatesrisk using
  • 78.
    Problem: Redundant implementationdetails This would be a good place to use a shared library for common implementation. Trade Data Importer [Component: C#] Imports data from the trade data system Reference Data Importer [Component: C#] Imports data from the reference datasystem Orchestrator [Component: C#] Orchestrates the risk calculation process Importsdata using Importsdata using
  • 79.
    File System [Container: NetworkFile Share] Stores risk reports Report Distributor [Component: C#] Publishes the report for the web application Publishesrisk reportsto Report Checker [Component: C#] Checks that the report has been generated by 9 a.m. Singapore time Alerter [Component: C# with SNMP library] Sends SNMPalerts Sendsalerts using Scheduler [Component: Quartz.net] Starts Publishesthe risk Problem: Latent coupling about filesystem layout. Solution: A module to hide the decision about filesystem layout from both the Report Distributor and the Report Checker
  • 80.
    Find solutions byrotating your perspective • When looking at components, think about modules • When looking at modules, think about components • When looking at data, think about code • When looking at code, think about data
  • 81.
    Use all yourtools 1. Module structure – layout of your code and libraries 2. Component structure – interactions between runtime components 3. Abstraction – Emphasize similar interfaces & data formats
  • 82.
    Coupling • Determines degreesof freedom. • Enables some movements. • Inhibits other movements. • Connects effects.
  • 83.
    Kinds of Coupling •Operational • Development • Semantic • Functional • Incidental
  • 84.
    Summary • Hide decisions •Choose degrees of freedom that matter • Avoid semantic polymers • Use static and dynamic structures • Find more instances of fewer, more general interfaces • Prefer explicit to tacit
  • 85.

Editor's Notes

  • #4 You’ve been working in your system for a year. Things are going well.
  • #5 You think it’s made of small pieces arranged beautifully. Until the day everything changes. You get the one new requirements that just doesn’t fit. You move one part, but that forces you to change something on the other side of the world. You change that and find that a different part breaks for no apparent reason.
  • #6 You begin to realize that your system is not a lovely arrangement of isolated pieces. It is more like a nest of opposing forces, it wants to fly apart or collapse at any time. It’s only held back from chaos by a network of interwoven dependencies. You pull one part and it tugs on a dozen others. You push a piece and it pushes back.
  • #7 You fight. The system fights back. Eventually, you are consumed by the chaos. A rewrite starts to sound better and better. After all, it should only take two weeks. You have fallen prey to coupling. This is the “choose your own adventure” page that says “You have died, go to page 1.”
  • #8 As we dissolve large systems into pieces, coupling ever more important. Moving from static equilibrium to dynamic equilibrium. Coupling is a dirty word in our industry. “Coupled” basically means “bad.” Coupling keeps us from making changes. It keeps our business from evolving. Coupling not a dirty word in other fields. Coupling means connector. It enables structure.
  • #9 Coupling as safety. Keeping two parts together.
  • #12 Coupling allows matter to exist.
  • #13 Knee bends in one plane. Doesn’t bend in other planes. (Not without damage anyway!)
  • #14 Knee bends in one plane. Doesn’t bend in other planes. (Not without damage anyway!)
  • #15 Knee bends in one plane. Doesn’t bend in other planes. (Not without damage anyway!)
  • #16 Knee bends in one plane. Doesn’t bend in other planes. (Not without damage anyway!)
  • #17 Knee bends in one plane. Doesn’t bend in other planes. (Not without damage anyway!)
  • #18 Note: Sometimes called the "Death Star" moon. Two tone coloring observed by Giovanni Cassini. In 2009, discovered that the likely cause is Phoebe.
  • #19 This is Phoebe.  213 km mean diameter.
  • #20 Note: Phoebe has a ring, Saturn's largest and most diffuse. 40x biggest than the entirety of the other rings. Ablated from Phoebe by micrometeorites. Solar pressure causes ring material to spiral toward Saturn. Swept up by Iapetus (which is tidally locked to Saturn.)
  • #21 Tell story of screaming at disks.
  • #24 What could we do about this to reduce the degree of coupling.
  • #25 What could we do about this to reduce the degree of coupling.
  • #26 What could we do about this to reduce the degree of coupling.
  • #27 What could we do about this to reduce the degree of coupling.
  • #28 What could we do about this to reduce the degree of coupling.
  • #30 Assume this is a direct database connection
  • #31 Assume this is a direct database connection
  • #32 Assume this is a direct database connection
  • #33 Assume this is a direct database connection
  • #34 Assume this is a direct database connection
  • #36 Assume this is a direct database connection
  • #37 Assume this is a direct database connection
  • #38 Assume this is a direct database connection
  • #39 Assume this is a direct database connection
  • #40 Assume this is a direct database connection
  • #42 Assume this is a direct database connection
  • #43 Assume this is a direct database connection
  • #44 Assume this is a direct database connection
  • #45 Assume this is a direct database connection
  • #46 Assume this is a direct database connection
  • #47 But not as difficult to manage in every case.
  • #50 SKU = “stock keeping unit”.
  • #51 SKU = “stock keeping unit”.
  • #52 SKU = “stock keeping unit”.
  • #53 SKU = “stock keeping unit”.
  • #60 Easy to see how this works. Module 1 creates an array which 2, 3, 4 use. Module 2 creates array which 3 uses. Module 3 creates array that 4 uses.
  • #61 I expect: 1: (1, 4); 2: (1, 2, 3, 4); 3: (2, 3, 4); 4: (1, 2, 3, 4) Change eff. = (20 – 11)/20 = 45%
  • #62 Interesting difference is the idea of defined interfaces and multiple implementors of the interface.
  • #63 I expect: 1: (1, 4); 2: (1, 2, 3, 4); 3: (2, 3, 4); 4: (1, 2, 3, 4) Change eff. = (20 – 11)/20 = 45%
  • #67 Operational high in all cases… was running in a single process. Development weakened thanks to functional interface. Semantic reduced due to interface instead of direct access to arrays. Functional also reduced by not having array manip & char packing/unpacking in all modules.
  • #71 Explain what this view is.
  • #85 Architecture by tesseract
  • #87 Knee bends in one plane. Doesn’t bend in other planes. (Not without damage anyway!)
  • #90 This is Phoebe.  213 km mean diameter.