Bird
Raised Fist0

You are reviewing an LLD for a payment processing system. The design uses tightly coupled classes for payment methods. What is the best design improvement?

hard๐Ÿ“ Trade-off Q8 of Q15
LLD - Advanced LLD Concepts
You are reviewing an LLD for a payment processing system. The design uses tightly coupled classes for payment methods. What is the best design improvement?
AIntroduce interfaces to decouple payment method implementations
BMerge all payment classes into one large class
CUse global variables to share payment data
DRemove abstraction layers to simplify design
Step-by-Step Solution
Solution:
  1. Step 1: Identify problem with tight coupling

    Tightly coupled classes reduce flexibility and increase maintenance effort.
  2. Step 2: Apply design principle for decoupling

    Using interfaces allows different payment methods to be implemented independently and extended easily.
  3. Final Answer:

    Introduce interfaces to decouple payment method implementations -> Option A
  4. Quick Check:

    Decouple with interfaces = D [OK]
Quick Trick: Use interfaces to reduce class dependencies [OK]
Common Mistakes:
MISTAKES
  • Combining classes increases complexity
  • Using globals harms modularity
  • Removing abstraction reduces flexibility

Want More Practice?

15+ quiz questions ยท All difficulty levels ยท Free

Free Signup - Practice All Questions
More LLD Quizzes