CS FundamentalsHardIBM · Deloitte pattern
Your application expects a PaymentGateway interface, but the third-party library you must use exposes a different API. Which pattern lets you use it without changing either side?
- A. Decorator
- B. Facade
- C. Adapter
- D. Proxy
Correct answer: C. Adapter
An Adapter wraps the library and converts its interface into the one the client expects. A Facade simplifies a subsystem but does not match an existing target interface; Decorator adds behaviour with the same interface.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- class Square extends Rectangle overrides setWidth() so that it also changes the height. Code that sets width = 5 and height = 4 on a…
- A ReportService creates a new MySqlDatabase() directly inside its constructor. Refactoring it to receive a Database interface through its…
- Which HTTP method is NOT idempotent by definition?
- A logged-in user with a valid token calls an admin-only API endpoint. Which status code should the server return?
- In the IaaS model (for example a plain cloud virtual machine), which of these is the customer's responsibility rather than the provider's?
- A Scrum team's last three sprints delivered 28, 32 and 30 story points. 240 points remain in the backlog and sprints are 2 weeks long…