Shape mismatch
Adapter is for translation when a useful collaborator exposes the wrong interface.
Adapter, Facade, and Proxy all wrap something, which is why they are often confused. The clean distinction is the force. Adapter handles interface mismatch. Facade simplifies a noisy subsystem. Proxy controls access to an object while preserving the same interface.
Java systems wrap external SDKs, internal subsystems, repositories, and remote clients constantly. Choosing the wrong wrapper shape makes code harder to read because the intent becomes unclear.
The similarity between these patterns is only that they sit between a client and something else. The real difference is why they exist. Adapter changes the visible interface. Facade creates a simpler entry point into several collaborators. Proxy preserves the interface but changes how access happens.
In Java work, that distinction matters because integrations, service orchestration, security wrappers, and remote calls all produce wrapper classes. If you can name the force clearly, the right pattern is usually obvious.
Choose the pattern that matches the reason for the wrapper, not the fact that a wrapper exists.
Adapter is for translation when a useful collaborator exposes the wrong interface.
Facade is for giving clients a simpler, higher-level way to use a more complex subsystem.
Proxy is for controlling access to an object without changing the interface clients already expect.
package org.javaomnibus.ecommerce.gof.structural;
public final class StructuralWrapperExamples {
ShipmentTracker trackingAdapter() { return null; }
OrderPlacementFacade orderFacade() { return null; }
CustomerProfileRepository securedRepositoryProxy() { return null; }
}
| Pattern | Main force | What stays the same | Typical Java example |
|---|---|---|---|
| Adapter | Interface mismatch | Client expectation | Wrapping a legacy SDK client |
| Facade | Subsystem complexity | Subsystem internals behind the scenes | Order placement orchestration entry point |
| Proxy | Access mediation | Target interface | Security or lazy-loading wrapper |
Comparison pages make pattern choice easier, but wrapper-heavy systems still require careful naming and architecture discipline. The goal is clarity of intent, not just picking a label.