0
0
LLDsystem_design~12 mins

Bridge pattern in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Bridge pattern

The Bridge pattern helps separate an abstraction from its implementation. This allows both to change independently. It is useful when you want to avoid a permanent binding between an interface and its implementation.

Key requirements include flexibility to extend abstractions and implementations without modifying existing code.

Architecture Diagram
Abstraction
   |
   v
RefinedAbstraction
   |
   v
Implementor <----> ConcreteImplementorA
   |
   v
ConcreteImplementorB
Components
Abstraction
interface
Defines the abstraction's interface and maintains a reference to an Implementor.
RefinedAbstraction
class
Extends Abstraction and uses Implementor to perform operations.
Implementor
interface
Defines the interface for implementation classes.
ConcreteImplementorA
class
Implements Implementor interface with a specific implementation.
ConcreteImplementorB
class
Implements Implementor interface with another specific implementation.
Request Flow - 5 Hops
ClientRefinedAbstraction
RefinedAbstractionImplementor
ImplementorConcreteImplementorA or ConcreteImplementorB
ConcreteImplementorA or ConcreteImplementorBRefinedAbstraction
RefinedAbstractionClient
Failure Scenario
Component Fails:ConcreteImplementorA or ConcreteImplementorB
Impact:Operation cannot be completed as the implementation is unavailable or faulty.
Mitigation:Use another ConcreteImplementor implementation or fallback mechanism to continue operation.
Architecture Quiz - 3 Questions
Test your understanding
What is the main purpose of the Bridge pattern?
ATo combine multiple interfaces into one
BTo separate abstraction from implementation so they can vary independently
CTo create a single global instance
DTo restrict object creation
Design Principle
The Bridge pattern decouples abstraction from implementation, allowing both to evolve independently. This reduces code duplication and increases flexibility by enabling different implementations to be swapped without changing the abstraction.