Decoupling Services

Design more decoupled services with one weird trick - Udi Dahan - NDC Oslo 2024

BLUF (Bottom Line Up Front)

The talk by Udi Dahan focuses on the importance of decoupling services in software architecture to address longstanding issues of coupling, which can lead to complex, interdependent systems that are difficult to manage and evolve. The solution involves adopting event-driven and vertical slice architectures, along with a simple yet effective technique of generating unique identifiers upfront to reduce logical coupling.

Main Points

  • Historical Context of Coupling:

    • Coupling has been a persistent problem in software development, often leading to "spaghetti code" where changes in one part of the system inadvertently affect others.

    • Databases, especially shared ones, exacerbate coupling issues, making it difficult to change one component without impacting others.

  • Microservices and Their Challenges:

    • While microservices were introduced to decouple systems, they often fail if they share a common database, leading to similar coupling issues as monoliths.

    • The transition from monoliths to microservices or back to modular monoliths does not inherently solve logical coupling.

  • Event-Driven Architecture:

    • Event-driven architecture helps in decoupling by using publish-subscribe patterns instead of direct request-response, which allows components to operate independently.

    • It is crucial to use events for past occurrences (e.g., "order accepted") rather than commands (e.g., "save customer").

  • Vertical Slice Architecture:

    • Vertical slice architecture divides applications into slices that contain all necessary components (UI, business logic, data access) for a specific feature, rather than separating by layer (e.g., UI layer, business logic layer).

    • This approach aligns technical boundaries with business needs, reducing unnecessary coupling.

  • One Weird Trick:

    • Generating unique identifiers at the beginning of a workflow allows each service to manage its own data independently, reducing the need for shared data and thus decoupling services.

    • This technique supports the encapsulation of data and logic within services, enabling easier adaptation to business changes without widespread system modifications.


Last updated

Was this helpful?