Bird
Raised Fist0

Which pattern(s) should you apply and why?

hard🌍 Real-world Scenario Q9 of Q15
OOP & Design Patterns - Adapter vs Facade vs Proxy - Structural Pattern Comparison
You are designing a media player application that must support legacy audio formats with incompatible interfaces and also provide a simple interface to clients. Which pattern(s) should you apply and why?
AApply Facade to convert legacy interfaces and Proxy to provide caching
BApply Proxy to control access to legacy audio formats and Adapter to simplify client interface
CApply Adapter to convert legacy audio interfaces and Facade to provide a simple client interface
DApply Adapter to unify multiple audio formats and Proxy to simplify client interface
Step-by-Step Solution
Solution:
  1. Step 1: Identify legacy interface incompatibility

    Legacy audio formats have incompatible interfaces needing conversion via Adapter.
  2. Step 2: Identify client simplification need

    Facade provides a simple unified interface to clients.
  3. Step 3: Why other options are incorrect

    Apply Proxy to control access to legacy audio formats and Adapter to simplify client interface misuses Proxy and Adapter roles; Apply Facade to convert legacy interfaces and Proxy to provide caching misuses Facade as converter; Apply Adapter to unify multiple audio formats and Proxy to simplify client interface misuses Proxy and Adapter roles.
  4. Final Answer:

    Option C -> Option C
  5. Quick Check:

    Adapter converts; Facade simplifies [OK]
Quick Trick: Adapter converts legacy; Facade simplifies client interface [OK]
Common Mistakes:
MISTAKES
  • Confusing Proxy with Adapter or Facade
  • Misapplying Facade as interface converter
Trap Explanation:
PITFALL
  • Candidates often confuse which pattern handles interface conversion vs simplification.
Interviewer Note:
CONTEXT
  • Assesses ability to apply multiple patterns to real-world design.
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