Bridge pattern
During software design, we may face the problem that the same abstraction can have multiple implementations. This is mostly visible when doing cross-platform development. Examples could include a line-feed line break on Linux or the existence of a registry on Windows. A Java implementation that needs to get specific system information, by running specific OS calls, will definitely need to be able to vary the implementation. One way to do this is by using inheritance, but this will bind the children to a specific interface, which may not exist on different platforms.
In these cases, it is advisable to use the bridge pattern, since it allows moving away from a proliferation of classes that extend a specific abstraction to nested ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access