Hello. Bridge is the use of two interfaces or abstract classes (in the simplest form, the description of them is 2). And in the external code, we substitute the necessary classes that implement them. That is, in this respect, there is no difference from the same Abstract Factory, except that Abstract Factory generates objects, and Bridge describes the interaction of what Abstract Factory describes this same behavior, only at the level of creating a family of objects.

That is, we can say that Abstract Factory uses Bridge to separate an abstract factory and a concrete factory + separate abstract modules, from which it creates families of objects from their specific implementations.

This is true?

    1 answer 1

    No, these are completely different things, these patterns are not connected in any way. They even look completely different.

    Abstract factory generates a family of interrelated objects.

    The bridge separates the interface from the implementation. But not everything that separates the implementation from the interface is a bridge . A bridge is a concrete structure that allows unleashing them so that they can be changed independently. For example, if the interface of an abstract factory changes (a new product appears), then all its implementations will have to be changed.

    • Doesn’t an abstract factory separate the interface of an abstract factory from its concrete implementation? So with the composite objects of families. They have their interfaces and specific implementations - Sergey
    • @Sergey added. - Fat-Zer
    • Got it! Thanks for the detailed answer! - Sergey