Exercise 3: Why Adapter and Facade Solve Genuinely Different Problems — Possible Solution ==================================================================== WHAT WAS ACTUALLY WRONG IN THE PAYMENT GATEWAY PROBLEM ------------------------------ This chapter verified the payment gateway problem was a genuine INTERFACE MISMATCH - checkout() called payment_processor.pay(amount), but LegacyPaymentGateway only offered make_payment(amount_cents, currency), a method with a different name, different parameter count, and different units entirely. This produced a real, verified AttributeError - the two pieces of code could not communicate AT ALL without translation. WHY A FACADE COULDN'T HAVE FIXED THIS ------------------------------ A Facade's job, as this chapter's own HomeTheaterFacade demonstrated, is to take several ALREADY-COMPATIBLE, ALREADY-WORKING method calls and bundle them behind one simpler method - it doesn't translate between incompatible interfaces at all, it just reduces how many already-functional calls the client has to make. Since checkout() and LegacyPaymentGateway couldn't communicate at all (verified by the AttributeError), there was no set of already-working calls for a Facade to simplify - the interface mismatch itself needed to be resolved first, which is specifically Adapter's job. WHAT WAS ACTUALLY WRONG IN THE HOME THEATER PROBLEM ------------------------------ This chapter verified the home theater problem was not an interface mismatch at all - amp.on(), proj.set_input(), dvd.play(), and every other individual call worked completely correctly on their own (the manual sequence executed successfully and produced a correct call log). The actual problem was that the CLIENT had to remember many individual, correctly-working calls in the correct order - a complexity/usability problem, not a compatibility problem. WHY AN ADAPTER COULDN'T HAVE FIXED THIS ------------------------------ Adapter's job is translating one specific incompatible interface into a compatible one - but there was no incompatibility here to translate; every component's own interface already worked exactly as expected. Wrapping any single component in an Adapter wouldn't reduce the number of calls the client needs to make across THREE separate components, or enforce the correct ordering between them - that specific problem (bundling many separately-correct calls into one simpler call) is exactly what Facade, not Adapter, is built for. WHY THIS WORKS AS AN ANSWER ------------------------------ The answer identifies the specific, different root problem each scenario verified (a genuine interface incompatibility vs. a usability/complexity problem across otherwise-working components), and explains precisely why each pattern's own actual mechanism (interface translation vs. call bundling) does or doesn't address the other scenario's specific problem, rather than treating the two patterns as interchangeable "wrapper" solutions.