1. Compare the Adapter and Facade patterns and describe scenarios for choosing each.
Adapter and Facade are both structural patterns, but they serve different purposes. /n/n Adapter is used when you have existing classes with incompatible interfaces and you need to make them work together. For example, you have a library class that exposes one interface and your code expects another; you write an Adapter to wrap the library class so that it matches your expected interface. /n/n Facade is used when you want to simplify a complex subsystem by providing a single unified interface to it. For instance you expose a `PaymentFacade.processPayment()` method that internally coordinates wiring of multiple classes (gateway, logger, notifier) while the client only deals with the facade. /n/n Choosing Adapter emphasizes compatibility between interfaces; choosing Facade emphasises simplifying usage of complex subsystem.