🔏
Tech
  • 🟢App aspects
    • Software architecture
      • Caching
      • Anti-patterns
      • System X-ability
      • Coupling
      • Event driven architecture
        • Command Query Responsibility Segregation (CQRS)
        • Change Data Capture (CDC)
      • Distributed transactions
      • App dev notes
        • Architecture MVP
      • TEMP. Check list
      • Hexagonal arch
      • Communication
        • REST vs messaging
        • gRPC
        • WebSocket
      • Load balancers
      • Storage limits
      • Event storming
    • Authentication
    • Deployment strategy
  • Databases
    • Classification
    • DB migration tools
    • PostreSQL
    • Decision guidance
    • Index
      • Hash indexes
      • SSTable, LSM-Trees
      • B-Tree
      • Engines, internals
    • Performance
  • System design
    • Interview preparation
      • Plan
        • Instagram
        • Tinder
        • Digital wallet
        • Dropbox
        • Live video streaming
        • Uber
        • Whatsup
        • Tiktok
        • Twitter
        • Proximity service
    • Algorithms
    • Acronyms
  • 🟢Programming languages
    • Java
      • Features
        • Field hiding
        • HashCode() and Equals()
        • Reference types
        • Pass by value
        • Atomic variables
      • Types
      • IO / NIO
        • Java NIO
          • Buffer
          • Channel
        • Java IO: Streams
          • Input streams
            • BufferedInputStream
            • DataInputStream
            • ObjectInputStream
            • FilterInputStream
            • ByteArrayInputStream
        • Java IO: Pipes
        • Java IO: Byte & Char Arrays
        • Java IO: Input Parsing
          • PushbackReader
          • StreamTokenizer
          • LineNumberReader
          • PushbackInputStream
        • System.in, System.out, System.error
        • Java IO: Files
          • FileReader
          • FileWriter
          • FileOutputStream
          • FileInputStream
      • Multithreading
        • Thread liveness
        • False sharing
        • Actor model
        • Singleton
        • Future, CompletableFuture
        • Semaphore
      • Coursera: parallel programming
      • Coursera: concurrent programming
      • Serialization
      • JVM internals
      • Features track
        • Java 8
      • Distributed programming
      • Network
      • Patterns
        • Command
      • Garbage Collectors
        • GC Types
        • How GC works
        • Tools for GC
    • Kotlin
      • Scope functions
      • Inline value classes
      • Coroutines
      • Effective Kotlin
    • Javascript
      • Javascript vs Java
      • TypeScript
    • SQL
      • select for update
    • Python
  • OS components
    • Network
      • TCP/IP model
        • IP address in action
      • OSI model
  • 🟢Specifications
    • JAX-RS
    • REST
      • Multi part
  • 🟢Protocols
    • HTTP
    • OAuth 2.0
    • LDAP
    • SAML
  • 🟢Testing
    • Selenium anatomy
    • Testcafe
  • 🟢Tools
    • JDBC
      • Connection pool
    • Gradle
    • vim
    • git
    • IntelliJ Idea
    • Elastic search
    • Docker
    • Terraform
    • CDK
    • Argo CD
      • app-of-app setup
    • OpenTelemetry
    • Prometheus
    • Kafka
      • Consumer lag
  • 🟢CI
    • CircleCi
  • 🟢Platforms
    • AWS
      • VPC
      • EC2
      • RDS
      • S3
      • IAM
      • CloudWatch
      • CloudTrail
      • ELB
      • SNS
      • Route 53
      • CloudFront
      • Athena
      • EKS
    • Kubernetes
      • Networking
      • RBAC
      • Architecture
      • Pod
        • Resources
      • How to try
      • Kubectl
      • Service
      • Tooling
        • ArgoCD
        • Helm
        • Istio
    • GraalVM
    • Node.js
    • Camunda
      • Service tasks
      • Transactions
      • Performance
      • How it executes
  • 🟢Frameworks
    • Hibernate
      • JPA vs Spring Data
    • Micronaut
    • Spring
      • Security
      • JDBC, JPA, Hibernate
      • Transactions
      • Servlet containers, clients
  • 🟢Awesome
    • Нейробиология
    • Backend
      • System design
    • DevOps
    • Data
    • AI
    • Frontend
    • Mobile
    • Testing
    • Mac
    • Books & courses
      • Path: Java Concurrency
    • Algorithms
      • Competitive programming
    • Processes
    • Finance
    • Electronics
  • 🟢Electronics
    • Arduino
    • IoT
  • Artificial intelligence
    • Artificial Intelligence (AI)
  • 🚀Performance
    • BE
  • 📘Computer science
    • Data structures
      • Array
      • String
      • LinkedList
      • Tree
    • Algorithms
      • HowTo algorithms for interview
  • 🕸️Web dev (Frontend)
    • Trends
    • Web (to change)
  • 📈Data science
    • Time series
Powered by GitBook
On this page
  • Component and Service Coupling
  • Law of demeter
  • Coupling tradeoffs
  • Stamp coupling

Was this helpful?

  1. App aspects
  2. Software architecture

Coupling

PreviousSystem X-abilityNextEvent driven architecture

Last updated 3 years ago

Was this helpful?

Component and Service Coupling

  • Static coupling:

    • Afferent coupling: how many components/services depend on YOU

    • Efferent coupling: on how many components you depend

Temporal coupling: (described from worst to better)

  • Pathological coupling

    • One component relies on inner workings of another component.

A depends on B INTERNALS;
!!=>> B does not change interface, but change internal logic;
A is broken because of it;
  • External coupling:

    • Solution to address the coupling: enterprise service bus (e.g. )

A exposes REST api;
B, C, D depend on this REST api;
!!=>> A changes endpoints to SOAP;
we do not even know how many components will be broken;
  • control coupling:

    • one component passes info to another component what to do

  • data coupling:

    • when components are bounded to shared data context (e.g. have same db)

Law of demeter

(Principle of least knowledge)

  • each component should have only limited knowledge about other components; only those closely related

  • each component should talk only to its friends; do not talk to strangers

  • only talk to your immediate friends

  • CA - incoming coupling

  • CE - outgoing coupling

  • CT - total coupling

If we redesign the system and try to make it as less coupled as possible. So we make the system fully async using messaging.

What are the tradeoffs of such loose coupling:

  • Workflow control. It is absolutely absent, "order placement" does not know what happens after it submits a message, will it be processed by any service at all

  • Error handling. What if e.g. "payment service" throws an exception.

  • Data consistency.

  • Transaction state management.

Stamp coupling

  • if Profile_service changes contract e.g. state to statecd Whishlist service will be affected, because it will need to update a contract.

  • So change in irrelevant field statewill cause a redeployment/retesting of wishlist service

    • return partial data (e.g. via request parameters)

    • use GraphQL

Problem 1 : when wishlist service needs only a name from the profile service, but you return the whole customer profile this is a STAMP COUPLING.

Problem 2: bandwidth. We will transfer unnecessary data, which may cost a lot.

Solutions:

solves bandwidth

not really solves a stamp coupling (contract changes still apply)

create dedicated endpoint to receive only required information (solves both problems)

🟢
⚠️
⚠️
✅
👍
👋
👍
👍
👎
Lesson 29
Spring integration camel
Coupling tradeoffs
Lesson 105