Member-only story
LLD: Bridge Design Pattern (Structural)
Definition
The Bridge Design Pattern decouples an abstraction(high-level logic defines the “what”) from its implementation(low-level details that define the “how”) so that the two can evolve independently.
The Problem
Let’s consider an example of different living things with different respiratory mechanisms.
The naive approach of this implementation would be to introduce an abstraction for the respiratory mechanism, i.e. breathing process, and extend it to define the breathing process for each new type of living thing we introduce.
Let’s look at the code example:
// Approach without bridge: breathing logic hardcoded inside LivingThings
public abstract class LivingThings {
abstract public void breathe();
}public class Dog extends LivingThings {
// Breathing Process is tightly coupled to the LivingThings(abstraction)
@Override
public void breathe() {
System.out.println("Dog: Breathes through its nose; Lives on land; Respiratory system: 2 lungs");
System.out.println("Breathing Process: Inhales Oxygen from the air and Exhales Carbon Dioxide.");
}
}public class Fish extends LivingThings {
// Breathing Process is tightly coupled to the LivingThings(abstraction)
@Override
public void breathe() {
System.out.println("Fish: Breathes through gills; Lives in water; Respiratory system: 2 gills")…





![Design an Online Game Leaderboad [System Design HLD]](https://miro.medium.com/v2/resize:fit:1358/format:webp/1*5TfDdjkSA3CtU9R3E5ZqnQ.png)
![System Design Interview Series:3/30[Back-of-Envelope Estimation]](https://miro.medium.com/v2/resize:fit:1358/format:webp/1*xgLXa5l3deDFviuJtxrtqA.png)

