Bird
Raised Fist0

Which pattern best suits this scenario?

easy🔍 Pattern Recognition Q11 of Q15
OOP & Design Patterns - Adapter vs Facade vs Proxy - Structural Pattern Comparison
You have a legacy payment processing system with an incompatible interface, and you want to integrate it into a new e-commerce platform without changing the legacy code. Which pattern best suits this scenario?
AFacade, to provide a simplified interface to the legacy system
BAdapter, to convert the legacy interface to the new platform's expected interface
CProxy, to control access and add security to the legacy system
DDecorator, to add new behavior to the legacy system dynamically
Step-by-Step Solution
  1. Step 1: Identify the problem

    The legacy system's interface is incompatible with the new platform.
  2. Step 2: Understand pattern intents

    Adapter converts one interface to another, enabling integration without changing legacy code. Facade simplifies a complex subsystem but doesn't change interfaces. Proxy controls access, not interface compatibility. Decorator adds behavior dynamically, unrelated to interface mismatch.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    Adapter is the go-to pattern for interface incompatibility issues.
Quick Trick: Adapter = interface translator; Facade = interface simplifier; Proxy = access controller
Common Mistakes:
MISTAKES
  • Confusing Facade with Adapter because both provide a new interface
  • Thinking Proxy changes interfaces rather than controlling access
  • Assuming Decorator handles interface incompatibility
Trap Explanation:
PITFALL
  • Facade simplifies but does not adapt interfaces; Proxy controls access but does not translate interfaces; Decorator adds behavior but does not solve interface mismatch.
Interviewer Note:
CONTEXT
  • Tests candidate's ability to distinguish pattern intents and apply them to integration problems.
Master "Adapter vs Facade vs Proxy - Structural Pattern Comparison" in OOP & Design Patterns

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More OOP & Design Patterns Quizzes