Uncoupling Michael T. Nygard @mtnygard
About the Speaker Blog: http://www.michaelnygard.com/ Developer Twitter: http://twitter.com/mtnygard Architect Operations
About the Speaker • Stewards of Clojure & ClojureScript • Creators of Datomic • Open source contributions • Pedestal • Vase • Onto • Simulant
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. (E.g., breaking API changes.)
Analyzing Coupling I E-mail system Email Component [Software System] [Component: C#] Sends a notification that a report is ready to Microsoft Exchange Sends emails
Analyzing Coupling I E-mail system Email Component [Software System] [Component: C#] Sends a notification that a report is ready to Microsoft Exchange Sends emails Operational: Strong. SMTP is synchronous, connection-oriented, conversational
Analyzing Coupling I E-mail system Email Component [Software System] [Component: C#] Sends a notification that a report is ready to Microsoft Exchange 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 Email Component [Software System] [Component: C#] Sends a notification that a report is ready to Microsoft Exchange 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 Email Component [Software System] [Component: C#] Sends a notification that a report is ready to Microsoft Exchange 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 SQL connection Reference Data System to RDBMS Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with
Analyzing Coupling II-A SQL connection Reference Data System to RDBMS Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with Operational: Very strong. Dependent on availability of server. Must be aware of topology and failover strategy
Analyzing Coupling II-A SQL connection Reference Data System to RDBMS Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with 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 SQL connection Reference Data System to RDBMS Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with 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 SQL connection Reference Data System to RDBMS Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with 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.
Suppose we use REST instead of SQL?
Analyzing Coupling II-B HTTPS request Reference Data System to REST API Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with
Analyzing Coupling II-B HTTPS request Reference Data System to REST API Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with Operational: Strong, but less than before. Dependent on availability of server.
Analyzing Coupling II-B HTTPS request Reference Data System to REST API Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with 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
Analyzing Coupling II-B HTTPS request Reference Data System to REST API Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with 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
Analyzing Coupling II-B HTTPS request Reference Data System to REST API Reference Data Importer [Software System] [Component: C#] Gets counterparty Manages reference data for all data from Imports data from the reference counterparties the bank interacts data system with 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.
What if we invert the flow of control?
Analyzing Coupling II-C Reference Data System Reference Data Receiver [Software System] Message Broker [Component: C#] [Software System] Broadcasts Broadcasts Manages reference data for all Accepts and caches data from the counterparties the bank interacts Pub/sub hub, bub reference data system with
Analyzing Coupling II-C Reference Data System Reference Data Receiver [Software System] Message Broker [Component: C#] [Software System] Broadcasts Broadcasts Manages reference data for all Accepts and caches data from the counterparties the bank interacts Pub/sub hub, bub reference data system with Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken.
Analyzing Coupling II-C Reference Data System Reference Data Receiver [Software System] Message Broker [Component: C#] [Software System] Broadcasts Broadcasts Manages reference data for all Accepts and caches data from the counterparties the bank interacts Pub/sub hub, bub reference data system with Operational: Very weak. Receiver can run with stale data when either broker or upstream are broken. Development: Weak. Insulated from schema changes.
More recommend